biothings / mygene.info

MyGene.info: A BioThings API for gene annotations
http://mygene.info
Other
113 stars 20 forks source link

mygeneinfo finds a gene using `query` but not using `querymany` #70

Closed jonathanronen closed 3 years ago

jonathanronen commented 4 years ago
Python 3.6.7 | packaged by conda-forge | (default, Jul  2 2019, 02:18:42) 

Type 'copyright', 'credits' or 'license' for more information

IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

​

import mygene

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

mg = mygene.MyGeneInfo()

mg.querymany(['ENSG00000034510'])

querying 1-1...done.
Finished.
1 input query terms found no hit:
    ['ENSG00000034510']
Pass "returnall=True" to return complete lists of duplicate or missing query terms.

[{'query': 'ENSG00000034510', 'notfound': True}]

mg.query('ENSG00000034510')

{'max_score': 7.9961896,
 'took': 6,
 'total': 1,
 'hits': [{'_id': '9168',
   '_score': 7.9961896,
   'entrezgene': '9168',
   'name': 'thymosin beta 10',
   'symbol': 'TMSB10',
   'taxid': 9606}]}

mygene.__version__

'3.1.0'
kevinxin90 commented 4 years ago

Seems like a bug in our python client.

For the moment, if you have a list of Ensembl gene IDs which you would like to use the "querymany" service:

Try: mg.querymany(['ENSG00000034510'], scopes='ensembl.gene')

This will temporarily solve the issue. We will let you know when the bug is fixed. Thanks!

jonathanronen commented 4 years ago

Thanks @kevinxin90. Can confirm that setting scopes= rather than scope= solves it!

namespacestd0 commented 3 years ago

@newgene the behavior seems to be expected. we have QUERY_KWARGS['POST']['scopes']['default']=['_id'], should we adjust this endpoint default settings to match the setting of annotation endpoint(ANNOTATION_DEFAULT_SCOPES = ['_id', 'ensembl.gene']) to accommodate this use case?

newgene commented 3 years ago

@namespacestd0 yes, let's set the default scopes to ['_id', 'ensembl.gene']. With this default scopes, querymany works the same as getgenes, but allows users to set different scopes for more flexible queries.