Skip to content

Commit

Permalink
fixes #40 by adding a slight modification of the demo script
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoslicki committed Oct 18, 2023
1 parent 4321efe commit 91cb8e8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ cd demo

# build k-mer sketches for the query sample and ref genomes
sourmash sketch dna -f -p k=31,scaled=1000,abund -o sample.sig.zip query_data/query_data.fq
sourmash sketch fromfile ref_paths.csv -p dna,k=31,scaled=1000,abund -o ref.sig.zip
sourmash sketch fromfile ref_paths.csv -p dna,k=31,scaled=1000,abund -o ref.sig.zip --force-output-already-exists

# preprocess the reference genomes (training step)
python ../make_training_data_from_sketches.py --ref_file ref.sig.zip --ksize 31 --num_threads ${NUM_THREADS} --ani_thresh 0.95 --prefix 'demo_ani_thresh_0.95' --outdir ./
python ../make_training_data_from_sketches.py --ref_file ref.sig.zip --ksize 31 --num_threads ${NUM_THREADS} --ani_thresh 0.95 --prefix 'demo_ani_thresh_0.95' --outdir ./ --force

# run YACHT algorithm to check the presence of reference genomes in the query sample (inference step)
python ../run_YACHT.py --json demo_ani_thresh_0.95_config.json --sample_file sample.sig.zip --significance 0.99 --num_threads ${NUM_THREADS} --min_coverage_list 1 0.6 0.2 0.1 --outdir ./
python ../run_YACHT.py --json demo_ani_thresh_0.95_config.json --sample_file sample.sig.zip --significance 0.99 --num_threads ${NUM_THREADS} --min_coverage_list 1 0.6 0.2 0.1 --out_filename result.xlsx

# convert result to CAMI profile format (Optional)
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 ./
Expand Down
2 changes: 1 addition & 1 deletion run_YACHT.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
if os.access(os.path.abspath(os.path.dirname(out_filename)), os.W_OK):
pass
else:
raise FileNotFoundError(f"Cannot write to the location: {out_filename}.")
raise FileNotFoundError(f"Cannot write to the location: {os.path.abspath(os.path.dirname(out_filename))}.")

# check if min_coverage is between 0 and 1
for x in min_coverage_list:
Expand Down
15 changes: 12 additions & 3 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,16 @@ def test_incorrect_workflow1():
assert res.returncode == 1


def test_incorrect_workflow2():
script_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
demo_dir = os.path.join(script_dir, "demo")
def test_demo_workflow():
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)
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)
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)
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_filename result.xlsx"
res = subprocess.run(cmd, shell=True, check=True)
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)


0 comments on commit 91cb8e8

Please sign in to comment.