aboutsummaryrefslogtreecommitdiff
path: root/src/score_mers.py
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-04-01 13:24:44 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2014-04-01 13:24:44 -0400
commit2a1793992786fbc584d654d4fff6a6a698d32c33 (patch)
tree12679b839ad650161116a6c1c70bbfbc2f885e02 /src/score_mers.py
parent4c91abcd4097ea2919a25c60c6d05d72d24a839e (diff)
check exit status and more error checking in check_feasilbe
Diffstat (limited to 'src/score_mers.py')
-rwxr-xr-xsrc/score_mers.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/score_mers.py b/src/score_mers.py
index be09d9b..71cf5d5 100755
--- a/src/score_mers.py
+++ b/src/score_mers.py
@@ -120,6 +120,9 @@ def populate_locations(selected_mers, mer_dic, input_fn):
(mer, pos) = line.split(" ")
mer_dic[selected_mers[int(mer)]].append(int(pos))
+ if strstream.wait() is not 0:
+ print "executing", cmd, "failed"
+
merlist_fh.close()
@@ -139,6 +142,10 @@ def load_end_points(fn):
for line in points_fh.stdout:
end_points.append(int(line))
+
+ if points_fh.wait() is not 0:
+ print "executing", cmd, "failed"
+
return end_points
def get_length(fn):
@@ -149,12 +156,16 @@ def get_length(fn):
if debug:
print "loading sequence end points"
print "executing: " + cmd
- points_fh = Popen(cmd, stdout=PIPE, shell=True)
+ grep = Popen(cmd, stdout=PIPE, shell=True)
- length = points_fh.stdout.readline()
+ length = grep.stdout.readline()
length = int(length)
+ if grep.wait() is not 0:
+ print "executing", cmd, "failed"
+
+
return length
def load_heterodimer_dic(selected_mers):
@@ -176,9 +187,16 @@ def load_heterodimer_dic(selected_mers):
def check_feasible(selected):
total = 0
for mer in selected:
+ print mer
total += len(fg_mers[mer])
+
+ if total is 0:
+ print "something went wrong, no mers found in the foreground. Consider this a bug!"
+ print fg_mers
+ exit()
+
if (fg_genome_length / (total + 1 )) > max_mer_distance:
- print "even if we select all top ", max_select,
+ print "even if we select all top", max_select, "of", total
print "mers disregarding any critera, and they were perfectly evenly spaced we would ",
print "still not meet the right max mer distance < ", max_mer_distance, "requirement."