diff --git a/PanACoTA/annotate_module/annotation_functions.py b/PanACoTA/annotate_module/annotation_functions.py index 41497d50e66a945b928d9e705adf4dd180a07e92..beefeeee7b3b84b4ee7015368cfea48d83552cda 100755 --- a/PanACoTA/annotate_module/annotation_functions.py +++ b/PanACoTA/annotate_module/annotation_functions.py @@ -258,7 +258,7 @@ def run_prokka(arguments): # - if outdir exists exists but force, remove this outdir. # So, outdir does not exist -> run prokka cmd = (f"prokka --outdir {prok_dir} --cpus {threads} " - f"--prefix {name} {gpath}") + f"--prefix {name} --centre prokka {gpath}") error = (f"Error while trying to run prokka on {name} from {gpath}") logger.details("Prokka command: " + cmd) prokf = open(prok_logfile, "w") diff --git a/test/test_unit/test_annotate/test_annotation_functions-prokka.py b/test/test_unit/test_annotate/test_annotation_functions-prokka.py index 5195543b398f69809f14f3524d2bc940f1c34a84..e160d6201c74f59b949772a17e716e3acc3c3b68 100644 --- a/test/test_unit/test_annotate/test_annotation_functions-prokka.py +++ b/test/test_unit/test_annotate/test_annotation_functions-prokka.py @@ -490,9 +490,13 @@ def test_run_prokka_out_exists_force(): # we cannot compare the whole file. with open(out_tbl, "r") as outt: lines = [line.strip() for line in outt.readlines()] - assert ">Feature H561_S27" in lines - assert ">Feature H561_S28" in lines - assert ">Feature H561_S29" in lines + # Check that there are 3 contigs + feature = 0 + for line in lines: + if 'Feature' in line: + feature += 1 + assert feature == 3 + # Check that there are 16 CDS CDS = 0 for line in lines: if "CDS" in line: @@ -512,7 +516,7 @@ def test_run_prokka_out_exists_force(): assert q.get().message == ("Prokka command: prokka " "--outdir test/data/annotate/generated_by_unit-tests/" "H299_H561.fasta-prokkaRes --cpus 2 --prefix test_runprokka_H299 " - "test/data/annotate/genomes/H299_H561.fasta") + "--centre prokka test/data/annotate/genomes/H299_H561.fasta") assert q.get() .message.startswith("End annotating test_runprokka_H299 " "from test/data/annotate/genomes/H299_H561.fasta") @@ -547,9 +551,13 @@ def test_run_prokka_out_doesnt_exist_ok(): # we cannot compare the whole file. with open(out_tbl, "r") as outt: lines = [line.strip() for line in outt.readlines()] - assert ">Feature H561_S27" in lines - assert ">Feature H561_S28" in lines - assert ">Feature H561_S29" in lines + # Check that there are 3 contigs + feature = 0 + for line in lines: + if 'Feature' in line: + feature += 1 + assert feature == 3 + # Check that there are 16 CDS CDS = 0 for line in lines: if "CDS" in line: @@ -566,7 +574,7 @@ def test_run_prokka_out_doesnt_exist_ok(): assert q.get().message == ("Prokka command: prokka " "--outdir test/data/annotate/generated_by_unit-tests/" "H299_H561.fasta-prokkaRes --cpus 2 --prefix test_runprokka_H299 " - "test/data/annotate/genomes/H299_H561.fasta") + "--centre prokka test/data/annotate/genomes/H299_H561.fasta") assert q.get().message.startswith("End annotating") @@ -592,6 +600,6 @@ def test_run_prokka_out_problem_running(): "--outdir test/data/annotate/generated_by_unit-tests/" "H299_H561bis.fasta-prokkaRes --cpus 2 " "--prefix test_runprokka_H299-error " - "test/data/annotate/genomes/H299_H561bis.fasta") + "--centre prokka test/data/annotate/genomes/H299_H561bis.fasta") assert q.get().message == ("Error while trying to run prokka on test_runprokka_H299-error " "from test/data/annotate/genomes/H299_H561bis.fasta") diff --git a/test/test_unit/test_annotate/test_format_func.py b/test/test_unit/test_annotate/test_format_func.py index 727db37dd7872e297e87bed4fe9d8ecc7997a2b3..d7f226238e867f06dd9b64bd848b6ebc12f5d3a2 100755 --- a/test/test_unit/test_annotate/test_format_func.py +++ b/test/test_unit/test_annotate/test_format_func.py @@ -35,7 +35,12 @@ def setup_teardown_module(): - remove directory with generated results """ # utils.init_logger(LOGFILE_BASE, 0, 'test_fastme', verbose=1) - os.mkdir(GENEPATH) + if os.path.isdir(GENEPATH): + content = os.listdir(GENEPATH) + for f in content: + assert f.startswith(".fuse") + else: + os.mkdir(GENEPATH) print("setup") yield