[Biojava-l] The root node is missing when parsing nexus tree files from MrBayes

Martin Jones martin.jones at ed.ac.uk
Tue Jan 25 17:35:29 UTC 2011


Hi,

I am using some of the code from here:

http://tiago.org/cc/2009/11/17/reading-newicknexus-phylogenetic-trees-with-biojava/

to parse nexus phylogenetic tree data. My nexus file is output from MrBayes:

------------------ snip-----------------
#NEXUS

[ID: 7166567671]
begin trees;
   [Note: This tree contains information on the topology,
          branch lengths (if present), and the probability
          of the partition indicated by the branch.]
   tree con_50_majrule =
(27563:0.194008,(6843:0.233188,6960:0.229043)0.98:0.117649,(61985:0.217735,6657:0.275071)0.89:0.089314);

   [Note: This tree contains information only on the topology
          and branch lengths (mean of the posterior probability density).]
   tree con_50_majrule =
(27563:0.194008,(6843:0.233188,6960:0.229043):0.117649,(61985:0.217735,6657:0.275071):0.089314);
end;

-------------------------- snip -------------

the file parses without any error, but when I get a list of vertices,
the first one (27563) is missing:

def tree = getTree(nexus, 'con 50 majrule')
tree.vertexSet().each{
  println it
}

output:

6843
p1
6960
61985
p3
6657
p2

______________snip ___________

The above code is Groovy, but hopefully is self-explanatory. Is the
first node being treated specially because it is the root? If so, can
I get it using some other method?

Thanks,

Martin



More information about the Biojava-l mailing list