chembl / chembl_webresource_client

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

chembl_molecule_id to "mechanism of action" ? #21

Closed i-shah closed 7 years ago

i-shah commented 7 years ago

Hi,

What's the best way to get the linkage between a chemical and it's "mechanism of action"?

For example, under the Compounds report card for clozapine (https://www.ebi.ac.uk/chembl/compound/inspect/CHEMBL42) there is a "Mechanism of Action" heading that contains: Dopamine D2 receptor antagonist and Serotonin 2a (5-HT2a) receptor antagonist.

Cheers,

Imran

mnowotka commented 7 years ago

Hi,

The mechanism endpoint (https://www.ebi.ac.uk/chembl/api/data/mechanism.json) has a molecule_chembl_id field so this is pretty straightforward. For your example (CHEMBL42) the raw url would be:

https://www.ebi.ac.uk/chembl/api/data/mechanism.json?molecule_chembl_id=CHEMBL42

Using the client you would write:

from chembl_webresource_client.new_client import new_client
result = new_client.mechanism.filter(molecule_chembl_id='CHEMBL42')
i-shah commented 7 years ago

You guys are making this too easy - Thanks !