[Bioperl-l] Taxonomy hierarchy extraction
Hilmar Lapp
hlapp at gmx.net
Tue Jun 19 12:47:02 UTC 2007
So the real mistake was to write
my $node = $db->get_Taxonomy_Node(-taxonid => '33090');
my @extant_children = grep { $_->is_Leaf } $node->get_all_Descendents;
instead of
my $node = $db->get_Taxonomy_Node(-taxonid => '33090');
my @extant_children = grep { $_->is_Leaf } $db->get_all_Descendents
($node);
I.e., the Bio::DB::Taxonomy object *will* (or is allowed to) ask the
database?
If this is correct, can we highlight this in the documentation? It's
a small difference that everyone failed to spot.
If it is not correct, then maybe we need to revisit the rationale for
why a Bio::DB::Taxonomy::get_all_Descendents may not query the
underlying database.
Also, in my reading of Bio::Taxonomy::Taxon it won't use the database
either for ancestor(). Which would be consistent with its other methods.
I.e., the bottom line is don't use Node or Taxon objects for
hierarchy queries that you expect to use an underlying database, use
the Bio::DB::Taxonomy object instead. It makes sense, but is it true?
-hilmar
On Jun 19, 2007, at 3:01 AM, Sendu Bala wrote:
> Jason Stajich wrote:
>> The reason it isn't printing anything is someone didn't really write
>> the implementation quite right. This code was overhauled by Sendu
>> before the last release I guess something didn't quite get connected.
>>
>> I checked in code that has the Bio::Taxon delegating now to a DB
>> handle for the each_Descendent call.
>> You can either patch your code or just use the code listed here:
>> http://bioperl.org/wiki/Module:Bio::DB::Taxonomy
>
> I've reverted that change.
>
> For some reason the docs for Bio::Taxon::each_Descendent aren't
> showing
> up on the website, but they state:
>
> ---
> Note that this method never asks the database for the descendents; it
> will only return objects you have manually set with add_Descendent
> (), or
> where this was done for you by making a Bio::Tree::Tree with this
> object
> as an argument to new().
>
> To get the database descendents use
> $taxon->db_handle->each_Descendent($taxon).
> ---
>
>
> I also have a note in the Synopsis for the module:
>
> ---
> # Though be careful with each_Descendent - unless you add_Descendent()
> # yourself, you won't get an answer because unlike for ancestor(),
> # Bio::Taxon does not ask the database for the answer. You can ask the
> # database yourself using the same method:
> ($human) = $homo->db_handle->each_Descendent($homo);
> ---
>
>
> This is quite deliberate and is to prevent Bad Things from happening.
> (Can't exactly remember the reasoning now, but I know it was good.)
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
--
===========================================================
: Hilmar Lapp -:- Durham, NC -:- hlapp at gmx dot net :
===========================================================
More information about the Bioperl-l
mailing list