cblaster icon indicating copy to clipboard operation
cblaster copied to clipboard

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

Open corkdagga opened this issue 1 year ago • 15 comments

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("<PRE>(.+?)</PRE>", response.text, re.DOTALL) AttributeError: 'NoneType' object has no attribute 'group'

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

corkdagga avatar Nov 20 '24 08:11 corkdagga

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.

corkdagga avatar Nov 20 '24 11:11 corkdagga

Same problem and waiting for someone to help us

Clauvio avatar Nov 22 '24 06:11 Clauvio

I think the NCBI API changed its syntax. Try out this PR where I fixed this specific problem: https://github.com/gamcil/cblaster/pull/115

FriederikeBiermann avatar Nov 22 '24 17:11 FriederikeBiermann

Thanks! That fix worked for me :)

corkdagga avatar Nov 23 '24 07:11 corkdagga

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.

FriederikeBiermann avatar Nov 23 '24 09:11 FriederikeBiermann

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.

corkdagga avatar Nov 24 '24 16:11 corkdagga

@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'

Dx-wmc avatar Nov 25 '24 06:11 Dx-wmc

@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?

FriederikeBiermann avatar Nov 26 '24 08:11 FriederikeBiermann

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

Dx-wmc avatar Nov 27 '24 10:11 Dx-wmc

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?

FriederikeBiermann avatar Nov 27 '24 12:11 FriederikeBiermann

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'

Dx-wmc avatar Nov 28 '24 03:11 Dx-wmc

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?

FriederikeBiermann avatar Dec 03 '24 07:12 FriederikeBiermann

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.

drboothtj avatar Dec 05 '24 15:12 drboothtj

Hello,

Just to confirm, I had the same error following @FriederikeBiermann pr being merged into the latest version, and setting -hs to 250 from the default 500 worked for me. Big lifesaver, thanks very much!

Cheers, Tim

Tim-Kirkwood avatar Mar 08 '25 18:03 Tim-Kirkwood

The default value for hitlist_size was actually internally set to 5000, so I've lowered it to 500 with https://github.com/gamcil/cblaster/commit/af9a0e14209b1c64daaf310c4a7d7b08860c03ea which I'll include in the next release. Is this problem still persisting? I'm not seeing it on my side.

gamcil avatar Oct 22 '25 08:10 gamcil