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

Sebastien Moretti smoretti at unil.ch
Thu Jan 7 07:24:51 GMT 2021


Hi Mag

It looks my issue came from the missing ensembl-metadata and 
ensembl-taxonomy modules in my PERL5LIB path.
It is running already for a couple of species without any issues, for 
Ensembl and Ensembl Metazoa.

Also I have to change Heterocephalus_glaber into 
Heterocephalus_glaber_female to make it work for this species.

Best
Sébastien

> Hi Sébastien,
> 
> Ports 5306 and 3306 are indeed similar and return the same results.
> Same for mus_musculus versus mus musculus, both are recognised aliases 
> for the mouse database (as are mmusculus and mouse).
> 
> I have tried various combinations of the above but am unable to 
> reproduce your issue.
> The only explanation that I can think of is that you are somehow 
> connecting to the wrong server/database.
> Could you share any more of your script where it deals with the database 
> connection, or what happens to the gene adaptor?
> 
> 
> Cheers,
> mag
> 
> On 05/01/2021 12:57, Sebastien Moretti wrote:
>> Hi Mag
>>
>> ports 5306 and 3306 should be similar according to 
>> http://www.ensembl.org/info/data/mysql.html
>>
>> Any differences if 'mus_musculus' is used instead of 'mus musculus'?
>>
>> Best
>> Sébastien
>>
>>> 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/
> 
> 
> _______________________________________________
> 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/

--
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/




More information about the Dev mailing list