[Bioperl-l] Taxonomy and entrez

Sendu Bala bix at sendu.me.uk
Mon Sep 4 11:22:12 UTC 2006

Nathan Haigh wrote:
> I'm trying write a script that parses a BLAST report and retrieves the
> taxanomic information from entrez and prints the binomial name for each hit.
> I'm new to these objects so I started with the classify_hits_kingdom
> script from the script directory in CVS. However, I have problems with
> things that are subspecies etc
> I have a script that uses the following objects:
> my $taxdb = Bio::DB::Taxonomy->new(-source => 'entrez');
> my $node = $taxdb->get_Taxonomy_Node($taxid);
> print $node->binomial;
> However, I get warnings such as:
> -------------------- WARNING ---------------------
> MSG: can't create a species object for Brassica rapa subsp. pekinensis
> (bai cai) because it isn't a species but is a 'subspecies' instead
> ---------------------------------------------------
> I've had a look around and it appears that there has been an overhaul of
> species, taxonomy etc since 1.5.1. I was wondering if someone could
> point me in the right direction for doing this with bioperl-live?

First install the very latest bioperl-live from cvs:
(or do a cvs checkout, tarball above may not be up-to-date enough, I 
only just committed some fixes here)

my $taxdb = Bio::DB::Taxonomy->new(-source => 'entrez');
my $taxon - $taxdb->get_taxon(51351);
# $taxon isa Bio::Taxon, which has no 'binomial' method
print $taxon->scientific_name;
# prints 'Brassica rapa subsp. pekinensis'

# If you really really want a Bio::Species object (no need):
my $species = new Bio::Species(-id => 51351);
print $species->binomial;
# prints 'Brassica rapa subsp.'
print $species->binomial('FULL');
# prints 'Brassica rapa subsp. pekinensis'
print $species->genus;
# prints 'Brassica'
print $species->species;
# prints 'rapa subsp.'
print $species->sub_species;
# prints 'pekinensis'

More information about the Bioperl-l mailing list