GithubHelp home page GithubHelp logo

Comments (3)

juanfmx2 avatar juanfmx2 commented on June 20, 2024 2

Unfortunately, when an unknown parameter/filter is included in the query it is ignored. In this case drug_chembl_id is not a property present in the mechanism endpoint (https://www.ebi.ac.uk/chembl/api/data/mechanism.json), and for that reason you are retrieving all the records from it instead of the ones related with CHEMBL269732. You should use the property parent_molecule_chembl_id instead.

from chembl_webresource_client.new_client import new_client


mechanism_res = new_client.mechanism.filter(parent_molecule_chembl_id="CHEMBL269732")
mechanism_ids = {x["target_chembl_id"] for x in tqdm(mechanism_res)}
len(mechanism_ids)

I hope this helps, we are considering including an error message that lets you know that an unknown filter is being used.

from chembl_webresource_client.

BartoszBartmanski avatar BartoszBartmanski commented on June 20, 2024

Thanks for your help!

However, I encountered another related problem - when I try to search for targets of a compound I get an empty list even though on the website it shows 325 targets:

target_res = new_client.target.filter(target_chembl_id="CHEMBL269732")
print(target_res)

and target_chembl_id is present at https://www.ebi.ac.uk/chembl/api/data/target.json

from chembl_webresource_client.

juanfmx2 avatar juanfmx2 commented on June 20, 2024

this might be a little more complex, since we do additional processing to display information on the web interface from information that is on the web services/database.

CHEMBL269732 is an identifier for a compound, it is not an identifier for targets, so you can't use it to filter on the target endpoint directly

In order to filter targets based on a compound identifier, you have 2 options use the Mechanisms of Action endpoint or the Assay-Activity endpoints.

Mechanisms of Action
https://www.ebi.ac.uk/chembl/api/data/mechanism.json?parent_molecule_chembl_id=CHEMBL269732

Activity
https://www.ebi.ac.uk/chembl/api/data/activity.json?parent_molecule_chembl_id=CHEMBL269732

From here you could collect the target_chembl_id and later on use them to filter on the target endpoint:

https://www.ebi.ac.uk/chembl/api/data/target.json?target_chembl_id__in=CHEMBL1902,CHEMBL4445,CHEMBL4438

I hope this helps.

from chembl_webresource_client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.