[BioPython] Bio.Nexus documentation

Peter (BioPython List) biopython at maubp.freeserve.co.uk
Tue Apr 25 09:08:33 UTC 2006


> Anyway, I'll get some examples together, and I still want to do some
> documentation for the cookbook. It won't be before this weekend, though.
> For a quick and dirty anchor point, there's the test module that comes
> with the distribution, it naturally has some code that does interesting
> things with trees and data.

Its certainly shown me that the Nexus file format is a lot more 
complicated than just holding simple trees.

What I actually wanted to do was load a Newick format tree (extension 
*.dnd files from Clustalw/ClustalX in particular) into BioPython.  This 
doesn't look like is possible.

However, I can get Clustalx to save the corresponding alignment in Nexus 
format, but the parser doesn't seem to like it...

Traceback (most recent call last):
   File "C:\temp\hack_trees_000.py", line 7, in ?
     n=Nexus.Nexus(input_file)
   File "C:\Python23\lib\site-packages\Bio\Nexus\Nexus.py", line 525, in 
__init__
     self.read(input)
   File "C:\Python23\lib\site-packages\Bio\Nexus\Nexus.py", line 582, in 
read
     self._parse_nexus_block(title, contents)
   File "C:\Python23\lib\site-packages\Bio\Nexus\Nexus.py", line 623, in 
_parse_nexus_block
     getattr(self,'_'+line.command)(line.options)
AttributeError: 'Nexus' object has no attribute '_utree'

This looks like its cause by the penultimate line of the "Nexus Tree 
file" produced by ClustalX:

..
	UTREE PAUP_1= (...);
ENDBLOCK;

Any ideas?  I'll happily send you some example tree files off the list 
if you want.

Peter





More information about the Biopython mailing list