From 2a1793992786fbc584d654d4fff6a6a698d32c33 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Tue, 1 Apr 2014 13:24:44 -0400 Subject: check exit status and more error checking in check_feasilbe --- src/score_mers.py | 24 +++++++++++++++++++++--- 1 file 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." -- cgit v1.2.3