[BioPython] AlignIO: Sequences of different length
Peter
biopython at maubp.freeserve.co.uk
Thu Dec 4 17:56:27 UTC 2008
On Thu, Dec 4, 2008 at 5:49 PM, João Rodrigues <anaryin at gmail.com> wrote:
> 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.
The bit about PIL in the stack trace is odd.
> So, is this a bug or is it me and my nasty coding abilities :) ?
>
> Thanks in advance!
>
> João Rodrigues
I don't know if its good news or bad news, but its a bug in the
Biopython "emboss" parser not your code. I get the same error message
here on my machine using your sample output. I'll take a look at the
code get back to you shortly...
Can we include your sample output as a unit test in Biopython please?
Thanks
Peter
More information about the Biopython
mailing list