[Bioperl-l] Find distances between LCA's and the other nodes from a tree

Thomas Sharpton thomas.sharpton at gmail.com
Mon Oct 3 14:35:33 UTC 2011

On Mon, Oct 3, 2011 at 4:28 AM, Dave Messina <David.Messina at sbc.su.se>wrote:

In my hands, there is a Node object returned as $lca. However, it doesn't
> have an id so the next line where you try to print $lca->id, I get an
> undefined value error.
> When I look at $lca, it doesn't seems to be equivalent to node C, which,
> based on the tree you supplied, I would expect to be the LCA. SO there may
> in fact be something wrong in the BioPerl code here, too.
> However, I'm not that familiar with these modules, and I know there's been
> some recent work done on them, so perhaps someone else can chime in here.

Dave is (as usual) right: $lca is a Node object. He's also right that the
node $lca doesn't have an id. But I don't think this is a problem with
BioPerl, but rather with how the newick tree in question is formatted.
Specifically, the tree that Ross provided only has ids at the leaf nodes,
which is why $lca->id() is returning an error (the internal node ids are
thus undefined).

Ross, you'll need to adopt the following format for your trees if you want
to call internal node ids, at least as I understand how these BioPerl
modules work. Instead of:


Structure your newick trees like this:

(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;  **

The above trees are identical, with the exception that the internal nodes E
and F have identifiers (names) associated with them.

Does that make sense? You might check the wikipedia page for more
information (http://en.wikipedia.org/wiki/Newick_format) and you can quickly
view both of the above trees through the web-based tool PhyloWidget (
http://www.phylowidget.org) to get a better understanding of what I'm
talking above.


More information about the Bioperl-l mailing list