chembl / chembl_webresource_client

Official Python client for accessing ChEMBL API
https://www.ebi.ac.uk/chembl/api/data/docs
Other
360 stars 95 forks source link

Lookup compound by synonym - how does the code translate to chembl SQL queries ? #88

Closed joetym closed 2 years ago

joetym commented 4 years ago

hi, I'm just wondering how this call translates into an SQL query(s) in the CHEMBL schema ?

from chembl_webresource_client.new_client import new_client
molecule = new_client.molecule
res = molecule.search('viagra')

I tried looking in molecule_synonyms but there seems to be some cases where I am getting results with the above, but can't find it in molecule_synonyms.

Thanks Joe

eloyfelix commented 3 years ago

Hi Joe,

Sorry for the late reply. This search endpoint uses elasticsearch to do a fuzzy search and try to retrieve names that might be not found due to typos.

This notebook with an example of how to translate drug names to chembl entities might be useful for you: https://github.com/eloyfelix/chembl_multitask/blob/master/name2chembl.ipynb

eloyfelix commented 3 years ago

molecule_dictionary.pref_name also contains names that might not be present in the synonyms table, so it's possible that elastic gets the name from there.