[Bioperl-l] "richer" tree nodes
Aaron J Mackey
Aaron J. Mackey" <amackey@virginia.edu
Mon, 15 Jul 2002 21:12:29 -0400 (EDT)
On Mon, 15 Jul 2002, Jason Stajich wrote:
> On Mon, 15 Jul 2002, Aaron J Mackey wrote:
>
> > my @nodes = map { $tree->find_node($_) } ('Escherichia coli', 'Salmonella
> > paratyphi A', 'Klebsiella pneumoniae');
> > if($tree->monophyletic(-root => $bact, -test => \@nodes)) {
> > # all @nodes are under this root.
> > }
> >
> > Otherwise, if you don't specify a root, you could go this route:
> >
> > $newroot = $tree->lca(@nodes);
> > if($newroot->descendentOf($bact)) {
> > # all @nodes are under this root.
> > } elsif ( $newroot == $tree->get_root_node ) {
> > # any two nodes in the same tree are monophyletic with respect to the
> > # root node!
> > }
>
> All fun - yah evolutionary discussions on bioperl.
Of course, yet another defintion of monophyletic is "strict"
monophylogeny: all nodes are in the same subtree, and no other nodes are
in that subtree; I expect that this is the usual working definition. So
now, my original example
unless($tree->monophyletic(@nodes)) {
# tree with non-bacterial sequences mixed up with bacterial seqs
}
now works, without respect to any root (or, with respect to the shared
$lca = lca(@nodes), a $lca->get_nodes() returns a list equal in size and
composition to @nodes).
So I guess I've implemented (in words) monophyletic a few different ways
now. Here is a more thorough listing of at least my desired functions;
$tree->find_node("text"); # id, desc, whatever ??
$pnode->is_ancestral($cnode); # is $pnode a parent of $cnode?
$cnode->is_decendent($pnode); # vice versa
$tree->lca(@nodes); # last-common-ancestor
$subtree = $pnode->tree(); # maybe subtree() ? does tree() provide a
# back-ref to parental $tree obj?
I know Korbian Strimmer has a pretty thorough Java-based Tree topology
package (can't remember the name or details right now ...) - we could
perhaps get some more ideas from there.
-Aaron
--
Aaron J Mackey
Pearson Laboratory
University of Virginia
(434) 924-2821
amackey@virginia.edu