Skip to content

Commit

Permalink
attempting to debug issues with KMC stuff for #15, so creating a new …
Browse files Browse the repository at this point in the history
…branch since a lot will get messed up.
  • Loading branch information
dkoslicki committed Mar 31, 2020
1 parent 8ec7889 commit 1af1b2d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
16 changes: 8 additions & 8 deletions CMash/Query.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ def count_training_kmers(self):

# count the training k-mers
if self.verbose:
res = subprocess.run(f"{self.kmc} -v -k{self.ksize} -fa -ci1 -t{self.threads} {self.cmashDump} {out_path} .", shell=True)
res = subprocess.run(f"{self.kmc} -v -k{self.ksize} -fa -ci0 -cs3 -t{self.threads} {self.cmashDump} {out_path} .", shell=True)
else:
res = subprocess.run(f"{self.kmc} -v -k{self.ksize} -fa -ci1 -t{self.threads} {self.cmashDump} {out_path} .", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
res = subprocess.run(f"{self.kmc} -v -k{self.ksize} -fa -ci0 -cs3 -t{self.threads} {self.cmashDump} {out_path} .", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if res.returncode != 0:
raise Exception(f"The command {res.args} failed to run and returned the returncode={res.returncode}")

Expand All @@ -250,9 +250,9 @@ def count_input_kmers(self):
#count kmers in the input sample (not the training db)
# TODO: will need to try with/without -fm if type_arg == '-fa'
if self.verbose:
res = subprocess.run(f"{self.kmc} -v -k{self.ksize} {type_arg} -ci1 -t{self.threads} -fm {self.reads_path} {out_path} {self.temp_dir}", shell=True)
res = subprocess.run(f"{self.kmc} -v -k{self.ksize} {type_arg} -ci0 -cs3 -t{self.threads} -fm {self.reads_path} {out_path} {self.temp_dir}", shell=True)
else:
res = subprocess.run(f"{self.kmc} -v -k{self.ksize} {type_arg} -ci1 -t{self.threads} -fm {self.reads_path} {out_path} {self.temp_dir}", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
res = subprocess.run(f"{self.kmc} -v -k{self.ksize} {type_arg} -ci0 -cs3 -t{self.threads} -fm {self.reads_path} {out_path} {self.temp_dir}", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if res.returncode != 0:
raise Exception(f"The command {res.args} failed to run and returned the returncode={res.returncode}")

Expand All @@ -275,9 +275,9 @@ def intersect(self):

# intersect kmers
if self.verbose:
res = subprocess.run(f"{self.kmc_tools} simple {db_kmers_loc} {in_path} intersect {out_path}", shell=True)
res = subprocess.run(f"{self.kmc_tools} simple {db_kmers_loc} {in_path} -ci0 intersect {out_path} -ci0 ", shell=True)
else:
res = subprocess.run(f"{self.kmc_tools} simple {db_kmers_loc} {in_path} intersect {out_path}", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
res = subprocess.run(f"{self.kmc_tools} simple {db_kmers_loc} {in_path} -ci0 intersect {out_path} -ci0 ", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if res.returncode != 0:
raise Exception(f"The command {res.args} failed to run and returned the returncode={res.returncode}")

Expand All @@ -286,9 +286,9 @@ def intersect(self):
if self.verbose:
print("dumping intersection to FASTA file")
if self.verbose:
res = subprocess.run(f"{self.kmc_dump} {out_path} {dump_path}", shell=True)
res = subprocess.run(f"{self.kmc_dump} -ci0 {out_path} {dump_path}", shell=True)
else:
res = subprocess.run(f"{self.kmc_dump} {out_path} {dump_path}", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
res = subprocess.run(f"{self.kmc_dump} -ci0 {out_path} {dump_path}", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if res.returncode != 0:
raise Exception(f"The command {res.args} failed to run and returned the returncode={res.returncode}")

Expand Down
2 changes: 1 addition & 1 deletion scripts/StreamingQueryDNADatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def map_func(sequence):
if args.intersect:
intersecter = Intersect(query_file, training_database_file)
intersecter.compute_intersection()
print("intersection located at: {}".format(intersecter.out_file))
#print("intersection located at: {}".format(intersecter.out_file))
# change query file to the intersection file
query_file = intersecter.out_file
# Open the file to prepare for processing
Expand Down
12 changes: 7 additions & 5 deletions tests/script_tests/run_small_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fi
echo "Classifying sample, sensitive settings"
rm results.csv 2> /dev/null
# make a streaming pre-filter
/usr/bin/time python ${scriptsDir}/StreamingQueryDNADatabase.py ${testOrganism} TrainingDatabase.h5 results.csv 10-21-2 --sensitive
/usr/bin/time python ${scriptsDir}/StreamingQueryDNADatabase.py ${testOrganism} TrainingDatabase.h5 results.csv 10-21-1 --sensitive
if test -f results.csv; then
echo "sensitive classify successful"
cat results.csv
Expand All @@ -50,7 +50,7 @@ else
exit 1
fi


: << 'END1'
echo "Classifying sample, specific settings"
rm results.csv 2> /dev/null
# make a streaming pre-filter
Expand All @@ -62,13 +62,14 @@ else
echo "SOMETHING WENT WRONG!!!!"
exit 1
fi
END1

# intersection tests

echo "Classifying sample, sensitive settings, with KMC intersect"
rm results.csv 2> /dev/null
# make a streaming pre-filter
/usr/bin/time python ${scriptsDir}/StreamingQueryDNADatabase.py ${testOrganism} TrainingDatabase.h5 results.csv 10-21-2 --sensitive --intersect
/usr/bin/time python ${scriptsDir}/StreamingQueryDNADatabase.py ${testOrganism} TrainingDatabase.h5 results.csv 10-21-1 --sensitive --intersect
if test -f results.csv; then
echo "sensitive classify successful"
cat results.csv
Expand All @@ -77,7 +78,7 @@ else
exit 1
fi


: << 'END'
echo "Classifying sample, specific settings, with KMC intersect"
rm results.csv 2> /dev/null
# make a streaming pre-filter
Expand All @@ -88,4 +89,5 @@ if test -f results.csv; then
else
echo "SOMETHING WENT WRONG!!!!"
exit 1
fi
fi
END

0 comments on commit 1af1b2d

Please sign in to comment.