[Bioperl-l] Question on Tree : Last common ancestor / Internal Nodes

Jason Stajich jason at bioperl.org
Wed Jan 10 06:05:38 UTC 2007


Works for me on bioperl 1.5.x so this may be a bug in get_lca in 1.4  
version, I'm not sure.

-jason
On Jan 9, 2007, at 8:08 PM, Himanshu Ardawatia wrote:

> #!/usr/bin/perl -w
>
> use strict;
> use Bio::TreeIO;
> my $tree = Bio::TreeIO->new(-format => 'newick', -fh => \*DATA)- 
> >next_tree;
>
> my @nodes = grep { $_->id =~ /c|d|f/ } $tree->get_nodes;
> my $lca = $tree->get_lca(@nodes);
> print "lca is ",$lca->id, " for ", join(",",map { $_->id } @nodes),  
> "\n";
>
> @nodes = grep { $_->id =~ /a|z/ } $tree->get_nodes;
> $lca = $tree->get_lca(@nodes);
> print "lca is ",$lca->id, " for ", join(",",map { $_->id } @nodes),  
> "\n";
>
> __DATA__
> (a,((c,d)z,(e,f)y)x)root;

--
Jason Stajich
Miller Research Fellow
University of California, Berkeley
lab: 510.642.8441
http://pmb.berkeley.edu/~taylor/people/js.html





More information about the Bioperl-l mailing list