[Biopython] Transferring SeqFeatures between aligned sequences

Uri Laserson laserson at mit.edu
Fri Mar 11 17:03:58 UTC 2011


>
> OK - and do you want to worry about spotting frameshifts,
> and updating the translation for CDS features?
>

I can retranslate the features myself, weary of any frameshifts


> You could do, or create a new SeqFeature, or "steal" the old one and
> modify it. The later technique would probably be fastest since there
> are no new objects to create, just a few integer attributes changes
> (location positions), but is perhaps a bit risky if you don't comment
> it clearly. If you do that, perhaps do this by popping the features
> from the old SeqRecord's feature list, modify them, and add them
> to the new SeqRecord's feature list.
>

I can't steal the features because the source of the features is a reference
sequence that I will reuse for millions of reads.  I will have to make a
copy.  You believe that building a new SeqFeature would be faster/safer than
using python's copy.deepcopy() method?


> Another query, are you going to look for inversions? In such
> cases the strand needs flipping and the start/end interchanged.
> The SeqRecord reverse complement method has to do this,
> and therefore the SeqFeature and its location and position
> classes all have a private _flip method.
>

All the reads will be reverse complemented to the coding orientation before
the transfer of the features, so I don't think this will be a problem.


> [If you find these private methods useful, perhaps we can make
> them public? Let us know]
>

It's hard to tell what the general API should be or what are the most common
use-cases.  For myself, I can get by with writing my own methods to modify
the coordinates accordingly.

Uri



More information about the Biopython mailing list