Skip to content

Commit

Permalink
added assertions, fixed path
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmudhera committed Nov 10, 2023
1 parent c4c0926 commit 070a6de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
28 changes: 23 additions & 5 deletions tests/integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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')
2 changes: 1 addition & 1 deletion tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit 070a6de

Please sign in to comment.