Skip to content

I/O Module

io

Classes

BedSet

BedSet(region_sets=None, file_path=None, identifier=None)

BedSet object

Parameters:

Name Type Description Default
region_sets Union[List[RegionSet], List[str], List[List[Region]], None]

list of BED file paths, RegionSet, or 2-dimension list of Region [Default: None - empty BedSet]

None
file_path str

path to the .txt file with identifier of all BED files in it

None
identifier str

the identifier of the BED set

None
Functions
add
add(bedfile)

Add a BED file to the BED set

!Warning: if new bedfile will be added, bedSet identifier will be changed!

Parameters:

Name Type Description Default
bedfile RegionSet

RegionSet instance, that should be added to the bedSet

required

Returns:

Type Description
NoReturn

NoReturn

to_granges_list
to_granges_list()

Process a list of BED set identifiers and returns a GenomicRangesList object

compute_bedset_identifier
compute_bedset_identifier()

Return the identifier. If it is not set, compute one

Parameters:

Name Type Description Default
bedset

BedSet object

required

Returns:

Type Description
str

the identifier of BED set

RegionSet

RegionSet(regions, backed=False)

Instantiate a RegionSet object. This can be backed or not backed. It represents a set of genomic regions.

If you specify backed as True, then the bed file will not be loaded into memory. This is useful for large bed files. You can still iterate over the regions, but you cannot index into them.

Parameters:

Name Type Description Default
regions Union[str, List[Region]]

path, or url to bed file or list of Region objects

required
backed bool

whether to load the bed file into memory or not [Default: False]

False
Functions
to_granges
to_granges()

Return GenomicRanges contained in this BED file

Returns:

Type Description
GenomicRanges

GenomicRanges object

compute_bed_identifier
compute_bed_identifier()

Return bed file identifier. If it is not set, compute one

Returns:

Type Description
str

the identifier of BED file (str)

Region

Region(chr, start, stop)

Instantiate a Region object.

Parameters:

Name Type Description Default
chr str

chromosome

required
start int

start position

required
stop int

stop position

required
Functions