[BioPython] AlignIO: Sequences of different length

João Rodrigues anaryin at gmail.com
Thu Dec 4 17:49:53 UTC 2008


Hello all! I'm running BioPython 1.49 in my Linux machine and it's been
working rather fine until now.

I'm submitting two sequences for a pairwise alignment, using the EMBOSS
webservices. The results I get are good and the file is nicely formatted, so
there is no problem with the needle output (check here:
http://pastebin.com/m12ab3b2b ).

However, the format it comes is not handy for what I want to do next, so I
thought of using Biopython to convert the alignment format into something
more useful, such as pir or fasta. And that's when I hit a problem.

The code I'm running is here: http://pastebin.com/m509fd88f
When executed, it gives me this error:

Traceback (most recent call last):
  File "needle.py", line 50, in <module>
    alignments = AlignIO.read(open('alignment.results'), "emboss")
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 375, in read

  File
"/home/joao/Desktop/biopython-1.49/build/lib.linux-i686-2.5/Bio/AlignIO/EmbossIO.py",
line 197, in next
SyntaxError: Error parsing alignment - sequences of different length?

Which is, to say the least, weird. First, the PIL __init__.py it calls is
completely empty. Then, the second thing he mentions is the file on my
Desktop folder, which doesn't exist anymore. Third, if I use AlignIO.parse()
instead of read(), it runs ok. But as soon as I try to actually _do_
something with it, it gives me this very same error.

So, is this a bug or is it me and my nasty coding abilities :) ?

Thanks in advance!

João Rodrigues
http://doeidoei.wordpress.com
Utrecht University
Netherlands




More information about the Biopython mailing list