From f363df2ac34c34b1c2f223bb5a81c456a764ac38 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Fri, 21 Mar 2014 13:42:54 -0400 Subject: add end of sequences in as points in our array --- src/score_mers.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/score_mers.py') diff --git a/src/score_mers.py b/src/score_mers.py index 6f0c6db..5c1a194 100755 --- a/src/score_mers.py +++ b/src/score_mers.py @@ -15,6 +15,8 @@ import pdb fg_mers = {} bg_mers = {} +seq_ends = [] + if(len(sys.argv) == 5): selectivity_fn = sys.argv[1] fg_fasta_fn = sys.argv[2] @@ -181,8 +183,13 @@ def score(combination): for mer in combination: fg_pts = fg_pts + fg_mers[mer].pts + fg_pts = fg_pts + seq_ends + fg_pts.sort() + if fg_pts[0] is not 0: + fg_pts = [0] + fg_pts + # fg distances fg_dist = np.diff(fg_pts) @@ -221,6 +228,18 @@ def score(combination): return [combination, score, fg_mean_dist, fg_std_dist, bg_ratio] +def load_end_points(fn): + + end_points = [] + + cmd = "sequence_end_points < " + fn + + points_fh = Popen(cmd, stdout=PIPE, shell=True) + for line in points_fh.stdout: + end_points.append(int(line)) + + return end_points + def load_heterodimer_dic(selected_mers): ''' Generate a heterodimer dict which contains every possible combination of @@ -265,6 +284,8 @@ def main(): selected_mers = [row[0] for row in selected] # print selected_mers + print "Populating sequence end points" + seq_ends = load_end_points(fg_fasta_fn) print "Populating foreground locations" map(pop_fg, selected_mers) -- cgit v1.2.3