Nicpetbio23! has asked for the wisdom of the Perl Monks concerning the following question:
#Read in Tree use Bio::TreeIO; my $treeio = Bio::TreeIO->new(-format => 'newick',-file => $filename); my $tree = $treeio->next_tree; #You can find the species of interest ‘x' foreach my $id(@lines){ my $node = $tree->find_node(-id => $id); #Find internal node that is its immediate ancestor my $ancestral_node = $node->ancestor(); #Find all descendants from ancestor (which will include ‘x’) for my $child ( $ancestral_node->get_all_Descendents ) { print $child->id, "\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Return second element
by choroba (Cardinal) on Jul 09, 2017 at 21:09 UTC | |
Re: Return second element
by hippo (Archbishop) on Jul 09, 2017 at 21:09 UTC |