1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
|
Description: modify the test python files to use binaries in /usr/bin
Author: Shayan Doust <hello@shayandoust.me>
Last-Update: 2019-09-13
---
--- a/tests/simkaMin/test_simkaMin.py
+++ b/tests/simkaMin/test_simkaMin.py
@@ -16,28 +16,28 @@ NB_CORES = [1, 0]
def create_command(scriptFilename, outputPrefix, k, filter, nb_reads, nb_kmers, nb_cores, input_filename):
outputDir = "k" + str(k) + "_" + filter.replace("-", "") + "_" + str(nb_reads) + "-" + str(nb_kmers) + "_n" + str(nb_cores)
- command = "python " + scriptFilename
+ command = "python3 " + scriptFilename
command += " -in " + input_filename
command += " -out " + outputPrefix + "/" + outputDir
command += " -nb-cores " + str(nb_cores)
command += " -max-memory 100 "
command += " -kmer-size " + str(k)
command += " -nb-kmers " + str(nb_kmers)
- command += " -bin ../../build/bin/simkaMinCore "
+ command += " -bin simkaMinCore "
command += " -max-reads " + str(nb_reads)
command += " " + filter + " "
return command, outputDir
def create_command_update(scriptFilename, outputPrefix, k, filter, nb_reads, nb_kmers, nb_cores, input_filename):
outputDir = "k" + str(k) + "_" + filter.replace("-", "") + "_" + str(nb_reads) + "-" + str(nb_kmers) + "_n" + str(nb_cores)
- command = "python " + scriptFilename
+ command = "python3 " + scriptFilename
command += " -in " + input_filename
command += " -in-to-update " + outputPrefix + "/" + outputDir + "/simkamin"
command += " -nb-cores " + str(nb_cores)
command += " -max-memory 100 "
#command += " -kmer-size " + str(k)
#command += " -nb-kmers " + str(nb_kmers)
- command += " -bin ../../build/bin/simkaMinCore "
+ command += " -bin simkaMinCore "
command += " -max-reads " + str(nb_reads)
command += " " + filter + " "
return command, outputDir
@@ -48,7 +48,7 @@ def create_truth():
for nb_reads in NB_READS:
for nb_kmers in NB_KMERS:
for nb_cores in NB_CORES:
- command, outputDir = create_command("../../simkaMin/simkaMin.py", "truth_simkaMin_symetrical", k, filter, nb_reads, nb_kmers, nb_cores, " ../../example/simka_input.txt ")
+ command, outputDir = create_command("simkaMin.py", "truth_simkaMin_symetrical", k, filter, nb_reads, nb_kmers, nb_cores, " ../../example/simka_input.txt ")
print (command)
ret = os.system(command)
if ret != 0: exit(1)
@@ -146,7 +146,7 @@ def test():
for nb_reads in NB_READS:
for nb_kmers in NB_KMERS:
for nb_cores in NB_CORES:
- command, outputDir = create_command("../../simkaMin/simkaMin.py", dir, k, filter, nb_reads, nb_kmers, nb_cores, " ../../example/simka_input.txt ")
+ command, outputDir = create_command("simkaMin", dir, k, filter, nb_reads, nb_kmers, nb_cores, " ../simka_input.txt ")
print (command)
ret = os.system(command + suffix)
if ret != 0: exit(1)
@@ -166,25 +166,25 @@ def test_append():
os.mkdir(out_dir)
merged_sketch_filename = os.path.join(out_dir, "merged_sketch.bin")
- filename = "../../example/simka_input.txt"
+ filename = "../simka_input.txt"
for line in open(filename):
line = line.strip()
if len(line) == 0: continue
- filename_temp = os.path.join("../../example/test_simkaMin_input_temp.txt")
+ filename_temp = os.path.join("../test_simkaMin_input_temp.txt")
f = open(filename_temp, "w")
f.write(line)
f.close()
sketch_filename = os.path.join(out_dir, "sketch.bin")
- command = "../../build/bin/simkaMinCore sketch -in " + filename_temp + " -out " + sketch_filename + " -nb-kmers 100 -kmer-size 21 -nb-cores 4"
+ command = "simkaMinCore sketch -in " + filename_temp + " -out " + sketch_filename + " -nb-kmers 100 -kmer-size 21 -nb-cores 4"
print(command)
ret = os.system(command + suffix)
if ret != 0: exit(1)
if os.path.exists(merged_sketch_filename):
- command = "../../build/bin/simkaMinCore append -in1 " + merged_sketch_filename + " -in2 " + sketch_filename
+ command = "simkaMinCore append -in1 " + merged_sketch_filename + " -in2 " + sketch_filename
print(command)
ret = os.system(command + suffix)
if ret != 0: exit(1)
@@ -194,12 +194,12 @@ def test_append():
os.remove(filename_temp)
- command = "../../build/bin/simkaMinCore distance -in1 " + merged_sketch_filename + " -in2 " + merged_sketch_filename + " -out " + dir + " -nb-cores 4 "
+ command = "simkaMinCore distance -in1 " + merged_sketch_filename + " -in2 " + merged_sketch_filename + " -out " + dir + " -nb-cores 4 "
print(command)
ret = os.system(command + suffix)
if ret != 0: exit(1)
- command = "../../build/bin/simkaMinCore export -in " + dir + " -in1 " + merged_sketch_filename + " -in2 " + merged_sketch_filename + " -out " + dir
+ command = "simkaMinCore export -in " + dir + " -in1 " + merged_sketch_filename + " -in2 " + merged_sketch_filename + " -out " + dir
print(command)
ret = os.system(command + suffix)
if ret != 0: exit(1)
@@ -223,10 +223,10 @@ def test_matrix_update():
clear(out_dir)
os.mkdir(out_dir)
- filename = "../../example/simka_input.txt"
- filename_temp1 = os.path.join("../../example/test_simkaMin_input_temp1.txt")
+ filename = "../simka_input.txt"
+ filename_temp1 = os.path.join("../test_simkaiMin_input_temp1.txt")
f1 = open(filename_temp1, "w")
- filename_temp2 = os.path.join("../../example/test_simkaMin_input_temp2.txt")
+ filename_temp2 = os.path.join("../test_simkaMin_input_temp2.txt")
f2 = open(filename_temp2, "w")
N=2 #where to split the file
i=0
@@ -241,13 +241,13 @@ def test_matrix_update():
f2.close()
# init
- command, outputDir = create_command("../../simkaMin/simkaMin.py", out_dir, 21, "", 0, 100, 4, filename_temp1)
+ command, outputDir = create_command("simkaMin.py", out_dir, 21, "", 0, 100, 4, filename_temp1)
print(command)
ret = os.system(command + suffix)
if ret != 0: exit(1)
# update
- command, outputDir = create_command_update("../../simkaMin/simkaMin_update.py", out_dir, 21, "", 0, 100, 4, filename_temp2)
+ command, outputDir = create_command_update("simkaMin_update.py", out_dir, 21, "", 0, 100, 4, filename_temp2)
print(command)
ret = os.system(command + suffix)
if ret != 0: exit(1)
--- a/tests/simple_test.py
+++ b/tests/simple_test.py
@@ -91,7 +91,7 @@ def test_parallelization():
#test k=31 t=0
clear()
print("TESTING k=31 t=0")
-command = "../build/bin/simka -in ../example/simka_input.txt -out ./__results__/results_k31_t0 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 31 -abundance-min 0 -verbose 0"
+command = "simka -in simka_input.txt -out ./__results__/results_k31_t0 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 31 -abundance-min 0 -verbose 0"
print(command)
os.system(command + suffix)
test_dists("results_k31_t0")
@@ -99,7 +99,7 @@ test_dists("results_k31_t0")
#test k=21 t=0
clear()
print("TESTING k=21 t=0")
-command = "../build/bin/simka -in ../example/simka_input.txt -out ./__results__/results_k21_t0 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 21 -abundance-min 0 -verbose 0"
+command = "simka -in simka_input.txt -out ./__results__/results_k21_t0 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 21 -abundance-min 0 -verbose 0"
print(command)
os.system(command + suffix)
test_dists("results_k21_t0")
@@ -107,7 +107,7 @@ test_dists("results_k21_t0")
#test k=31 t=2
clear()
print("TESTING k=31 t=2")
-command = "../build/bin/simka -in ../example/simka_input.txt -out ./__results__/results_k31_t2 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 31 -abundance-min 2 -verbose 0"
+command = "simka -in simka_input.txt -out ./__results__/results_k31_t2 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 31 -abundance-min 2 -verbose 0"
print(command)
os.system(command + suffix)
test_dists("results_k31_t2")
@@ -115,7 +115,7 @@ test_dists("results_k31_t2")
#test k=21 t=2
clear()
print("TESTING k=21 t=2")
-command = "../build/bin/simka -in ../example/simka_input.txt -out ./__results__/results_k21_t2 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 21 -abundance-min 2 -verbose 0"
+command = "simka -in simka_input.txt -out ./__results__/results_k21_t2 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 21 -abundance-min 2 -verbose 0"
print(command)
os.system(command + suffix)
test_dists("results_k21_t2")
@@ -123,9 +123,9 @@ test_dists("results_k21_t2")
#test resources 1
clear()
print("TESTING parallelization")
-command = "../build/bin/simka -in ../example/simka_input.txt -out ./__results__/results_resources1 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 21 -abundance-min 0 -nb-cores 20 -max-memory 4000 -verbose 0"
+command = "simka -in simka_input.txt -out ./__results__/results_resources1 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 21 -abundance-min 0 -nb-cores 20 -max-memory 4000 -verbose 0"
os.system(command + suffix)
-command = "../build/bin/simka -in ../example/simka_input.txt -out ./__results__/results_resources2 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 21 -abundance-min 0 -nb-cores 2 -max-memory 2000 -verbose 0"
+command = "simka -in simka_input.txt -out ./__results__/results_resources2 -out-tmp ./temp_output -simple-dist -complex-dist -kmer-size 21 -abundance-min 0 -nb-cores 2 -max-memory 2000 -verbose 0"
os.system(command + suffix)
test_parallelization()
--- a/example/simple_test.sh
+++ b/example/simple_test.sh
@@ -4,16 +4,7 @@ ADDITIONAL_SIMKA_OPTIONS=$*
# look for simka binary. In devel mode, it's in ../build/bin directory.
# In production mode, it's in ../bin directory.
-if [ -f "../bin/simka" ]
-then
- bindir="../bin"
-elif [ -f "../build/bin/simka" ]
-then
- bindir="../build/bin"
-else
- echo "could not find a compiled simka binary"
- exit 1
-fi
+bindir="/usr/bin"
# run simka
command="$bindir/simka -in ../example/simka_input.txt -out ./simka_results/ -out-tmp ./simka_temp_output $ADDITIONAL_SIMKA_OPTIONS"
|