aboutsummaryrefslogtreecommitdiff
path: root/src/score_mers.py
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-03-13 17:07:06 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2014-03-13 17:07:06 -0400
commit787a2341063bf08f50e7cd0e5b3afe797d33259a (patch)
tree06322db1dba3a313a0a058874306c0dbc5185894 /src/score_mers.py
parentef7dcd12e5cffc5d0a38d61e4825cc2d8db959c4 (diff)
add comments, add workflow explaination, move pop_{fg,bg} fns
Diffstat (limited to 'src/score_mers.py')
-rwxr-xr-xsrc/score_mers.py40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/score_mers.py b/src/score_mers.py
index 8cbf064..9ea9d4a 100755
--- a/src/score_mers.py
+++ b/src/score_mers.py
@@ -80,9 +80,23 @@ def get_max_consecutive_binding(mer1, mer2):
return max_bind
+def pop_fg(mer):
+ ''' helper for map function '''
+ populate_locations(fg_fasta_fn, fg_mers, mer)
+
+def pop_bg(mer):
+ ''' helper for map function '''
+ populate_locations(bg_fasta_fn, bg_mers, mer)
+
+
def populate_locations(input_fn, mers, mer):
- ''' Run the strstreamone command, and parse in the integers that are output
- by the command, and add it to mers[mer].pts
+ '''
+ Run the strstreamone command, and parse in the integers that are output
+ by the command, and add it to mers[mer].pts
+
+ strstreamone just prints the location of a string argv[1] in stdout.
+
+ We also do the reverse compliment, using tac and tr piped together.
'''
cmd = 'strstreamone ' + mer + " < " + input_fn
@@ -205,15 +219,15 @@ def score(combination):
return [combination, score, fg_mean_dist, fg_variance_dist, bg_mean_dist, bg_variance_dist]
-def pop_fg(mer):
- ''' helper for map function '''
- populate_locations(fg_fasta_fn, fg_mers, mer)
+def load_heterodimer_dic(selected_mers):
+ '''
+ Generate a heterodimer dict which contains every possible combination of
+ selected mers, so later we can check each combination without re-running the
+ max_consecutive_binding function.
-def pop_bg(mer):
- ''' helper for map function '''
- populate_locations(bg_fasta_fn, bg_mers, mer)
+ The stored values are Booleans, True if the result is larger than acceptable.
-def load_heterodimer_dic(selected_mers):
+ '''
for (mer1, mer2) in combinations(selected_mers, 2):
res = get_max_consecutive_binding(mer1, mer2)
heterodimer_dic[(mer1, mer2)] = res > max_consecutive_binding
@@ -221,6 +235,14 @@ def load_heterodimer_dic(selected_mers):
# print res, heterodimer_dic[(mer1, mer2)]
def main():
+ '''
+ Basic worflow:
+
+ Load Top X Selective Primers
+ Populate Locations of Primers
+ Score Combinations For All Sizes
+
+ '''
import time
selected = []
selectivity_fh = open(selectivity_fn, "r")