merenlab / anvio

An analysis and visualization platform for 'omics data
http://merenlab.org/software/anvio
GNU General Public License v3.0
439 stars 145 forks source link

Can't upgrade PROFILE.db from v19 to v20 #471

Closed brymerr921 closed 7 years ago

brymerr921 commented 7 years ago

I tried to upgrade my PROFILE.db from v17 to v20 using the scripts to go from v17 to v18, v18 to v19, and finally v19 to v20. The v19 to v20 upgrade script didn't work. Here is the error message.

Traceback (most recent call last):
  File "/home/sonnenburglab/virtual-envs/anvio-2.2.2/bin/anvi-script-upgrade-profile-db-v19-to-v20", line 80, in <module>
    update_profile_db(args.profile_db, just_do_it = args.just_do_it)
  File "/home/sonnenburglab/virtual-envs/anvio-2.2.2/bin/anvi-script-upgrade-profile-db-v19-to-v20", line 51, in update_profile_db
    profile_db._exec('COMMIT')
  File "/home/sonnenburglab/virtual-envs/anvio-2.2.2/lib/python3.5/site-packages/anvio/db.py", line 133, in _exec
    ret_val = self.cursor.execute(sql_query)
sqlite3.OperationalError: cannot commit - no transaction is active

Another time it said:

Traceback (most recent call last):
  File "/home/sonnenburglab/virtual-envs/anvio-2.2.2/bin/anvi-script-upgrade-profile-db-v19-to-v20", line 80, in <module>
    update_profile_db(args.profile_db, just_do_it = args.just_do_it)
  File "/home/sonnenburglab/virtual-envs/anvio-2.2.2/bin/anvi-script-upgrade-profile-db-v19-to-v20", line 48, in update_profile_db
    profile_db._exec('DROP TABLE gene_coverages;')
  File "/home/sonnenburglab/virtual-envs/anvio-2.2.2/lib/python3.5/site-packages/anvio/db.py", line 133, in _exec
    ret_val = self.cursor.execute(sql_query)
sqlite3.OperationalError: no such table: gene_coverages

Thanks!

meren commented 7 years ago

Sorry about this unexpected problem.

Solution

Download the updated script (which is here if you want to download it manually):

wget https://goo.gl/AtbmWn -O anvi-script-upgrade-profile-db-v19-to-v20-fixy

Overwrite the existing script (just copy-paste the following commands):

target_dir=$(dirname `which anvi-script-upgrade-profile-db-v19-to-v20`)
x18_to_19="$target_dir/anvi-script-upgrade-profile-db-v18-to-v19"
x19_to_20="$target_dir/anvi-script-upgrade-profile-db-v19-to-v20"
head -n 1 $x18_to_19 > $x19_to_20
tail -n +2 anvi-script-upgrade-profile-db-v19-to-v20-fixy >> $x19_to_20

Re-run your upgrade:

anvi-script-upgrade-profile-db-v19-to-v20 YOUR_PROFILE_DB --just-do-it

This should resolve it.

Sorry about the hiccup!

meren commented 7 years ago

We would be very happy if you can let us know whether it works!

jvineis commented 7 years ago

This works!

meren commented 7 years ago

Thank you, Joe.