[Biopython-dev] SeqFeature start/end and making positions act like ints

Peter Cock p.j.a.cock at googlemail.com
Fri Sep 16 16:31:13 UTC 2011

Hi all,

We've previously discussed adding start/end properties
to the SeqFeature returning integers - which would be
useful but inconsistent with the FeatureLocation which
returns Position objects:


After an interesting discussion with Leighton, I spent
the afternoon making (most of the) Position objects
subclass int - so that they can be used like integers
(with the fuzzy information retained but generally
ignored except for writing the features out again).

This means we can have SeqFeature start/end
properties which like those of the FeatureLocation
return position objects - and they are actually easy
to use (except for some very extreme cases).
e.g. You can use them to slice a sequence.

The code is on a branch here:

It is almost 100% backwards compatible. Some
of the arguments for creating a fuzzy position
(and their __repr__) have changed, and some
of their attributes, but we feel this is unlikely to
actually affect anyone. We rather suspect only
the SeqIO parsers actually create or use the
fuzzy objects in the first place!

In terms of usability I think this is a worthwhile
improvement. The new class heirachy is a bit
more complex though - and I have not looked
at the performance implications at all.

Would anyone like to review this please?


More information about the Biopython-dev mailing list