diff --git a/test/data/prepare/exp_files/exp_lstinfo_run_only-mash.lst b/test/data/prepare/exp_files/exp_lstinfo_run_only-mash.lst new file mode 100644 index 0000000000000000000000000000000000000000..9015579eab1bb2a3be840ad65b2ef0064b6ff15b --- /dev/null +++ b/test/data/prepare/exp_files/exp_lstinfo_run_only-mash.lst @@ -0,0 +1,2 @@ +to_annotate gsize nb_conts L90 +test/data/prepare/genomes/genomes_comparison/ACOC.1019.fna 3050 1 1 diff --git a/test/data/prepare/test_files/test_lstinfo_onlymash.lst b/test/data/prepare/test_files/test_lstinfo_onlymash.lst new file mode 100644 index 0000000000000000000000000000000000000000..3265e38399a7d1b5804e4943c11f3f021cf6e657 --- /dev/null +++ b/test/data/prepare/test_files/test_lstinfo_onlymash.lst @@ -0,0 +1,6 @@ +to_annotate gsize nb_conts L90 +test/data/prepare/genomes/genomes_comparison/ACOC.1019.fna 3050 1 1 +test/data/prepare/genomes/genomes_comparison/ACOR002.0519.fna 3012665 78 17 +test/data/prepare/genomes/genomes_comparison/ACOR001.0519-almost-same.fna 3012665 261 17 +test/data/prepare/genomes/genomes_comparison/ACOR001.0519.fna 3012665 269 17 +test/data/prepare/genomes/genomes_comparison/ACOR001.0519-bis.fna 3012665 269 17 diff --git a/test/test_functional/test_prepare.py b/test/test_functional/test_prepare.py index 449303017e69ac49c83566faabc290002a0b224e..f60f3d72d21359aeb51556ba11eae2143dab3eaf 100644 --- a/test/test_functional/test_prepare.py +++ b/test/test_functional/test_prepare.py @@ -440,3 +440,48 @@ def test_main_norefseq_givendbdir(capsys): tmp_files = glob.glob(os.path.join(GENEPATH, "tmp_files", "*.fna_prepare-split2N.fna")) assert len(tmp_files) == 5 + +def test_only_mash(capsys): + """ + Running only mash step (giving genomes and corresponding LSTINFO file) + """ + NCBI_species = "" + NCBI_taxid = "" + levels = "" + outdir = GENEPATH + tmp_dir = "" + threads = 1 + no_refseq = False + db_dir = "" + only_mash = True + info_file = os.path.join(TEST_DIR, "test_lstinfo_onlymash.lst") + l90 = 100 + nbcont = 999 + cutn = 5 + min_dist = 1e-4 + max_dist = 0.06 + verbose = 1 + quiet = False + prepare.main("cmd", NCBI_species, NCBI_taxid, levels, outdir, tmp_dir, threads, no_refseq, + db_dir, only_mash, info_file, l90, nbcont, cutn, min_dist, max_dist, + verbose, quiet) + out, err = capsys.readouterr() + assert ("You asked to run only mash steps") in err + assert ("You want to run only mash steps. Getting information from " + "test/data/prepare/test_files/test_lstinfo_onlymash.lst") in out + assert ("Found 5 genomes in total") in out + assert ("Computing pairwise distances between all genomes") in out + assert ("Sorting all 5 genomes by quality") in out + assert ("Final number of genomes in dataset: 1") in out + + # Check output files + assert len(os.listdir(os.path.join(outdir, "tmp_files"))) == 0 + # Check logfiles are here + log_files = glob.glob(os.path.join(outdir, "*log*")) + assert len(log_files) == 3 + # Check content of output lstinfo file + out_lst = os.path.join(outdir, "LSTINFO-NA-filtered-0.0001_0.06.txt") + exp_lst = os.path.join(DBDIR, "exp_files", "exp_lstinfo_run_only-mash.lst") + assert tutil.compare_order_content(out_lst, exp_lst) + +