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

Peter Cock p.j.a.cock at googlemail.com
Sat Sep 17 15:38:53 EDT 2011


On Sat, Sep 17, 2011 at 2:44 PM, Eric Talevich wrote:
> On Fri, Sep 16, 2011 at 7:01 PM, Peter Cock wrote:
>>
>> On Fri, Sep 16, 2011 at 9:33 PM, Eric Talevich wrote:
>> >
>> > Think that would work?
>>
>> Yes - in fact I've done that on another branch but with to avoid
>> circular imports used hasattr(index, "extract") instead. It solves
>> a different problem to making start/end easier to use.
>
> OK, you're way ahead of me.

Well, I've been thinking about this on and off for a while now.
One issue with the __getitem__ trick is what would we do for
the SeqRecord when sliced with a SeqFeature? Should it use
the id and annotation from the SeqFeature or the SeqRecord?

> The new start/end properties you implemented
> look good to me, and I doubt there would be a serious hit
> to performance -- plus, code that didn't need these shortcuts
> don't have to use them.

Good. I've realised I need to double check the integer
methods (equals, sorting, hashes etc), but they should
be fine.

> These will be handy for writing code that visualizes
> SeqFeatures, too.

Well, slightly easier - I have some more dramatic changes to
the SeqFeature and FeatureLocation objects planned, but I'm
still playing with this.

Peter


More information about the Biopython-dev mailing list