[Biopython] Transferring SeqFeatures between aligned sequences

Uri Laserson laserson at mit.edu
Thu Mar 10 22:07:46 UTC 2011


Say I have a SeqRecord called A and a SeqRecord called B.  A has a bunch of
SeqFeatures associated with it, while B has none.  I perform a gapped
alignment between the two sequences.  Now I want to copy the SeqFeatures
from A onto B in a way that respects the coordinates of all the features.

For example (and please use a fixed-width font for this):

         0                       1
         0 1 2 3 4   5   6 7 8 9 0 1 2 3 4 5 6 7 8 9
             FEATURE_1               FEATURE_2
          X X X X X X X X X       X X X X X X X X X
A   - - - a c g g t - - a c a g a c g t g a t a c g
          | | | | |     | | |   | | |   | | | | | |
B   a a a a c g g t g g a c a t a c g - g a t a c g

   0                   1                     2
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6  7  8 9 0 1 2 3


In sequence A, the coords of Feature 1 and Feature 2 should be (0,7) and
(10,19), respectively.  Now I want to copy it to sequence B, where the
feature coords should instead be (3,12) and (15,23).

Is there an easy way to do this in biopython already?  Or are there any
ideas for an elegant solution?

Thanks!

Uri


...................................................................................
Uri Laserson
Graduate Student, Biomedical Engineering
Harvard-MIT Division of Health Sciences and Technology
M +1 917 742 8019
laserson at mit.edu



More information about the Biopython mailing list