[Bioperl-l] root node branch length in newick trees writtenincorrectly

Mark A. Jensen maj at fortinbras.us
Thu Apr 1 09:51:18 EDT 2010

Hi Dave,
The spot in the code you're dealing with looks a little kludgy-- the branch 
length must fall through to $id when the node in the data file has branch length 
but no explicit id (like a root node), is that right? Maybe it's more robust to 
to do a check whether a 'putative id' is actually a float, and shunt it into a 
branch length variable in that case. (course, maybe ids like "103748923.192934", 
which would make that bork)... hmm
----- Original Message ----- 
From: "Dave Messina" <David.Messina at sbc.su.se>
To: "BioPerl List" <bioperl-l at lists.open-bio.org>
Sent: Thursday, April 01, 2010 8:41 AM
Subject: [Bioperl-l] root node branch length in newick trees writtenincorrectly

Hi everyone,

It seems that TreeIO::newick might not be properly writing root nodes which have 
a branch length — it omits the colon.


If you read in


It will be written out as


And in the latter case, 0.0 now looks like a node id, causing strict 
interpreters of newick (like PAML) to complain.

Crazy for the root to have a branch length, you say? Apparently it's a matter of 
taste — RAxML and TreeAlign do it, and according to the newick spec it's legit.*

I just filed a bug report (http://bugzilla.open-bio.org/show_bug.cgi?id=3039) 
with a patch and a test.

But I'm not sure I understand the code that well,though; could another dev or 
two take a look before I commit?


* See the example at the bottom of 

Bioperl-l mailing list
Bioperl-l at lists.open-bio.org

More information about the Bioperl-l mailing list