WatsonLab / MAGpy

Snakemake pipeline for downstream analysis of metagenome-assembled genomes (MAGs) (pronounced mag-pie)
62 stars 23 forks source link

problems updating ete3 database #22

Closed aparadaLP closed 3 years ago

aparadaLP commented 3 years ago

Hello, I am running into the problem below when trying to update the ete3 database. Any suggestions on how to fix this problem? Best, Alma

$ python MAGpy/scripts/update_ete3.py

Downloading taxdump.tar.gz from NCBI FTP site (via HTTP)... Done. Parsing... Loading node names... 2268733 names loaded. 225755 synonyms loaded. Loading nodes... 2268733 nodes loaded. Linking nodes... Tree is loaded. Updating database: /home/users/aparada/.etetoolkit/taxa.sqlite ... 2268000 generating entries... Uploading to /home/users/aparada/.etetoolkit/taxa.sqlite

Inserting synonyms: 100000 Traceback (most recent call last):

File "MAGpy/scripts/update_ete3.py", line 5, in

ncbi.update_taxonomy_database()

File "/home/users/aparada/miniconda3/envs/magpy_install/lib/python3.6/site-packages/ete3/ncbi_taxonomy/ncbiquery.py", line 129, in update_taxonomy_database

update_db(self.dbfile)

File "/home/users/aparada/miniconda3/envs/magpy_install/lib/python3.6/site-packages/ete3/ncbi_taxonomy/ncbiquery.py", line 760, in update_db

upload_data(dbfile)

File "/home/users/aparada/miniconda3/envs/magpy_install/lib/python3.6/site-packages/ete3/ncbi_taxonomy/ncbiquery.py", line 802, in upload_data

db.execute("INSERT INTO synonym (taxid, spname) VALUES (?, ?);", (taxid, spname))

sqlite3.IntegrityError: UNIQUE constraint failed: synonym.spname, synonym.taxid

mw55309 commented 3 years ago

Hello!

This definitely looks like an ete3 problem.

I will test it within MAGpy when I can, but the only thing MAGpy does is a single call to ete3 to update the NCBI database.

You might want to try clearing out $HOME/.ete3 and trying again?

Otherwise https://github.com/etetoolkit/ete

aparadaLP commented 3 years ago

Hello, Thanks for your response. You were right, it was an ete3 problem.

I was able to resolve my problem by following an ete3 issue solution. Basically, I had to modify the file that is indicated in the error message File "/home/users/aparada/miniconda3/envs/magpy_install/lib/python3.6/site-packages/ete3/ncbi_taxonomy/ncbiquery.py",

Line 785 must be. CREATE TABLE synonym (taxid INT,spname VARCHAR(50), PRIMARY KEY (spname, taxid));

Thanks!