pybedtools.cbedtools.Interval¶
- class pybedtools.cbedtools.Interval¶
Class to represent a genomic interval.
Constructor:
Interval(chrom, start, end, name=".", score=".", strand=".", otherfields=None)
Class to represent a genomic interval of any format. Requires at least 3 args: chrom (string), start (int), end (int).
startis always the 0-based start coordinate. If this Interval is to represent a GFF object (which uses a 1-based coordinate system), then subtract 1 from the 4th item in the line to get the start position in 0-based coords for this Interval. The 1-based GFF coord will still be available, albeit as a string, in fields[3].otherfieldsis a list of fields that don’t fit into the other kwargs, and will be stored in thefieldsattribute of the Interval.All the items in
otherfieldsmust be strings for proper conversion to C++.By convention, for BED files,
otherfieldsis everything past the first 6 items in the line. This allows an Interval to represent composite features (e.g., a GFF line concatenated to the end of a BED line)But for other formats (VCF, GFF, SAM), the entire line should be passed in as a list for
otherfieldsso that we can always check the Interval.file_type and extract the fields we want, knowing that they’ll be in the right order as passed in withotherfields.Example usage:
>>> from pybedtools import Interval >>> i = Interval("chr1", 22, 44, strand='-') >>> i Interval(chr1:22-44)
- __init__(*args, **kwargs)¶
Methods
__init__(*args, **kwargs)append(value)deparse_attrs()Attributes
attrschromthe chromosome of the feature
countendThe end of the feature
fieldsfile_typebed/vcf/gff
lengththe length of the feature
nameo_amto_endo_startscorestartThe 0-based start of the feature.
stopthe end of the feature
strandthe strand of the feature