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

Andy Yates ayates at ebi.ac.uk
Tue Jan 31 16:17:01 GMT 2012


Hi Giuseppe,

Population of aliases into the registry relies on the population of species.alias entries in the core database's meta table. If a name is in that field (e.g. if there is a genome with the alias Plasmodium falciparum) then it will return a true value. This is similar to querying the registry with 'human' which returns a Homo sapiens adaptor. The only way you can use a taxonomy identifier in the alias/registry methods was if it was specified in the meta table under the aforementioned tag.

However if my memory serves me correctly what you're attempting to do here is to traverse back up the taxonomy to get to the first gene adaptor you can find. In which case you need to find the GenomeDBs linked to those taxons & then ask for the core DBAdaptor. I think code similar to the following should work:

my $taxon_id = 5833;
my $gdb = eval {$genomeb_adaptor->fetch_by_taxon_id($taxon_id)};
if(! $@) {
  my $core_dba = $gdb->db_adaptor()
  my $gene_adaptor = $core_dba->get_GeneAdaptor();
}

The eval block is a nasty hack so the only other way I can think of doing the GenomeDB lookup by taxon id e.g.

my %gdb_hash = map { $_->taxon_id => $_ } @{$genomedb_adaptor->fetch_all()};
my $gdb = $gdb_hash{$taxon_id};
if(! defined $gdb) {
  my $gene_adaptor = $gdb->db_adaptor()->get_GeneAdaptor();
}

Hope this helps

Andy

Andrew Yates                   Ensembl Core Software Project Leader
EMBL-EBI                       Tel: +44-(0)1223-492538
Wellcome Trust Genome Campus   Fax: +44-(0)1223-494468
Cambridge CB10 1SD, UK         http://www.ensembl.org/

On 31 Jan 2012, at 15:54, Giuseppe G wrote:

> Hi again Uma,
> 
> I'm experiencing some more problems when using the API v.65 and ensemblgenomes species. I create a registry as above (ie multiple call) and use database "pan_homology". The following call
> 
> $registry->alias_exists('Plasmodium falciparum')
> 
> returns 1  - when it should return 0 - because this taxon name and its ID are not amongst the 605 pan_homologies species. So, trusting the alias_exists() output, I was  trying to get a genome adaptor as follows
> 
> my $gdb = $genomedb_adaptor->fetch_by_taxon_id('5833');
> 
> which fails with an exception.
> 
> Are there known problems when using alias_exists() with ensemblgenomes taxa?
> 
> Thanks in advance
> 
> Best
> G
> 
> -- 
> 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