[ensembl-dev] Release 65 - 'not a valid species name' exception thrown by get_adaptor()

Andy Yates ayates at ebi.ac.uk
Fri Jan 20 15:52:10 GMT 2012


Hi Giuseppe,

I'm sorry that you are encountering this issue. The reason why this change was put into place was to avoid/inform users when they fail to connect to Ensembl with the correct database version. This is why the warning mentions that you should check the DB & API versions. Considering the amount of messages we get about this each release I am reluctant to revert this behaviour.

If you want to check if a species is known you can do the following:

my $species = 'ScerS288c';
my $type = 'core';
my $alias_exists = Bio::EnsEMBL::Registry->alias_exists($species);
if($alias_exists) {
  my $a = Bio::EnsEMBL::Registry->get_adaptor($species, $type, 'Gene');
}

Which would tell you if the species existed and then get the gene adaptor if it is available. You could also use:

my $dba = Bio::EnsEMBL::Registry->get_DBAdaptor($species, $type, 1);
if($dba) {
  my $a = $dba->get_GeneAdaptor();
}

Both are valid & would not require you to do too much recoding.

Hope this has helped you out

Andy

On 20 Jan 2012, at 12:34, Giuseppe G. wrote:

> Hi again
> 
> I'm on release 65, Bioperl 1.6.1.
> 
> A line like the following
> 
> my $gene_adaptor = $registry->get_adaptor('ScerS288c', 'core', 'Gene');
> 
> will return the exception
> 
> -------------------- WARNING ----------------------
> MSG: ScerS288c is not a valid species name (check DB and API version)
> FILE: Bio/EnsEMBL/Registry.pm LINE: 1159
> CALLED BY: Bio/EnsEMBL/Registry.pm  LINE: 953
> Ensembl API version = 65
> ---------------------------------------------------
> 
> -------------------- EXCEPTION --------------------
> MSG: Can not find internal name for species 'ScerS288c'
> STACK Bio::EnsEMBL::Registry::get_adaptor /home/giuseppe/src/ensembl/modules/Bio/EnsEMBL/Registry.pm:955
> STACK <MYCODE>
> Ensembl API version = 65
> ---------------------------------------------------
> 
> instead of returning an undef.
> 
> This happens whenever the query species is not contained in the genomeDB. So every time I try to get an adaptor with an unrecognised species (may be a typo, a strain name like Saccharomyces cerevisiae S288c, etc) I'll get this exception.
> 
> The behaviour, up to v64, was different. I got  an undefined $gene_adaptor and I could then go back to the taxon object and climb up the taxonomy to get the parent taxon (in the example case, 'Saccharomyces cerevisiae') and try once more to get a gene adaptor with the parent taxon binomial name.
> 
> I *could* get round this exception by downloading all of the available binomal species names from a genome adaptor - comparing my species name against them, then trying to get the gene adaptor only if my species is in the genome adaptor array - however this is far from optimal (as I need to deal with EnsemblGenomes species names as well).
> 
> Would it be possible to restore the former behaviour? Thanks a lot!
> 
> Giuseppe
> 
> -- 
> 
> The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
> 
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> List admin (including subscribe/unsubscribe): http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/





More information about the Dev mailing list