Giter Club home page Giter Club logo

Comments (3)

wjshipman avatar wjshipman commented on August 16, 2024

I should clarify, I'm getting that error on the import only for ChEMBL

from bioservices.uniprot import UniProt
from bioservices.chembl import ChEMBL
from bioservices.chebi import ChEBI

If I persist in trying to access ChEMBL I get functionally the same outcome. Uniprot & ChEBI are both functional and operate as expected.

chembl_ws = ChEMBL()
chembl_data = chembl_ws.get_molecule('CHEMBL2835')

WARNING [bioservices.ChEMBL:596]: status is not ok with Not Found

/usr/local/lib/python3.6/site-packages/bioservices/chembl.py in get_molecule(self, query, limit, offset, filters)
671 """
672 params = {"limit": limit, "offset": offset, "filters": filters}
--> 673 return self._get_this_service("molecule", query, params=params)
674
675 def get_molecule_form(self, query=None, limit=20, offset=0, filters=None):

/usr/local/lib/python3.6/site-packages/bioservices/chembl.py in _get_this_service(self, name, query, params)
477 elif isinstance(query, (str, int, float)):
478 res = self.http_get("{}/{}".format(name, query), params=params)
--> 479 self._check_request(res)
480 elif isinstance(query, list):
481 assert params["limit"] <= 1000, "limit must be less than 1000"

/usr/local/lib/python3.6/site-packages/bioservices/chembl.py in _check_request(self, res)
430 # If there is no output because of wrong query, a 404 is returned.
431 if isinstance(res, int):
--> 432 raise ValueError("Invalid request for {} {}. Check your query and parameters")
433
434 def _get_this_service(self, name, query, params={"limit": 20, "offset": 0}):

ValueError: Invalid request for {} {}. Check your query and parameters

from bioservices.

cokelaer avatar cokelaer commented on August 16, 2024

First of all, thanks for using bioservices. I must agree that the error message is not very useful.

I believe that molecule CHEMBL2835 does not exists hence the error message.

If you try with CHEMBL24, does it work for you ?

One difficulty with the services is that you do not have the list of valid identifiers on the hood, so you need to know the correct ones.

One way is to use gte_molecule() without option but it returns by default only the first 1000 entries.

The warning message can be ignored (at the beginning); it is just a warning.

from bioservices.

wjshipman avatar wjshipman commented on August 16, 2024

Of course, it's great library! Thank you for your indulgence, I'm going to chalk this up to me being a software engineer and not knowing any better. It looks like ChEMBL is providing a context-sensitive response which is a little awkward for API work in this way. But they both ChEMBL id's provide a target report card as shown below. I'll have to inquire with the chemist I'm working with to muddle through this. Thanks for the feedback.

!# appears to default to the "card view" as a "compound"
https://www.ebi.ac.uk/chembl/g/#search_results/all/query=chembl24

!# defaults to "table view" as a "target"
https://www.ebi.ac.uk/chembl/g/#search_results/all/query=chembl2835

https://www.ebi.ac.uk/chembl/target_report_card/CHEMBL2835/
https://www.ebi.ac.uk/chembl/target_report_card/CHEMBL24/

print(c.get_molecule('CHEMBL2835')) # FAILS

print(c.search_target('CHEMBL2835')) # SUCCEEDS

from bioservices.

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.