[Bioperl-l] Bio::Taxon get descendents
Jason Stajich
jason.stajich at gmail.com
Wed Sep 11 00:53:28 UTC 2013
A gotcha, not sure how I think we should fix this yet.
I discovered bug that the Bio::Taxon delegates to Bio::Tree for its each_Descendent calls but in the case of taxonomy these aren't loaded in to the tree - they require a DB object to request the children of a node from - so it doesn't work just querying the in-memory tree structure.
The following works because it queries the taxonomy db object for the children of a node (Bio::DB::Taxonomy::flatfile in this case is $taxdb; $taxon is a Bio::Taxon object )
for my $downstream ( $taxdb->each_Descendent($taxon) ) {
print "downstream is $downstream\n";
print "below ", join(" ", @{$downstream->name('scientific')}), "\n";
}
This won't because it is using the Bio::Taxon implementation of get_all_Descendents which relies on Bio::Tree::Node functions.
for my $child ( $taxon->get_all_Descendents() ) {
warn("child is $child\n");
print $child->rank, " ", join(" ", @{$child->name('scientific')}), "\n";
}
Also note that all DB implementations don't support the each_Descedent (e.g. NCBI Taxonomy via eutils or web query).
--
Jason Stajich
More information about the Bioperl-l
mailing list