NBISweden / contigtax

Taxonomic classification of metagenomic contigs
MIT License
6 stars 6 forks source link

contigtax dowload fails #9

Closed msevi closed 4 years ago

msevi commented 4 years ago

I just installed the program through conda on a compute server. When downloading data base files, the command fails with the following:

contigtax download taxonomy Downloading NCBI taxdump.tar.gz 0 bytes [00:00, ? bytes/s] Traceback (most recent call last): File "/home/m.sevi/miniconda3/envs/contitax_env/bin/contigtax", line 10, in sys.exit(main()) File "/home/m.sevi/miniconda3/envs/contitax_env/lib/python3.6/site-packages/contigtax/main.py", line 387, in main args.func(args) File "/home/m.sevi/miniconda3/envs/contitax_env/lib/python3.6/site-packages/contigtax/main.py", line 24, in download prepare.download_ncbi_taxonomy(args.taxdir, args.force) File "/home/m.sevi/miniconda3/envs/contitax_env/lib/python3.6/site-packages/contigtax/prepare.py", line 200, in download_ncbi_taxonomy urllib.request.urlretrieve(url, local, reporthook=reporthook) File "/home/m.sevi/miniconda3/envs/contitax_env/lib/python3.6/urllib/request.py", line 274, in urlretrieve reporthook(blocknum, bs, size) File "/home/m.sevi/miniconda3/envs/contitax_env/lib/python3.6/site-packages/contigtax/prepare.py", line 37, in update_to t.update((b - last_b[0]) * bsize) File "/home/m.sevi/miniconda3/envs/contitax_env/lib/python3.6/site-packages/tqdm-4.7.2-py3.6.egg/tqdm/_tqdm.py", line 689, in update ZeroDivisionError: float division by zero

A similar behaviour is observed with >contigtax download uniref100

johnne commented 4 years ago

Hi @msevi,

Thanks for using contigtax!

This error is caused by a bug in the tqdm package (See here). You can try running conda update tqdm to get the latest version of tqdm and see if it works. I just tested and I could reproduce the error with version 4.7.2 but it works after updating (to version 4.47.0 in my case). I'll make sure to update the conda recipe to avoid this error in the future.

msevi commented 4 years ago

That did it! However when I updated the package, I believe the diamond version was updated or downgraded. When running step 6 (performing the search), it errors out with: This diamond version requires you to supplya taxonmap file with --taxonmap at this stage My current diamond version (with which I built the database) is diamond v0.9.14.115.

Can you provide information on tested dependencies versions.

Cheers, Maria

johnne commented 4 years ago

Yes, diamond versions < 0.9.19 required that the taxonmap file be supplied at the search stage whereas in later versions it is supplied at the makedb stage. Your diamond version should have remained the same when updating tqdm but you can make sure by running conda list --revisions.

Using your v0.9.14.115 you should be able to supply the taxonmap file (likely named prot.accession2taxid.gz in the same folder as the diamond database files that have been built) by adding --taxonmap <path to the prot.accession2taxid.gz file> to contigtax search.

Alternatively you can update diamond which means you will likely also need to rebuild the diamond database.

msevi commented 4 years ago

Checked the revisions in the environment. I think my downgrade issue stemmed from using conda update tqdm initially. This used the bioconda channel and didn't upgrade the tqdm version. I believe I followed up with conda update and that's when diamond got downgraded [diamond {0.9.24 (bioconda) -> 0.9.14 (bioconda)}] and nothing changed with respect to tqdm. Finally I used conda install -c conda-forge tqdm and this upgraded tqdm [tqdm {4.7.2 (bioconda) -> 4.47.0 (conda-forge)}]. Anyway, I proceeded with your advice adding --taxonmap flag (without updating the db) and it seems to be working. Thanks for the quick reply!

Cheers, Maria

johnne commented 4 years ago

No problem! Let me know if you run into any other problems.