[BioPython] interbase vs one-based?

Peter (BioPython List) biopython at maubp.freeserve.co.uk
Mon Dec 18 11:37:02 UTC 2006


Ann Loraine wrote:
> Hello,
> 
> I'm not sure if this is a bug or not...my apologies if this has 
> already been discussed.

Yes, a raw location of 222..1607 is intentionally converted into a
location [221:1607] in BioPython.  This has been discussed before on the 
mailing list... but never mind.

The rational is to follow the python string splicing conventions, thus
req.seq[221:1607] should give you the nucleotides for this feature.

Try:

help(Bio.SeqFeature.FeatureLocation)

or:

print rec.features[1].location.__doc__

You should get something like this:
> Specify the location of a feature along a sequence.
> 
> This attempts to deal with fuzziness of position ends, but also make
> it easy to get the start and end in the 'normal' case (no fuzziness).
> 
> You should access the start and end attributes with
> your_location.start and your_location.end. If the start and end are
> exact, this will return the positions, if not, we'll return the
> approriate Fuzzy class with info about the position and fuzziness.
> 
> 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).

Peter




More information about the Biopython mailing list