[BioPython] Alignment add_sequence

Peter Cock p.j.a.cock at googlemail.com
Wed Feb 6 16:20:20 UTC 2008


On Feb 6, 2008 4:06 PM, Jose Blanca <jblanca at btc.upv.es> wrote:
> Hello,
> I'm building an alignment object from a set of seqRecords using the following
> code:
> ...
> Is this the best way to do it?

No, not really.  See below ..

> Everything is working as expected, but I have a
> problem with this implementation. My seqRecords have additional annotations
> and I'm loosing them.

Yes, using that method the alignment is creating a new SeqRecord for
each sequence with no annotation.

> Maybe this could be solved with a new function like:
>     def add_sequence(self,  seqRecord, start = None, end = None,
>                      weight = 1.0):

This has been discussed before, along with other limitations of the
current alignment class, e.g. on bug 1944
http://bugzilla.open-bio.org/show_bug.cgi?id=1944

Right now I would suggest you try the Bio.SeqIO.to_alignment()
function, although this doesn't try and do anything clever with
start/end annotation: http://biopython.org/wiki/SeqIO

Peter



More information about the Biopython mailing list