[Bioperl-l] Bio::Taxon get descendents
Fields, Christopher J
cjfields at illinois.edu
Wed Sep 11 12:41:39 UTC 2013
On Sep 10, 2013, at 7:53 PM, Jason Stajich <jason.stajich at gmail.com> wrote:
> 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
This seems like an API problem/inconsistency. Do the changes that Greg Jordan introduced in the tree_api_refresh branch deal with this in any way?
chris
More information about the Bioperl-l
mailing list