aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-05-20 18:23:10 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2014-05-20 18:23:10 -0400
commit4b392a3fd57fb8702756c56a790e8b75c7d58a4c (patch)
tree23747a55f45d643f489c71c16557fff4a0f7a44a
parent9778dc04e2843e9ab71f59031ed7d755515795d0 (diff)
score regardless
-rwxr-xr-xsrc/score_mers.py44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/score_mers.py b/src/score_mers.py
index 865ac24..9d90ae2 100755
--- a/src/score_mers.py
+++ b/src/score_mers.py
@@ -251,7 +251,7 @@ def score_specific_combinations(mers):
fh = open(output_file, 'wb')
write_header(fh)
- score_it = p.map(score, mers)
+ score_it = p.map(score_no_check, mers)
for score_res in score_it:
if type(score_res) is list:
total_scored += 1
@@ -363,6 +363,48 @@ def score(combination):
return [combination, mer_score, fg_mean_dist, fg_std_dist, bg_ratio]
+def score_no_check(combination):
+ # input is a string of mers like
+ # ['ACCAA', 'ACCCGA', 'ACGTATA']
+
+ # fg points
+ fg_pts = []
+ fg_dist = []
+
+ for mer in combination:
+ fg_pts = fg_pts + fg_mers[mer]
+
+ 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)
+
+ # bg counts
+ bg_counts = 0
+
+ for mer in combination:
+ bg_counts += bg_mers[mer]
+
+ if bg_counts <= 1:
+ bg_counts = 1
+
+ bg_ratio = (bg_genome_length / bg_counts)
+
+ nb_primers = len(combination)
+ fg_mean_dist = np.mean(fg_dist)
+ fg_std_dist = np.std(fg_dist)
+
+ # this is our equation
+ exec score_func
+
+ return [combination, mer_score, fg_mean_dist, fg_std_dist, bg_ratio]
+
+
def initialize_mers(foreground, background, load_background=True):
print "Calculating heterodimer distances"