Module:Bio::DB::Taxonomy

From BioPerl
Jump to: navigation, search
Bio::DB::Taxonomy
PDoc Bio::DB::Taxonomy
CPAN Bio::DB::Taxonomy
metaCPAN Bio::DB::Taxonomy


Example usage

Here is some example usage that shows how to gather children from a node

#!/usr/bin/perl -w
use strict;
use Bio::DB::Taxonomy;
 
my $idx_dir = '/tmp';
 
my ($nodefile,$namesfile) = ('nodes.dmp','names.dmp');
my $db = new Bio::DB::Taxonomy(-source    => 'flatfile',
                               -nodesfile => $nodefile,
                               -namesfile => $namesfile,
                               -directory => $idx_dir);
my $node = $db->get_Taxonomy_Node(-taxonid => '33090');
print $node->id, " ", $node->scientific_name, " ", $node->rank, "\n";
# to only get children that are of a particular rank in the taxonomy test if their rank is 'species' for example
my @extant_children = grep { $_->rank eq 'species' } $db->get_all_Descendents($node);
 
for my $child ( @extant_children ) {
    print "id is ", $child->id, "\n"; # NCBI taxa id
    print "rank is ", $child->rank, "\n"; # e.g. species
    print "scientific name is ", $child->scientific_name, "\n"; # scientific name
}
Personal tools
Namespaces
Variants
Actions
Main Links
documentation
community
development
Toolbox