Jason Stajich | 11 Sep 19:01 2013
Picon

Re: Bio::Taxon get descendents

Not sure yet -- I think the each_Descendents just needs to be able to delegate to the DB handle (or be
overriddent) when the Bio::Taxon objects are created by a Bio::DB::Taxonomy::flatfile (or maybe
Bio::DB::Taxonomy in general). But currently it relies on the superclass implementation
Bio::Tree::Node/NodeI implementation that each_Descendent is the one to call so isn't implemented in
Bio::Taxon - maybe we need to add some logic in there that determines whether it is an in-memory Bio::Taxon
object or it is created by a DB object.

Jason

On Sep 11, 2013, at 5:41 AM, "Fields, Christopher J" <cjfields <at> illinois.edu> wrote:

> 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(" ",  <at> {$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(" ",  <at> {$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

Jason Stajich
jason.stajich <at> gmail.com
jason <at> bioperl.org

Gmane