| Trees | Indices | Help |
|
|---|
|
|
object --+
|
FeatureLocation
Specify the location of a feature along a sequence. The FeatureLocation is used for simple continous features, which can be described as running from a start position to and end position (optionally with a strand and reference information). More complex locations made up from several non-continuous parts (e.g. a coding sequence made up of several exons) are currently described using a SeqFeature with sub-features. Note that the start and end location numbering follow Python's scheme, thus a GenBank entry of 123..150 (one based counting) becomes a location of [122:150] (zero based counting). >>> from Bio.SeqFeature import FeatureLocation >>> f = FeatureLocation(122, 150) >>> print f [122:150] >>> print f.start 122 >>> print f.end 150 >>> print f.strand None Note the strand defaults to None. If you are working with nucleotide sequences you'd want to be explicit if it is the forward strand: >>> from Bio.SeqFeature import FeatureLocation >>> f = FeatureLocation(122, 150, strand=+1) >>> print f [122:150](+) >>> print f.strand 1 Note that for a parent sequence of length n, the FeatureLocation start and end must satisfy the inequality 0 <= start <= end <= n. This means even for features on the reverse strand of a nucleotide sequence, we expect the 'start' coordinate to be less than the 'end' coordinate. >>> from Bio.SeqFeature import FeatureLocation >>> r = FeatureLocation(122, 150, strand=-1) >>> print r [122:150](-) >>> print r.start 122 >>> print r.end 150 >>> print r.strand -1 i.e. Rather than thinking of the 'start' and 'end' biologically in a strand aware manor, think of them as the 'left most' or 'minimum' boundary, and the 'right most' or 'maximum' boundary of the region being described. In the example above we have used standard exact positions, but there are also specialised position objects used to represent fuzzy positions as well, for example a GenBank location like complement(<123..150) would use a BeforePosition object for the start.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
strand Strand of the location (+1, -1, 0 or None). |
|||
|
start Start location (integer like, possibly a fuzzy position, read only). |
|||
|
end End location (integer like, possibly a fuzzy position, read only). |
|||
|
nofuzzy_start Start position (integer, approximated if fuzzy, read only) (OBSOLETE). |
|||
|
nofuzzy_end End position (integer, approximated if fuzzy, read only) (OBSOLETE). |
|||
|
Inherited from |
|||
|
|||
Specify the start, end, strand etc of a sequence feature. start and end arguments specify the values where the feature begins and ends. These can either by any of the *Position objects that inherit from AbstractPosition, or can just be integers specifying the position. In the case of integers, the values are assumed to be exact and are converted in ExactPosition arguments. This is meant to make it easy to deal with non-fuzzy ends. i.e. Short form: >>> from Bio.SeqFeature import FeatureLocation >>> loc = FeatureLocation(5, 10, strand=-1) >>> print loc [5:10](-) Explicit form: >>> from Bio.SeqFeature import FeatureLocation, ExactPosition >>> loc = FeatureLocation(ExactPosition(5), ExactPosition(10), strand=-1) >>> print loc [5:10](-) Other fuzzy positions are used similarly, >>> from Bio.SeqFeature import FeatureLocation >>> from Bio.SeqFeature import BeforePosition, AfterPosition >>> loc2 = FeatureLocation(BeforePosition(5), AfterPosition(10), strand=-1) >>> print loc2 [<5:>10](-) For nucleotide features you will also want to specify the strand, use 1 for the forward (plus) strand, -1 for the reverse (negative) strand, 0 for stranded but strand unknown (? in GFF3), or None for when the strand does not apply (dot in GFF3), e.g. features on proteins. >>> loc = FeatureLocation(5, 10, strand=+1) >>> print loc [5:10](+) >>> print loc.strand 1 Normally feature locations are given relative to the parent sequence you are working with, but an explicit accession can be given with the optional ref and db_ref strings: >>> loc = FeatureLocation(105172, 108462, ref="AL391218.9", strand=1) >>> print loc AL391218.9[105172:108462](+) >>> print loc.ref AL391218.9
|
Returns a representation of the location (with python counting). For the simple case this uses the python splicing syntax, [122:150] (zero based counting) which GenBank would call 123..150 (one based counting).
|
A string representation of the location for debugging.
|
Returns True regardless of the length of the feature. This behaviour is for backwards compatibility, since until the __len__ method was added, a FeatureLocation always evaluated as True. Note that in comparison, Seq objects, strings, lists, etc, will all evaluate to False if they have length zero. WARNING: The FeatureLocation may in future evaluate to False when its length is zero (in order to better match normal python behaviour)! |
Returns the length of the region described by the FeatureLocation. Note that extra care may be needed for fuzzy locations, e.g. >>> from Bio.SeqFeature import FeatureLocation >>> from Bio.SeqFeature import BeforePosition, AfterPosition >>> loc = FeatureLocation(BeforePosition(5),AfterPosition(10)) >>> len(loc) 5 |
Check if an integer position is within the FeatureLocation. Note that extra care may be needed for fuzzy locations, e.g. >>> from Bio.SeqFeature import FeatureLocation >>> from Bio.SeqFeature import BeforePosition, AfterPosition >>> loc = FeatureLocation(BeforePosition(5),AfterPosition(10)) >>> len(loc) 5 >>> [i for i in range(15) if i in loc] [5, 6, 7, 8, 9] |
Iterate over the parent positions within the FeatureLocation. >>> from Bio.SeqFeature import FeatureLocation >>> from Bio.SeqFeature import BeforePosition, AfterPosition >>> loc = FeatureLocation(BeforePosition(5),AfterPosition(10)) >>> len(loc) 5 >>> for i in loc: print i 5 6 7 8 9 >>> list(loc) [5, 6, 7, 8, 9] >>> [i for i in range(15) if i in loc] [5, 6, 7, 8, 9] Note this is strand aware: >>> loc = FeatureLocation(BeforePosition(5), AfterPosition(10), strand = -1) >>> list(loc) [9, 8, 7, 6, 5] |
|
|||
strandStrand of the location (+1, -1, 0 or None).
|
startStart location (integer like, possibly a fuzzy position, read only).
|
endEnd location (integer like, possibly a fuzzy position, read only).
|
nofuzzy_startStart position (integer, approximated if fuzzy, read only) (OBSOLETE). This is now a alias for int(feature.start), which should be used in preference -- unless you are trying to support old versions of Biopython.
|
nofuzzy_endEnd position (integer, approximated if fuzzy, read only) (OBSOLETE). This is now a alias for int(feature.end), which should be used in preference -- unless you are trying to support old versions of Biopython.
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Feb 5 18:02:51 2013 | http://epydoc.sourceforge.net |