diff --git a/tests/integration_tests.py b/tests/integration_tests.py index 4d15e35..14eaa8e 100644 --- a/tests/integration_tests.py +++ b/tests/integration_tests.py @@ -22,15 +22,15 @@ def make_train_fasta(): def test_sourmash_sketch_command(): with tempfile.TemporaryDirectory() as tmp_dir: make_train_fasta() - + fasta_file = "example.fasta" output_file = os.path.join(tmp_dir, "training_database.sig.zip") cmd = [ "sourmash", "sketch", "dna", "-f", "-p", "k=31,scaled=1000,abund", "--singleton", fasta_file, "-o", output_file ] - + subprocess.run(cmd, check=True) - + assert os.path.isfile(output_file) def test_make_training_data_from_sketches(): @@ -63,11 +63,29 @@ def test_make_training_data_from_sketches(): config = json.load(f) assert config['ksize'] == int(ksize) assert config['ani_thresh'] == float(ani_thresh) - + def test_run_yacht(): cmd = "python run_YACHT.py --json gtdb_ani_thresh_0.95_config.json --sample_file 'tests/testdata/sample.sig.zip' --significance 0.99 --min_coverage_list 1 0.6 0.2 0.1" - + res = subprocess.run(cmd, shell=True, check=True) assert res.returncode == 0 assert exists('result.xlsx') + +def test_run_yacht_and_standardizer(): + cmd = "cd demo; sourmash sketch dna -f -p k=31,scaled=1000,abund -o sample.sig.zip query_data/query_data.fq" + res = subprocess.run(cmd, shell=True, check=True) + assert res.returncode == 0 + cmd = "cd demo; sourmash sketch fromfile ref_paths.csv -p dna,k=31,scaled=1000,abund -o ref.sig.zip --force-output-already-exists" + res = subprocess.run(cmd, shell=True, check=True) + assert res.returncode == 0 + cmd = "cd demo; python ../make_training_data_from_sketches.py --force --ref_file ref.sig.zip --ksize 31 --num_threads 1 --ani_thresh 0.95 --prefix 'demo_ani_thresh_0.95' --outdir ./" + res = subprocess.run(cmd, shell=True, check=True) + assert res.returncode == 0 + cmd = "cd demo; python ../run_YACHT.py --json demo_ani_thresh_0.95_config.json --sample_file sample.sig.zip --significance 0.99 --num_threads 1 --min_coverage_list 1 0.6 0.2 0.1 --out result.xlsx" + res = subprocess.run(cmd, shell=True, check=True) + assert res.returncode == 0 + cmd = "cd demo; python ../srcs/standardize_yacht_output.py --yacht_output result.xlsx --sheet_name min_coverage0.2 --genome_to_taxid toy_genome_to_taxid.tsv --mode cami --sample_name 'MySample' --outfile_prefix cami_result --outdir ./" + res = subprocess.run(cmd, shell=True, check=True) + assert res.returncode == 0 + assert exists('demo/cami_result.cami') diff --git a/tests/test_workflow.py b/tests/test_workflow.py index cb04531..6e7d927 100644 --- a/tests/test_workflow.py +++ b/tests/test_workflow.py @@ -84,4 +84,4 @@ def test_demo_workflow(): cmd = "cd demo; python ../srcs/standardize_yacht_output.py --yacht_output result.xlsx --sheet_name min_coverage0.2 --genome_to_taxid toy_genome_to_taxid.tsv --mode cami --sample_name 'MySample' --outfile_prefix cami_result --outdir ./" res = subprocess.run(cmd, shell=True, check=True) assert res.returncode == 0 - assert exists('./cami_result.cami') + assert exists('demo/cami_result.cami')