[Biopython-dev] [Bug 2531] Nexus and fasta parsers have a problem with identical taxa names

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Jun 30 14:52:08 UTC 2008


------- Comment #4 from biopython-bugzilla at maubp.freeserve.co.uk  2008-06-30 10:52 EST -------
Thanks for the example file - I can now reproduce a problem, which is progress.

There is a rather cryptic error message from Bio.SeqIO, due to the fact that
when Bio.Nexus parses the file it doesn't create a matrix.

You can see this by using Bio.Nexus directly:

>>> filename = ...
>>> handle = open(filename)
>>> from Bio.Nexus import Nexus
>>> n = Nexus.Nexus(handle)
>>> n.matrix.keys()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'keys'
>>> n.matrix is None

This explains why trying to use Bio.SeqIO gives the following exception:
TypeError: argument of type 'NoneType' is not iterable

So, from my point of view this is good news (joke) as its not really a problem
in Bio.SeqIO - although I will fix Bio.SeqIO so it fails gracefully.

This seems to be a problem in Bio.Nexus, so its a job for Frank...

I've got a couple more questions for you:

(1) Where did this file come from?  I'm not an expert on the details of the
Nexus file format, but I am wondering which program wrote this file, as perhaps
it is invalid in some way?

(2) Could we add it to Biopython as an example for our unit tests?  It might be
a bit big as it is, but we could cut it down a little by hand first.

P.S. I have retitled the bug from "Nexus and fasta parsers have a problem with
identical taxa names" to "Bio.Nexus has a problem with identical taxa names".

You don't seem to be parsing in any FASTA files, just trying to write one.

Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the Biopython-dev mailing list