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

Error for url #131

Open RicardoMBorges opened 11 months ago

RicardoMBorges commented 11 months ago

Hello, I wrote a small jupyter notebook script that gets lists from chembl. It ran the first couple of times, but now is giving me this error and I don´t know how to go around this: HttpApplicationError: Error for url https://www.ebi.ac.uk/chembl/api/data/molecule.json, server response: <!doctype HTML> Can someone give a help for these sort of things?

Thanks

My script:

chembl websource

from chembl_webresource_client.new_client import new_client

Filter CHEMBL for compound of interest. Note that this can be modified (see: )

molecules = new_client.molecule

Select Drugs with molecular weight <= 2000

small_molecules = molecules.filter(molecule_properties__mw_freebase__lte=2000)

Consider filtering for Natural Products. Note that this might be faulty.

NPs = small_molecules.filter(natural_product=1)

Select Approved Drugs

approved_drugs_small = NPs.filter(max_phase=4).order_by('molecule_properties__mw_freebase') Approved_drugs_small_NP = pd.DataFrame(approved_drugs_small)

The error:

HttpApplicationError Traceback (most recent call last) Input In [6], in <cell line: 12>() 10 # Select Approved Drugs 11 approved_drugs_small = NPs.filter(max_phase=4).order_by('molecule_properties__mw_freebase') ---> 12 Approved_drugs_small_NP = pd.DataFrame(approved_drugs_small) 14 Approved_drugs_small_NP2 = Approved_drugs_small_NP[["molecule_chembl_id","molecule_structures","pref_name","natural_product"]].copy() 15 Approved_drugs_small_NP2["molecule_structures"] = Approved_drugs_small_NP2["molecule_structures"].astype(str).str.split(",").str[0]

File ~/env_rmb_rdkit/lib/python3.8/site-packages/pandas/core/frame.py:710, in DataFrame.init(self, data, index, columns, dtype, copy) 708 data = np.asarray(data) 709 else: --> 710 data = list(data) 711 if len(data) > 0: 712 if is_dataclass(data[0]):

File ~/env_rmb_rdkit/lib/python3.8/site-packages/chembl_webresource_client/query_set.py:127, in QuerySet.next(self) 126 def next(self): --> 127 return self.next()

File ~/env_rmb_rdkit/lib/python3.8/site-packages/chembl_webresource_client/query_set.py:115, in QuerySet.next(self) 113 self.chunk = self.query.get_page() 114 if not self.chunk or self.current_index >= len(self.chunk): --> 115 self.chunk = self.query.next_page() 116 if not self.chunk: 117 raise StopIteration

File ~/env_rmb_rdkit/lib/python3.8/site-packages/chembl_webresource_client/url_query.py:434, in UrlQuery.next_page(self) 432 start = self.start 433 self.current_index = int(start + self.limit * (self.current_page + 1)) --> 434 return self.get_page()

File ~/env_rmb_rdkit/lib/python3.8/site-packages/chembl_webresource_client/url_query.py:394, in UrlQuery.get_page(self) 392 self.logger.info('From cache: {0}'.format(res.from_cache if hasattr(res, 'from_cache') else False)) 393 if not res.ok: --> 394 handle_http_error(res) 395 if self.frmt == 'json': 396 json_data = res.json()

File ~/env_rmb_rdkit/lib/python3.8/site-packages/chembl_webresource_client/http_errors.py:113, in handle_http_error(request) 111 exception_class = status_to_exception.get(request.status_code, BaseHttpException) 112 if request.text: --> 113 raise exception_class(request.url, request.text) 114 raise exception_class(request.url, request.content)

HttpApplicationError: Error for url https://www.ebi.ac.uk/chembl/api/data/molecule.json, server response: <!doctype html>

Error: 500 | EMBL’s European Bionformatics Institute

Error: 500

There was a technical error.

Something has gone wrong with our web server when attempting to make this page.

Unfortunately, the service you are trying to access is currently unavailable.
Please try again later.

Example searches: blast keratin bfl1 | About EBI Search

Need assistance?

Contact our support team