[Bioperl-l] Bio::Species / Bio::Taxonomy::Node

Jason Stajich jason at cgt.duhs.duke.edu
Fri Jan 30 17:07:47 EST 2004


I think I've finally committed code which will allow Bio::Taxonomy::Node
to act like Bio::Species while supporting the notion of being a node in a
taxonomy hierarchy.  Added tests in t/Species.t to this effect.

For Bio::DB::Taxonomy::flatfile I've added indexing by parent Id so it is
quite fast to grab all the children for a given node.  So you can walk up
and down the classification system now.  Practically speaking
this means to get all the taxon ids of species in the same genus with a
few simple lines like below.

Unfortunately the the NCBI taxonomy API as part of E-Utils doesn't quite
provide the information we need so the whole API can't be used without
downloading the taxonomy db locally.

nodefile and namesfile are the files from ncbi taxdump see
Bio::DB::Taxonomy::flatfile for more info.

#!/usr/bin/perl
use strict;
use warnings;

use Bio::DB::Taxonomy;
my $db = Bio::DB::Taxonomy->new
    (-source => 'flatfile',
     -nodesfile=> '/home/jason/taxonomy/nodes.dmp',
     -namesfile=> '/home/jason/taxonomy/names.dmp');

my $node = $db->get_Taxonomy_Node(-name => 'Caenorhabditis elegans');

my $parent = $node->get_Parent_Node();
for my $n ( $parent->get_Children_Nodes() ) {
    print $n->binomial, "\t", $n->ncbi_taxid,"\n";
}

Someday I'll get around to making a HowTO unless someone else wants to do
it... =)

-jason
--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list