[Bioperl-l] Taxonomy hierarchy extraction

Hilmar Lapp hlapp at gmx.net
Mon Jun 18 08:38:25 EDT 2007


I'm a bit confused - it sounds like you have set up a local BioSQL  
database and loaded the NCBI taxonomy into the database. You can now  
use simple SQL to retrieve all descendants of a node in the tree  
given its NCBI taxonID such as

	SELECT tn.*, tnm.name FROM taxon tn, taxon_name tnm, node n
	WHERE
	    n.ncbi_taxon_id = :taxonID
	AND tn.left_value > n. left_value
	AND tn.right_value < n.right_value
	AND tn.taxon_id = tnm.taxon_id
	AND tn.name_class = 'scientific_name'

BioPerl doesn't have a Taxonomy::biosql module yet (though this would  
seem like a worthwhile thing to add), so you can't use the  
Bio::DB::Taxonomy interface to do this against a BioSQL instance.

However, BioPerl does have support for the flat-file download of the  
NCBI taxonomy database and indexes it, so you can simply use  
Taxonomy::{get_taxon,get_all_Descendants} using the flatfile download  
to achieve what you wanted to do in a less than 5 lines of perl.

Although the recursive implementation of Taxonomy::get_all_Descendants 
() won't be lightning fast, it may still be perfectly fine for your  
application - are you sure it is not?

	-hilmar

On Jun 18, 2007, at 12:21 AM, George Heller wrote:

> Thanks. And how can I assign the $node here in the below code, such  
> that I can reference it to a particular taxon id record? I want to  
> retrieve all the descendents from the taxonomy hierarchy, given a  
> particular taxon id.
>
>   I have a local db setup, in which I have uploaded data using the  
> load_ncbi_taxonomy.pl script.
>
>   Thanks.
>   George
>
>   Jason Stajich <jason at bioperl.org> wrote:
>     I assume you already figured out how to setup a local taxonomydb?
>
>
>   You just want the extant species/leaves of the tree
>
>
> my @extant_children = grep { $_->is_Leaf } $node->get_all_Descedents;
>
>
>
>   -jason
>     On Jun 17, 2007, at 11:41 AM, George Heller wrote:
>
>     Hi all,
>
>
>     Can anyone point me to some example that uses the  
> get_all_Descendents method from Bio::DB::Taxonomy? I am a newbie at  
> this, and I am not quite sure how to implement it.
>
>
>     Thanks.
>     George
>
>
>   Sendu Bala <bix at sendu.me.uk> wrote:
>     George Heller wrote:
>     Hi all,
>
>
>   I am looking at extracting the taxonomy hierarchy for some taxon  
> ids.
>   What I plan to do is, for a given taxon id, say 33090, I want to
>   extract all taxon ids that are children of this species. I do not
>   just want the immediate children, but the children's children and so
>   on.
>
>
>   Any ideas on the way I can go about doing this?
>
>
>   Well, you'll use Bio::DB::Taxonomy presumably, and  
> each_Descendent in
>   some kind of looping structure. Most easily a recursing sub.
>
>
>   If you happen to code up something neat and efficient, why not  
> share it
>   with us and we could add it to the Taxonomy module(s).
>
>
>
>
>
>
>   ---------------------------------
>   Shape Yahoo! in your own image.  Join our Network Research Panel  
> today!
>   _______________________________________________
>   Bioperl-l mailing list
>   Bioperl-l at lists.open-bio.org
>   http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>
>     --
>   Jason Stajich
>   jason at bioperl.org
>   http://jason.open-bio.org/
>
>
>
>
>
>
>
> ---------------------------------
> Need a vacation? Get great deals to amazing places on Yahoo! Travel.
> _______________________________________________
> 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