summaryrefslogtreecommitdiff
path: root/src/python/quikr.py
diff options
context:
space:
mode:
authormutantturkey <mutantturke@gmail.com>2013-03-16 17:41:32 -0400
committermutantturkey <mutantturke@gmail.com>2013-03-16 17:41:32 -0400
commita5918b4422a4f21505f25517a0e505e1bff0e81b (patch)
tree2e1f72b004a9485d6c537a805339780d80ba5093 /src/python/quikr.py
parentbb810d85d92648d5cc812891dc8ca90b5fe4aa7a (diff)
add return code checking
Diffstat (limited to 'src/python/quikr.py')
-rwxr-xr-xsrc/python/quikr.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/python/quikr.py b/src/python/quikr.py
index a756e6c..857cd25 100755
--- a/src/python/quikr.py
+++ b/src/python/quikr.py
@@ -57,6 +57,9 @@ def train_matrix(input_file_location, kmer):
"""
input_file = Popen(["bash", "-c", "probabilities-by-read " + str(kmer) + " " + input_file_location + " <(generate_kmers 6)"], stdout=PIPE)
+ input_file.poll()
+ if input_file.returncode != 0:
+ raise ValueError, "probbilties-by-read did not execute properly"
# load and normalize the matrix by dividing each element by the sum of it's column.
# also do some fancy rotations so that it works properly with quikr
@@ -97,7 +100,11 @@ def calculate_estimated_frequencies(input_fasta_location, trained_matrix, kmer,
"""
# We use the count program to count
+
count_input = Popen(["count-kmers", "-r", str(kmer), "-1", "-u", input_fasta_location], stdout=PIPE)
+ count_input.poll()
+ if count_input.returncode != 0:
+ raise ValueError, "count-kmers did not execute properly"
# load the output of our count program and form a probability vector from the counts
counts = np.loadtxt(count_input.stdout)