[Bioperl-l] getting/setting species names with Bio::Species

Dave Messina David.Messina at sbc.su.se
Fri Jan 15 15:17:14 UTC 2010


Hi everybody,

I'm having a little trouble with names in Bio::Species objects.

According to the Bio::Species documentation, if I have a species name as a string, like "Homo sapiens", I can get and set that using the species method:

my $my_species_obj = Bio::Species->new();
$my_species_obj->species('Homo sapiens');

print $my_species_obj->species;     # 'Homo sapiens'


That works fine if I create the Bio::Species object myself.

But if I try to get that string back out from a BIo::Species object created by SeqIO from a genbank file, I get just 'sapiens' back:

my $io = Bio::SeqIO->new('-format' => 'genbank',
                         '-file'   => 'hoxa2.gb');
my $seq_obj = $io->next_seq;
my $io_species_obj = $seq_obj->species;

print $io_species_obj->species;     # 'sapiens'


I think that happens because genbank records have more taxonomic info about the species name, like the genus (and in fact the whole taxonomic categorization: kingdom phylum order, etc). So the genus is stored separately.

Poking around a bit more in Bio::Species, I turned up the method 'binomial', which appears to do the right thing, returning genus and species in both cases. Except, as you can see, the space is stripped out for my species-name-is-just-a-string object:

print $my_species_obj->binomial;    # 'Homosapiens'
print $io_species_obj->binomial;    # 'Homo sapiens'


I'm not very familiar with Bio::Species (and its parent Bio::Taxon); am I using it correctly above, or is there a better way?

If not, this kinda looks like a bug to me. I've got a patch which works and passes the BioPerl test suite.


Thanks,
Dave











More information about the Bioperl-l mailing list