[ensembl-dev] Failed to get Ensembl genes with the API

Sebastien Moretti smoretti at unil.ch
Fri Dec 18 09:34:30 GMT 2020


Hi Mag

> Hi Sébastien,
> 
> Thank you for bringing this to our attention.
> If you are only wanting to access data for mouse, the 'api' alias for 
> git ensembl will provide all the necessary repositories.
> You are right however that ensembl-metadata and ensembl-taxonomy should 
> be made more easily accessible through our Git tools and we will update 
> this in the coming release.

Thanks

> Regarding your issues retrieving mouse genes, could you provide more 
> details on your script?
> 
> The following printed out 56,305.
> 
>     my $registry = "Bio::EnsEMBL::Registry";
> 
>     $registry->load_registry_from_db(
>        -db_version => 102,
>        -host => 'ensembldb.ensembl.org',
>        -user => 'anonymous',
>        -port => 3306
>     );
> 
>     my $gene_adaptor = $registry->get_adaptor( 'mus musculus', 'Core',
>     'Gene' );
> 
>     my $genes = $gene_adaptor->fetch_all();
>     print "Found " . scalar(@$genes) . "\n";

Our script is similar with API version 102:
my $reg = 'Bio::EnsEMBL::Registry';
$reg->load_registry_from_db( -user    => 'anonymous',
                              -pass    => '',
                              -host    => 'ensembldb.ensembl.org',
                              -port    => 5306,
                              -verbose => 1, # Verbose output
                             );
my $gene_adaptor = $reg->get_adaptor( 'mus_musculus', 'Core', 'Gene' );
my @genes = @{ $gene_adaptor->fetch_all() };


The main differences are "mus_musculus" instead of "mus musculus"
and port 5306 instead of 3306.


Cheers
Sébastien

> Cheers,
> mag
> 
> On 15/12/2020 16:44, Sebastien Moretti wrote:
>> Hi
>>
>> Previously I got all Ensembl gene for a species with the API this way:
>> $gene_adaptor = $reg->get_adaptor( 'mus musculus', 'Core', 'Gene' );
>>
>>
>> But it does not look to be so simple with more recent Ensembl API 
>> versions.
>> First I use the "Git Ensembl tools" but ensembl-metadata and 
>> ensembl-taxonomy modules did not come with it for [api].
>> According to what is written at 
>> http://www.ensembl.org/info/docs/api/api_installation.html I expected 
>> them to come with.
>>
>> http://www.ensembl.org/info/docs/api/api_git.html mentions 
>> ensembl-metadata.git but it is not there unless you do
>>     git ensembl --clone available
>> instead of
>>     git ensembl --clone api
>>
>>
>>
>> Second what is the right way nowadays to get adaptor for all genes?
>> $gene_adaptor = $reg->get_adaptor( 'mus musculus', 'Core', 'Gene' );
>> looks to work but returns only a subset of genes (between 20 and 70).
>>
>> Thanks for your help
>>
>> -- 
>> Sébastien Moretti
>> Staff Scientist
>> Department of Ecology and Evolution,
>> Biophore, University of Lausanne,
>> CH-1015 Lausanne, Switzerland
>> Tel.: +41 (21) 692 4221/4079
>> http://bioinfo.unil.ch/ http://bgee.org/ http://selectome.unil.ch/
>>
>> _______________________________________________
>> Dev mailing list Dev at ensembl.org
>> Posting guidelines and subscribe/unsubscribe info: 
>> https://lists.ensembl.org/mailman/listinfo/dev_ensembl.org
>> Ensembl Blog: http://www.ensembl.info/



More information about the Dev mailing list