[Biopython-dev] Nexus parser and Newick tree format

Frank Kauff fkauff at duke.edu
Wed Feb 16 09:57:48 EST 2005


On Wed, 2005-02-16 at 10:54 +0000, Peter wrote:
> Iddo Friedberg wrote:
> > Hi all,
> > 
> > Good News: Frank Kauff & Cymon Cox has contributed a Nexus parser to 
> > Biopython, for our next release. It's a mighty useful and nifty package 
> > if you are into trees (the phylogenetic ones, not the ones in the 
> > forest). He put a lot of effort into this to get this ready for 
> > Biopython 1.40
> 
> This sounds really good.
> 
> I have been dealing with Newick trees (e.g. the .dnd files produced by 
> Clustal) using the Python Newick module by Thomas Mailund 
> (Bioinformatics Research Center, University of Aarhus):
> 
> http://www.daimi.au.dk/~mailund/newick.html
> 
> A bit of googling tells me that the NEXUS format incorporates the Newick 
> treefile data plus additional text.
> 
> http://workshop.molecularevolution.org/resources/fileformats/tree_formats.php
> 
> Can/will the new Bio.Nexus module cope with "plain" Newick files as well 
> as the more complicated Nexus format?
> 

Yes, it works fine with both plain trees, and trees that have branch
length and/or support added. As the parser initially doesn't know if a
value is meant to be a branch length or support (e.g. from a bootstrap),
single values are assumed to be branchlengths, but there is a method
branchlength2support that puts it into the right place.

It reads trees from mrbayes and paup, and can output them in plain
newick or including branchlength and support, if present.

One drawback: if trees are rerooted, branchlengths and support get
screwed up - the root_with_outgroup method just doesn't care about them.
I might add derooted trees in the future that can handle rerooting while
keeping branchlengths more easily, or just extend the above method. 
   
Frank

> Peter
> 
> P.S. A trivial "bug", you have used "hsitorical" in class Tree, file 
> Trees.py
> 
-- 
Frank Kauff
Dept. of Biology
Duke University
Box 90338
Durham, NC 27708
USA

Phone 919-660-7382
Fax 919-660-7293
Web http://www.lutzonilab.net/member/frankkauff.shtml







More information about the Biopython-dev mailing list