Skip to content
Snippets Groups Projects
Commit 0832c2dc authored by Amandine  PERRIN's avatar Amandine PERRIN
Browse files

Always get uniq contig IDs with prokka

use --centre prokka option
parent 6c222a51
No related branches found
No related tags found
No related merge requests found
Pipeline #39401 passed
...@@ -258,7 +258,7 @@ def run_prokka(arguments): ...@@ -258,7 +258,7 @@ def run_prokka(arguments):
# - if outdir exists exists but force, remove this outdir. # - if outdir exists exists but force, remove this outdir.
# So, outdir does not exist -> run prokka # So, outdir does not exist -> run prokka
cmd = (f"prokka --outdir {prok_dir} --cpus {threads} " 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}") error = (f"Error while trying to run prokka on {name} from {gpath}")
logger.details("Prokka command: " + cmd) logger.details("Prokka command: " + cmd)
prokf = open(prok_logfile, "w") prokf = open(prok_logfile, "w")
......
...@@ -490,9 +490,13 @@ def test_run_prokka_out_exists_force(): ...@@ -490,9 +490,13 @@ def test_run_prokka_out_exists_force():
# we cannot compare the whole file. # we cannot compare the whole file.
with open(out_tbl, "r") as outt: with open(out_tbl, "r") as outt:
lines = [line.strip() for line in outt.readlines()] lines = [line.strip() for line in outt.readlines()]
assert ">Feature H561_S27" in lines # Check that there are 3 contigs
assert ">Feature H561_S28" in lines feature = 0
assert ">Feature H561_S29" in lines for line in lines:
if 'Feature' in line:
feature += 1
assert feature == 3
# Check that there are 16 CDS
CDS = 0 CDS = 0
for line in lines: for line in lines:
if "CDS" in line: if "CDS" in line:
...@@ -512,7 +516,7 @@ def test_run_prokka_out_exists_force(): ...@@ -512,7 +516,7 @@ def test_run_prokka_out_exists_force():
assert q.get().message == ("Prokka command: prokka " assert q.get().message == ("Prokka command: prokka "
"--outdir test/data/annotate/generated_by_unit-tests/" "--outdir test/data/annotate/generated_by_unit-tests/"
"H299_H561.fasta-prokkaRes --cpus 2 --prefix test_runprokka_H299 " "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 " assert q.get() .message.startswith("End annotating test_runprokka_H299 "
"from test/data/annotate/genomes/H299_H561.fasta") "from test/data/annotate/genomes/H299_H561.fasta")
...@@ -547,9 +551,13 @@ def test_run_prokka_out_doesnt_exist_ok(): ...@@ -547,9 +551,13 @@ def test_run_prokka_out_doesnt_exist_ok():
# we cannot compare the whole file. # we cannot compare the whole file.
with open(out_tbl, "r") as outt: with open(out_tbl, "r") as outt:
lines = [line.strip() for line in outt.readlines()] lines = [line.strip() for line in outt.readlines()]
assert ">Feature H561_S27" in lines # Check that there are 3 contigs
assert ">Feature H561_S28" in lines feature = 0
assert ">Feature H561_S29" in lines for line in lines:
if 'Feature' in line:
feature += 1
assert feature == 3
# Check that there are 16 CDS
CDS = 0 CDS = 0
for line in lines: for line in lines:
if "CDS" in line: if "CDS" in line:
...@@ -566,7 +574,7 @@ def test_run_prokka_out_doesnt_exist_ok(): ...@@ -566,7 +574,7 @@ def test_run_prokka_out_doesnt_exist_ok():
assert q.get().message == ("Prokka command: prokka " assert q.get().message == ("Prokka command: prokka "
"--outdir test/data/annotate/generated_by_unit-tests/" "--outdir test/data/annotate/generated_by_unit-tests/"
"H299_H561.fasta-prokkaRes --cpus 2 --prefix test_runprokka_H299 " "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") assert q.get().message.startswith("End annotating")
...@@ -592,6 +600,6 @@ def test_run_prokka_out_problem_running(): ...@@ -592,6 +600,6 @@ def test_run_prokka_out_problem_running():
"--outdir test/data/annotate/generated_by_unit-tests/" "--outdir test/data/annotate/generated_by_unit-tests/"
"H299_H561bis.fasta-prokkaRes --cpus 2 " "H299_H561bis.fasta-prokkaRes --cpus 2 "
"--prefix test_runprokka_H299-error " "--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 " assert q.get().message == ("Error while trying to run prokka on test_runprokka_H299-error "
"from test/data/annotate/genomes/H299_H561bis.fasta") "from test/data/annotate/genomes/H299_H561bis.fasta")
...@@ -35,7 +35,12 @@ def setup_teardown_module(): ...@@ -35,7 +35,12 @@ def setup_teardown_module():
- remove directory with generated results - remove directory with generated results
""" """
# utils.init_logger(LOGFILE_BASE, 0, 'test_fastme', verbose=1) # 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") print("setup")
yield yield
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment