[Bioperl-l] Bio::DB::Taxonomy root not present
    Bernd Web 
    bernd.web at gmail.com
       
    Thu Jul  7 15:03:25 UTC 2011
    
    
  
Hi,
I noticed Bio::DB::Taxonomy does not contain the root of the tree,
while the NCBI node file does.
For example, the lineage "root; cellular organisms; Bacteria" stops at
"cellular organisms", which means there is no parent node of
"cellular organisms". (see code below).  Also
$taxdb->get_Taxonomy_Node(1) would not return the Bio::Taxon object
for root  (using BioPerl 1.6.9).
Was there a reason not to include the node "root" in the index files
for Bio::DB::Taxonomy?
Kind regards,
Bernd
use strict;
use File::Spec;
use Bio::DB::Taxonomy;
my $prefix = '/scratch/taxonomy/';
my $taxdb = Bio::DB::Taxonomy->new
    (-source => 'flatfile',
     -directory => File::Spec->catfile($prefix,'idx'),
     -nodesfile => File::Spec->catfile($prefix,'nodes.dmp'),
     -namesfile => File::Spec->catfile($prefix,'names.dmp')
     );
my $taxid = '2';
my $node = $taxdb->get_Taxonomy_Node($taxid);
$node = $taxdb->ancestor($node);
print $node->node_name, "\n"; #prints: cellular organisms
$node = $taxdb->ancestor($node);
print $node->node_name, "\n"; #error :Can't call method "node_name" on
an undefined value at taxdb.pl line...
    
    
More information about the Bioperl-l
mailing list