TBProfiler icon indicating copy to clipboard operation
TBProfiler copied to clipboard

TBProfiler load_library cannot find newly created tbdb

Open ryanjameskennedy opened this issue 1 year ago • 4 comments

Upon running the following command:

tb-profiler load_library test

The following error was returned:

Traceback (most recent call last):
  File "/data/bnf/sw/miniconda3/envs/tbprofiler/bin/tb-profiler", line 565, in <module>
    args.func(args)
  File "/data/bnf/sw/miniconda3/envs/tbprofiler/bin/tb-profiler", line 213, in main_load_library
    pp.load_db(variables_file,args.software_name,source_dir=source_dir)
  File "/data/bnf/sw/miniconda3/envs/tbprofiler/lib/python3.12/site-packages/pathogenprofiler/db.py", line 564, in load_db
    shutil.copyfile(source,target)
  File "/data/bnf/sw/miniconda3/envs/tbprofiler/lib/python3.12/shutil.py", line 260, in copyfile
    with open(src, 'rb') as fsrc:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/test.fasta'

The run works if you provide the filepath to the tbdb and the prefix to your newly created tbdb as so:

tb-profiler load_library /path/to/tbdb/test

But this is not the format provided on your README . Using the --dir command also doesn't work. Changing this line to the following solves the error:

source_dir = os.path.realpath(args.dir)

I can create a quick PR to correct this and fix the README if you're too busy:)

ryanjameskennedy avatar Nov 23 '23 10:11 ryanjameskennedy