[Bioperl-l] Bio::DB::Taxonomy root not present

Jason Stajich jason.stajich at gmail.com
Thu Jul 7 16:22:21 UTC 2011


This is the code in the flatfile _build_index method that prevents it from being done - I don't remember the logic behind it but there was a reason for this code being put in.


  while (<NAMES>) {
            chomp;	    
            my ($taxid, $name, $unique_name, $class) = split(/\t\|\t/,$_);
			# don't include the fake root node 'root' or 'all' with id 1
			next if $taxid == 1;

On Jul 7, 2011, at 8:16 AM, Brian Osborne wrote:

> Bernd,
> 
> Yes, good question. Currently if you want to traverse up the tree from any given node you have to be aware that the tree may end at "cellular organisms" or "other sequences" or "unclassified sequences" or "Viruses" or "Viroids" but not at "root", this can make for awkward programming.
> 
> Brian O.
> 
> On Jul 7, 2011, at 11:03 AM, Bernd Web wrote:
> 
>> 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...
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l





More information about the Bioperl-l mailing list