jodyphelan / TBProfiler

Profiling tool for Mycobacterium tuberculosis to detect ressistance and strain type from WGS data
GNU General Public License v3.0
102 stars 42 forks source link

AttributeError: 'Namespace' object has no attribute 'conf' #265

Open huihuigogo opened 1 year ago

huihuigogo commented 1 year ago

Hi @jodyphelan On TBprofiler version 4.4.1, when I created a custom database, the following errors occurred. I can't resove it ,could you please give some help? Thank you!

(TBprofiler_4.4.1_old) [huihuigogo@login01 tbdb-master]$ tb-profiler create_db --prefix tbdb_new Converting 580 mutations

Running command: set -u pipefail; snpEff ann Mycobacterium_tuberculosis_h37rv a1729fd9-74b4-47cd-b991-4e75fc2ab048 Converting 1269 mutations

Running command: set -u pipefail; snpEff ann Mycobacterium_tuberculosis_h37rv 4320e28c-41ac-4b7f-ab3f-657583805952

Running command: set -u pipefail; git log | head -4 Traceback (most recent call last): File "/huihuigogo/miniconda3/envs/TBprofiler_4.4.1_old/bin/tb-profiler", line 682, in args.func(args) File "/huihuigogo/miniconda3/envs/TBprofiler_4.4.1_old/bin/tb-profiler", line 231, in main_create_db pp.create_db(args,extra_files=extra_files) File "/huihuigogo/miniconda3/envs/TBprofiler_4.4.1_old/lib/python3.8/site-packages/pathogenprofiler/db.py", line 670, in create_db version["commit"] = version["commit"][:7] KeyError: 'commit' Cleaning up after failed run Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/huihuigogo/miniconda3/envs/TBprofiler_4.4.1_old/bin/tb-profiler", line 32, in cleanup del args.conf['json_db'] AttributeError: 'Namespace' object has no attribute 'conf'

bsun210 commented 1 year ago

I have the same issue, any thoughts?

KevinLYW366 commented 1 year ago

Hi,

I met the same issue when I was trying to import tbdb-who database from https://github.com/jodyphelan/tbdb/tree/who. Here is a solution that works for me:

I fristly downloaded zip file from that repository. I got the same error message after running tb-profiler create_db in the unzipped folder. Something might go wrong with set -u pipefail; git log | head -4. I think git information is missing with the zip file. I tried git clone https://github.com/jodyphelan/tbdb/tree/who"to download and rerun tb-profiler create_db. Worked!

By the way, @jodyphelan it might be a little bit confusing with the instruction to run tb-profiler load_library --prefix <new_library_name>. In tb-profiler v4.4.2, "prefix" is a positional argument so adding "--prefix" will throw an error. Besides, path has to be included in "prefix" (in my case, tb-profiler load_library ./tbdb-who worked). I tried the argument "-d" but it didn't work (tb-profiler load_library tbdb-who -d .).

Thanks, Kevin

jodyphelan commented 1 year ago

Thanks @KevinLYW366 for the suggestion. Let me know if that works for you @huihuigogo and @bsun210.

Yes I agree that is confusing, I will make it a positional argument. I think I might also remove the requirement for it to be a git repository as more people are starting to make their own libraries.