-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with unichem.structure #119
Comments
Hi Stephane, The from chembl_webresource_client.unichem import unichem_client as unichem
ret = unichem.structure('CHEMBL12', 1)
print(ret)
[{'standardinchikey': 'AAOVKJBEBIDNHE-UHFFFAOYSA-N',
'standardinchi': 'InChI=1S/C16H13ClN2O/c1-19-14-8-7-12(17)9-13(14)16(18-10-15(19)20)11-5-3-2-4-6-11/h2-9H,10H2,1H3'}] |
Hi,
Thanks to answer so quick :
I tried
from chembl_webresource_client.unichem import unichem_client as unichem
ret = unichem.inchiFromKey('AAOVKJBEBIDNHE-UHFFFAOYSA-N')
print(ret)
The result is :
[{'standardinchi': 'InChI=1S/C25H23F3N4O2/c26-25(27,28)21-9-4-20(5-10-21)8-13-24-30-22(18-34-24)17-33-23-11-6-19(7-12-23)3-1-2-15-32-16-14-29-31-32/h4-14,16,18H,1-3,15,17H2/b13-8+'}]
So the connexion seems to be ok.
If I try your code
from chembl_webresource_client.unichem import unichem_client as unichem
ret = unichem.structure('CHEMBL12', 1)
print(ret)
After 12 s I obtain the following error :
…--------------------------------------------------------------------------- MaxRetryError Traceback (most recent call last) ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 438 if not chunked: --> 439 resp = conn.urlopen( 440 method=request.method, ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 845 log.debug("Retry: %s", url) --> 846 return self.urlopen( 847 method, ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 845 log.debug("Retry: %s", url) --> 846 return self.urlopen( 847 method, ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 845 log.debug("Retry: %s", url) --> 846 return self.urlopen( 847 method, ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 835 try: --> 836 retries = retries.increment(method, url, response=response, _pool=self) 837 except MaxRetryError: ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace) 573 if new_retry.is_exhausted(): --> 574 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 575 MaxRetryError: HTTPSConnectionPool(host='www.ebi.ac.uk', port=443): Max retries exceeded with url: /unichem/rest/structure/CHEMBL12/1 (Caused by ResponseError('too many 404 error responses')) During handling of the above exception, another exception occurred: RetryError Traceback (most recent call last) /tmp/ipykernel_18210/1044002230.py in <module> 1 from chembl_webresource_client.unichem import unichem_client as unichem ----> 2 ret = unichem.structure('CHEMBL12', 1) 3 print(ret) ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/chembl_webresource_client/unichem.py in structure(self, pk, src, all) 128 else: 129 url = '{0}/structure/{1}/{2}'.format(self.base_url,pk,src) --> 130 return self._get_results(url) 131 132 #----------------------------------------------------------------------------------------------------------------------- ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/chembl_webresource_client/unichem.py in _get_results(self, url) 60 def _get_results(self, url): 61 with self._get_session() as session: ---> 62 res = session.get(url, timeout=self.timeout) 63 self.logger.info(res.url) 64 self.logger.info('From cache: {0}'.format(res.from_cache if hasattr(res, 'from_cache') else False)) ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/requests/sessions.py in get(self, url, **kwargs) 553 554 kwargs.setdefault('allow_redirects', True) --> 555 return self.request('GET', url, **kwargs) 556 557 def options(self, url, **kwargs): ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/requests_cache/core.py in request(self, method, url, params, data, **kwargs) 120 121 def request(self, method, url, params=None, data=None, **kwargs): --> 122 response = super(CachedSession, self).request( 123 method, url, 124 _normalize_parameters(params), ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 540 } 541 send_kwargs.update(settings) --> 542 resp = self.send(prep, **send_kwargs) 543 544 return resp ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/requests_cache/core.py in send(self, request, **kwargs) 97 response, timestamp = self.cache.get_response_and_time(cache_key) 98 if response is None: ---> 99 return send_request_and_cache_response() 100 101 if self._cache_expire_after is not None: ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/requests_cache/core.py in send_request_and_cache_response() 89 90 def send_request_and_cache_response(): ---> 91 response = super(CachedSession, self).send(request, **kwargs) 92 if response.status_code in self._cache_allowable_codes: 93 self.cache.save_response(cache_key, response) ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/requests/sessions.py in send(self, request, **kwargs) 653 654 # Send the request --> 655 r = adapter.send(request, **kwargs) 656 657 # Total elapsed time of the request (approximately) ~/miniconda3/envs/pkidb/lib/python3.9/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 505 506 if isinstance(e.reason, ResponseError): --> 507 raise RetryError(e, request=request) 508 509 if isinstance(e.reason, _ProxyError):
RetryError: HTTPSConnectionPool(host='www.ebi.ac.uk', port=443): Max retries exceeded with url: /unichem/rest/structure/CHEMBL12/1 (Caused by ResponseError('too many 404 error responses'))
Could you explain it ?
Stéphane
De : Eloy Félix ***@***.***>
Répondre à : chembl/chembl_webresource_client ***@***.***>
Date : lundi 16 mai 2022 à 15:13
À : chembl/chembl_webresource_client ***@***.***>
Cc : bourg ***@***.***>, Author ***@***.***>
Objet : Re: [chembl/chembl_webresource_client] Problem with unichem.structure (Issue #119)
Hi Stephane,
The unichem.structure function reutrns the structure for a given pair of source compound id and source id:
from chembl_webresource_client.unichem import unichem_client as unichem
ret = unichem.structure('CHEMBL12', 1)
print(ret)
[{'standardinchikey': 'AAOVKJBEBIDNHE-UHFFFAOYSA-N',
'standardinchi': 'InChI=1S/C16H13ClN2O/c1-19-14-8-7-12(17)9-13(14)16(18-10-15(19)20)11-5-3-2-4-6-11/h2-9H,10H2,1H3'}]
@ricardoaat<https://github.com/ricardoaat>
—
Reply to this email directly, view it on GitHub<#119 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMEXTHS4D6372JG6AHS2IN3VKJCR7ANCNFSM5WBMYYBA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
which version of the library are you using? could you please try with the latest one? |
I’m using 0.10.1.
I’ve switched to 0.10.8 and some tests are conclusive. It seems OK.
Many thanks.
Stephane
De : Eloy Félix ***@***.***>
Répondre à : chembl/chembl_webresource_client ***@***.***>
Date : lundi 16 mai 2022 à 17:11
À : chembl/chembl_webresource_client ***@***.***>
Cc : bourg ***@***.***>, Author ***@***.***>
Objet : Re: [chembl/chembl_webresource_client] Problem with unichem.structure (Issue #119)
which version of the library are you using? could you please try with the latest one? 0.10.8
—
Reply to this email directly, view it on GitHub<#119 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMEXTHV4ETFHKUMCNFBILR3VKJQPHANCNFSM5WBMYYBA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm enabled to get an answer to :
Answer is :
But
is fine.
Is there a problem with the structure() method ?
I'm using chembl_webresource_client 0.10.8 installalled from conda-forge.
Many thanks.
Stephane
The text was updated successfully, but these errors were encountered: