Skip to content
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

Interaction fetch not continue after connection error. #2

Open
serbulent opened this issue Jul 25, 2019 · 9 comments
Open

Interaction fetch not continue after connection error. #2

serbulent opened this issue Jul 25, 2019 · 9 comments
Assignees

Comments

@serbulent
Copy link

When fetching interactions if any connection error occurs fetch process is ended. It might be good if there is a --max-try parameter to continue trying after this error.

Error message is below;

('Fetching interactions for', 'P63092', 'CHEMBL4377')
Traceback (most recent call last):
File "getligprotvec.py", line 104, in
getProteinVec(proteins_path)
File "getligprotvec.py", line 78, in getProteinVec
PLIlist = getLigandInteractions(proteins_path)
File "getligprotvec.py", line 63, in getLigandInteractions
compounds = activity_parser(activities)
File "getligprotvec.py", line 38, in activity_parser
for activity in activities:
File "/home/srb/.local/lib/python2.7/site-packages/chembl_webresource_client/query_set.py", line 116, in next
self.chunk = self.query.next_page()
File "/home/srb/.local/lib/python2.7/site-packages/chembl_webresource_client/url_query.py", line 435, in next_page
return self.get_page()
File "/home/srb/.local/lib/python2.7/site-packages/chembl_webresource_client/url_query.py", line 390, in get_page
res = session.post(self.base_url + '.' + self.frmt, json=data, timeout=self.timeout)
File "/home/srb/.local/lib/python2.7/site-packages/requests/sessions.py", line 581, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/srb/.local/lib/python2.7/site-packages/requests_cache/core.py", line 132, in request
**kwargs
File "/home/srb/.local/lib/python2.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/home/srb/.local/lib/python2.7/site-packages/requests_cache/core.py", line 105, in send
return send_request_and_cache_response()
File "/home/srb/.local/lib/python2.7/site-packages/requests_cache/core.py", line 97, in send_request_and_cache_response
response = super(CachedSession, self).send(request, **kwargs)
File "/home/srb/.local/lib/python2.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/home/srb/.local/lib/python2.7/site-packages/requests/adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))

@hkmztrk
Copy link
Owner

hkmztrk commented Jul 27, 2019

Thanks @serbulent, I'll try to look into it in a week and let you know.

@hkmztrk hkmztrk self-assigned this Jul 27, 2019
@hkmztrk
Copy link
Owner

hkmztrk commented Aug 7, 2019

Hello @serbulent, I updated the code accordingly and it'll be great if you test it out and confirm whether that works or not.

Btw, I realized that the embedding files are out-dated, so I updated them - I suggest you to download them again from the same address.

Best!

@serbulent
Copy link
Author

Thanks for your efforts but we have still have a missing parameter :)

Constructing protein vectors..
('Fetching interactions for', 'Entry', 'none')
('Fetching interactions for', 'A0A584', 'none')
('Fetching interactions for', 'Q9BXU3', 'none')
('Fetching interactions for', 'Q15031', 'CHEMBL4105806')
Traceback (most recent call last):
File "getligprotvec.py", line 110, in
getProteinVec(proteins_path)
File "getligprotvec.py", line 84, in getProteinVec
PLIlist = getLigandInteractions(proteins_path)
File "getligprotvec.py", line 63, in getLigandInteractions
while activities is None and connection_error_counter < CONN_MAX_TRY:
NameError: global name 'CONN_MAX_TRY' is not defined

@hkmztrk
Copy link
Owner

hkmztrk commented Aug 20, 2019

@serbulent, I fixed that, thank you. Does it work now?

@serbulent
Copy link
Author

It works now thanks.

@serbulent
Copy link
Author

After update the repo with at 23 Feb 2020. I'm experiencing this issue again with the error message below with command;

python getligprotvec.py drug.pubchem.canon.l8.ws20.txt
....

Traceback (most recent call last):
  File "getligprotvec.py", line 109, in <module>
    getProteinVec(proteins_path)
  File "getligprotvec.py", line 83, in getProteinVec
    PLIlist = getLigandInteractions(proteins_path)
  File "getligprotvec.py", line 68, in getLigandInteractions
    compounds = activity_parser(activities)
  File "getligprotvec.py", line 34, in activity_parser
    for activity in activities:
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/chembl_webresource_client/query_set.py", line 116, in next
    self.chunk = self.query.next_page()
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/chembl_webresource_client/url_query.py", line 435, in next_page
    return self.get_page()
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/chembl_webresource_client/url_query.py", line 390, in get_page
    res = session.post(self.base_url + '.' + self.frmt, json=data, timeout=self.timeout)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests/sessions.py", line 581, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests_cache/core.py", line 126, in request
    **kwargs
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests_cache/core.py", line 99, in send
    return send_request_and_cache_response()
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests_cache/core.py", line 91, in send_request_and_cache_response
    response = super(CachedSession, self).send(request, **kwargs)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('No status line received - the server has closed the connection',))

@serbulent serbulent reopened this Feb 24, 2020
@hkmztrk
Copy link
Owner

hkmztrk commented Feb 24, 2020

Hello @serbulent, can you provide the protein ID you are getting this error message for?

@serbulent
Copy link
Author

I get the error not for a specific protein instead get it randomly when trying to produce vectors for all human proteins. I retry it and get another connection error as below. Also I recorded the output and attaching it here.

Traceback (most recent call last):                                                                                                                                                                          
  File "getligprotvec.py", line 109, in <module>                                                                                                                                                            
    getProteinVec(proteins_path)                                                                                                                                                                            
  File "getligprotvec.py", line 83, in getProteinVec                                                                                                                                                        
    PLIlist = getLigandInteractions(proteins_path)                                                                                                                                                          
  File "getligprotvec.py", line 68, in getLigandInteractions                                                                                                                                                
    compounds = activity_parser(activities)                                                                                                                                                                 
  File "getligprotvec.py", line 34, in activity_parser                                                                                                                                                      
    for activity in activities:                                                                                                                                                                             
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/chembl_webresource_client/query_set.py", line 116, in next
    self.chunk = self.query.next_page()
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/chembl_webresource_client/url_query.py", line 435, in next_page
    return self.get_page()
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/chembl_webresource_client/url_query.py", line 390, in get_page
    res = session.post(self.base_url + '.' + self.frmt, json=data, timeout=self.timeout)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests/sessions.py", line 581, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests_cache/core.py", line 126, in request
    **kwargs
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests_cache/core.py", line 106, in send
    return send_request_and_cache_response()
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests_cache/core.py", line 91, in send_request_and_cache_response
    response = super(CachedSession, self).send(request, **kwargs)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/media/DATA/serbulent/anaconda3/envs/thesis/lib/python2.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.ebi.ac.uk', port=443): Max retries exceeded with url: /chembl/api/data/activity.json (Caused by NewConnectionError('<urllib3.connection.$erifiedHTTPSConnection object at 0x7fb22b5e6510>: Failed to establish a new connection: [Errno -2] Name or service not known',))

smiles.log.gz

@hkmztrk
Copy link
Owner

hkmztrk commented Mar 7, 2020

Hi @serbulent, I tested the code without any update on the longer protein list you previously provided, and it worked fine for me.

This is most likely that the host cuts the connection after a while and I am not sure how to handle this. How about you divide your data into smaller subsets? I would also be happy to hear if you have suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants