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

AttributeError: 'NoneType' object has no attribute 'group' #114

Open
corkdagga opened this issue Nov 20, 2024 · 13 comments
Open

AttributeError: 'NoneType' object has no attribute 'group' #114

corkdagga opened this issue Nov 20, 2024 · 13 comments

Comments

@corkdagga
Copy link

Hi All,

I am a new mac user and have been slowly setting up the new laptop. I freshly installed cblaster and am running into some problems (see below). I think it could be a python issue. I was using zsh but after installing everything, I changed to bash, then tried to uninstall and reinstall again. I have a feeling this could be there the issue is.

NABI-MAC001:cblaster_test paul$ cblaster search -m remote --rid KV6WEC7B013 -qf myQF_9705.fasta -p test6.html
Importing genomicsqlite failed, falling back to SQLite3
[09:39:43] INFO - Starting cblaster in remote mode
[09:39:43] INFO - Polling NCBI for completion status
[09:39:43] INFO - Checking search status...
[09:39:43] INFO - Search has completed successfully!
[09:39:43] INFO - Retrieving results for search KV6WEC7B013
Traceback (most recent call last):
File "/Users/paul/Library/Python/3.9/bin/cblaster", line 8, in
sys.exit(main())
File "/Users/paul/Library/Python/3.9/lib/python/site-packages/cblaster/main.py", line 432, in main
cblaster(
File "/Users/paul/Library/Python/3.9/lib/python/site-packages/cblaster/main.py", line 318, in cblaster
rid, results = remote.search(
File "/Users/paul/Library/Python/3.9/lib/python/site-packages/cblaster/remote.py", line 371, in search
results = retrieve(rid, hitlist_size=hitlist_size)
File "/Users/paul/Library/Python/3.9/lib/python/site-packages/cblaster/remote.py", line 208, in retrieve
for line in re.search("

(.+?)
", response.text, re.DOTALL)
AttributeError: 'NoneType' object has no attribute 'group'

Any help to get cblaster working would be great! thank you :)

@corkdagga
Copy link
Author

I also saw some other posts with the same issue, these were either fixed with an updated version or I tried the suggestions but it did not work for me... I am running the latest version.

@Clauvio
Copy link

Clauvio commented Nov 22, 2024

Same problem and waiting for someone to help us

@FriederikeBiermann
Copy link
Contributor

I think the NCBI API changed its syntax. Try out this PR where I fixed this specific problem: #115

@corkdagga
Copy link
Author

Thanks! That fix worked for me :)

@FriederikeBiermann
Copy link
Contributor

I think this issue should not be closed, as the PR was not merged yet and I expect all users to be affected by this issue. It's really hard to find the connection between the issue and the PR now.

@corkdagga corkdagga reopened this Nov 24, 2024
@corkdagga
Copy link
Author

I think this issue should not be closed, as the PR was not merged yet and I expect all users to be affected by this issue. It's really hard to find the connection between the issue and the PR now.

Sorry about that! Its re-opened.

@Dx-wmc
Copy link

Dx-wmc commented Nov 25, 2024

@FriederikeBiermann According to the PR, I modified the corresponding two lines of code, but the error still occurs.

Traceback (most recent call last):
  File "/home/data/usr/dx/miniconda3/envs/cblaster/bin/cblaster", line 8, in <module>
    sys.exit(main())
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/main.py", line 432, in main
    cblaster(
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/main.py", line 318, in cblaster
    rid, results = remote.search(
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/remote.py", line 373, in search
    results = retrieve(rid, hitlist_size=hitlist_size)
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/remote.py", line 210, in retrieve
    for line in re.search("<PRE>(.+?)</PRE>", response.text, re.DOTALL)
AttributeError: 'NoneType' object has no attribute 'group'

@FriederikeBiermann
Copy link
Contributor

@FriederikeBiermann According to the PR, I modified the corresponding two lines of code, but the error still occurs.

Traceback (most recent call last):
  File "/home/data/usr/dx/miniconda3/envs/cblaster/bin/cblaster", line 8, in <module>
    sys.exit(main())
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/main.py", line 432, in main
    cblaster(
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/main.py", line 318, in cblaster
    rid, results = remote.search(
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/remote.py", line 373, in search
    results = retrieve(rid, hitlist_size=hitlist_size)
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/remote.py", line 210, in retrieve
    for line in re.search("<PRE>(.+?)</PRE>", response.text, re.DOTALL)
AttributeError: 'NoneType' object has no attribute 'group'

Did you make sure to install the new version to your conda env or change it directly in the /home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/remote.py?

@Dx-wmc
Copy link

Dx-wmc commented Nov 27, 2024

Yes, I have modified the remote.py and the version of cblaster is latest 1.3.19.

@FriederikeBiermann
Copy link
Contributor

Yes, I have modified the remote.py and the version of cblaster is latest 1.3.19.

If you put in a preint statement that prints out the URL it uses to fetch, what does it show?

@Dx-wmc
Copy link

Dx-wmc commented Nov 28, 2024

Hi, this is the output after adding the URL.

[11:35:19] INFO - Starting cblaster in remote mode
[11:35:19] INFO - Launching new search
Request URL (POST): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=PUT&DATABASE=nr&PROGRAM=blastp&FILTER=F&EXPECT=0.01&GAPCOSTS=11+1&MATRIX=BLOSUM62&HITLIST_SIZE=5000&ALIGNMENTS=5000&DESCRIPTIONS=5000&WORD_SIZE=6&COMPOSITION_BASED_STATISTICS=2&THRESHOLD=11
[11:35:23] INFO - Request Identifier (RID): MFT7VWSV013
[11:35:23] INFO - Request Time Of Execution (RTOE): 16s
[11:35:39] INFO - Polling NCBI for completion status
[11:35:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:36:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:37:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:38:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:39:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:40:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:41:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:42:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:43:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:43:40] INFO - Search has completed successfully!
[11:43:40] INFO - Retrieving results for search MFT7VWSV013
Request URL (GET for retrieval): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&ALIGNMENT_VIEW=Tabular&FORMAT_OBJECT=Alignment&HITLIST_SIZE=5000&ALIGNMENTS=5000&DESCRIPTIONS=5000&FORMAT_TYPE=Text
Traceback (most recent call last):
  File "/home/data/usr/dx/miniconda3/envs/cblaster/bin/cblaster", line 8, in <module>
    sys.exit(main())
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/main.py", line 432, in main
    cblaster(
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/main.py", line 318, in cblaster
    rid, results = remote.search(
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/remote.py", line 374, in search
    results = retrieve(rid, hitlist_size=hitlist_size)
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/remote.py", line 211, in retrieve
    for line in re.search("<PRE>(.+?)</PRE>", response.text, re.DOTALL)
AttributeError: 'NoneType' object has no attribute 'group'

@FriederikeBiermann
Copy link
Contributor

Hi, this is the output after adding the URL.

[11:35:19] INFO - Starting cblaster in remote mode
[11:35:19] INFO - Launching new search
Request URL (POST): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=PUT&DATABASE=nr&PROGRAM=blastp&FILTER=F&EXPECT=0.01&GAPCOSTS=11+1&MATRIX=BLOSUM62&HITLIST_SIZE=5000&ALIGNMENTS=5000&DESCRIPTIONS=5000&WORD_SIZE=6&COMPOSITION_BASED_STATISTICS=2&THRESHOLD=11
[11:35:23] INFO - Request Identifier (RID): MFT7VWSV013
[11:35:23] INFO - Request Time Of Execution (RTOE): 16s
[11:35:39] INFO - Polling NCBI for completion status
[11:35:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:36:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:37:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:38:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:39:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:40:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:41:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:42:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:43:39] INFO - Checking search status...
Request URL (GET): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&FORMAT_OBJECT=SearchInfo
[11:43:40] INFO - Search has completed successfully!
[11:43:40] INFO - Retrieving results for search MFT7VWSV013
Request URL (GET for retrieval): https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&RID=MFT7VWSV013&ALIGNMENT_VIEW=Tabular&FORMAT_OBJECT=Alignment&HITLIST_SIZE=5000&ALIGNMENTS=5000&DESCRIPTIONS=5000&FORMAT_TYPE=Text
Traceback (most recent call last):
  File "/home/data/usr/dx/miniconda3/envs/cblaster/bin/cblaster", line 8, in <module>
    sys.exit(main())
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/main.py", line 432, in main
    cblaster(
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/main.py", line 318, in cblaster
    rid, results = remote.search(
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/remote.py", line 374, in search
    results = retrieve(rid, hitlist_size=hitlist_size)
  File "/home/data/usr/dx/miniconda3/envs/cblaster/lib/python3.9/site-packages/cblaster/remote.py", line 211, in retrieve
    for line in re.search("<PRE>(.+?)</PRE>", response.text, re.DOTALL)
AttributeError: 'NoneType' object has no attribute 'group'

Interestingly, the retrieve download link now works. Maybe you can also print the response.text?

@drboothtj
Copy link
Contributor

There is another issue at play. The API is also preemptively cutting short the result. You can get around this by applying the patch and lowering the -hs or adding some other filter that limits the results.

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

5 participants