DessimozLab / read2tree

a tool for inferring species tree from sequencing reads
MIT License
141 stars 18 forks source link

Error when running the test files (NameError: name 'record' is not defined) #2

Closed rpbaplab closed 2 years ago

rpbaplab commented 2 years ago

It seems that is having a hard time to load the OGs

and also there is something potentially related to get the SSL certification.

Everything was intalled in a conda enviroment just for read2tree.

Thanks


Command

read2tree --tree --standalone_path marker_genes/ --reads sample_1.fastq sample_2.fastq --output_path output/


Log with the ERROR message:

--- Load OGs with min 0 species from oma marker gene export! --- Loading files for pre-filter: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:00<00:00, 6075.62 OGs/s] 2022-05-20 16:08:55,656 - read2tree.OGSet - INFO - --- Load ogs and find their corresponding DNA seq using the REST api --- Loading OGs: 0%| | 0/20 [00:00<?, ? OGs/s] Traceback (most recent call last): File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn conn.connect() File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/urllib3/connection.py", line 414, in connect self.sock = ssl_wrapsocket( File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/requests/adapters.py", line 440, in send resp = conn.urlopen( File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen retries = retries.increment( File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='omabrowser.org', port=443): Max retries exceeded with url: /api/protein/bulk_retrieve/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/read2tree-0.1.2-py3.9.egg/read2tree/OGSet.py", line 301, in _get_dna_from_REST_bulk File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/requests/api.py", line 117, in post return request('post', url, data=data, json=json, kwargs) File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/requests/sessions.py", line 529, in request resp = self.send(prep, send_kwargs) File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/requests/sessions.py", line 645, in send r = adapter.send(request, kwargs) File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/requests/adapters.py", line 517, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='omabrowser.org', port=443): Max retries exceeded with url: /api/protein/bulk_retrieve/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/name/opt/anaconda3/envs/read2tree/bin/read2tree", line 4, in import('pkg_resources').run_script('read2tree==0.1.2', 'read2tree') File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/pkg_resources/init.py", line 672, in run_script self.require(requires)[0].run_script(script_name, ns) File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/pkg_resources/init.py", line 1479, in run_script exec(script_code, namespace, namespace) File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/read2tree-0.1.2-py3.9.egg/EGG-INFO/scripts/read2tree", line 16, in File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/read2tree-0.1.2-py3.9.egg/read2tree/main.py", line 289, in main File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/read2tree-0.1.2-py3.9.egg/read2tree/OGSet.py", line 80, in init File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/read2tree-0.1.2-py3.9.egg/read2tree/OGSet.py", line 187, in _load_ogs File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/read2tree-0.1.2-py3.9.egg/read2tree/OGSet.py", line 354, in _get_dna_records File "/Users/name/opt/anaconda3/envs/read2tree/lib/python3.9/site-packages/read2tree-0.1.2-py3.9.egg/read2tree/OGSet.py", line 304, in _get_dna_from_REST_bulk NameError: name 'record' is not defined

sinamajidian commented 2 years ago

Dear rpbaplab

Thanks for reaching out. The code is trying to download cDNA sequence from the OMA browser through RestAPI. I just checked our side and Rest API is working properly. The error seems to be related to the ssl certificate in your machine. Could you please tell us your OS (linux/ mac/ windows) and the version of openssl / requests packages? and it would be great if you could run the following in your terminal and tell us the output: curl -I "https://omabrowser.org/api/genome/?page=2"

Thanks, Sina

Ps. I was able to reproduce the error partly and I fixed the bug in the code (it happened when restAPI did not working). So error handling is now improved. But I couldn't reproduce the SSL connection issue yet as we tested the rest API in different machines and it is working.

rpbaplab commented 2 years ago

Thank you so much the fixed error solved the problem in my ubuntu system. The SSL problem was in my mac OS (Monterey) and my institution's Firewall. =)

Thanks Again!

Rodrigo