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

Chris Fields cjfields at illinois.edu
Thu Jul 7 16:34:26 UTC 2011


It's probably a good idea to revisit this if there are any questions.  I ran 'git blame' and the changes to the code Jason pointed out were from Sendu, so they appear to be recent (though that could also be showing up from simple reformatting of the code).

chris

On Jul 7, 2011, at 10: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