I/O Module
io
Classes
BedSet
BedSet(region_sets=None, file_path=None, identifier=None)
BedSet object
Initialize a BedSet object.
Args: region_sets: list of BED file paths, RegionSet, or 2-dimension list of Region. Defaults to None (empty BedSet). file_path (str): path to the .txt file with identifier of all BED files in it identifier (str): the identifier of the BED set
Functions
add
add(bedfile)
Add a BED file to the BED set.
Warning: if new bedfile will be added, bedSet identifier will be changed!
Args: bedfile (RegionSet): RegionSet instance, that should be added to the bedSet
compute_bedset_identifier
compute_bedset_identifier()
Return the identifier. If it is not set, compute one.
Returns: 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.
Args: regions: path, or url to bed file or list of Region objects backed (bool): whether to load the bed file into memory or not. Defaults to False.
Functions
to_granges
to_granges()
Return GenomicRanges contained in this BED file.
Returns: genomicranges.GenomicRanges: GenomicRanges object
compute_bed_identifier
compute_bed_identifier()
Return bed file identifier. If it is not set, compute one.
Returns: str: the identifier of BED file
Region
Region(chr, start, stop)
Instantiate a Region object.
Args: chr (str): chromosome start (int): start position stop (int): stop position