aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-02-04 13:22:51 -0500
committerCalvin Morrison <mutantturkey@gmail.com>2014-02-04 13:22:51 -0500
commita3abc30f96727d50fe510b494c6b715f2307c765 (patch)
treec760f301ec2529c793d3595c4f54865a6db67301
parentd00fc2bb1864c78fa926a5a84a693d4f84445723 (diff)
max_consecutive speed up
-rwxr-xr-xsrc/filter_max_consecutive_binding.py6
-rwxr-xr-xsrc/score_mers.py6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/filter_max_consecutive_binding.py b/src/filter_max_consecutive_binding.py
index 9054dac..ad798e2 100755
--- a/src/filter_max_consecutive_binding.py
+++ b/src/filter_max_consecutive_binding.py
@@ -20,12 +20,12 @@ def max_consecutive_binding(mer1, mer2):
consecutive = 0
for x in range(len(mer2)):
if binding[mer1[offset+x]] == mer2[x]:
- consecutive = consecutive + 1
+ consecutive += 1
+ if consecutive > max_bind:
+ max_bind = consecutive
else:
consecutive = 0
- max_bind = max(consecutive,max_bind)
-
return max_bind
def test():
diff --git a/src/score_mers.py b/src/score_mers.py
index c7ecf99..d33d23b 100755
--- a/src/score_mers.py
+++ b/src/score_mers.py
@@ -51,12 +51,12 @@ def max_consecutive_binding(mer1, mer2):
consecutive = 0
for x in range(len(mer2)):
if binding[mer1[offset+x]] == mer2[x]:
- consecutive = consecutive + 1
+ consecutive += 1
+ if consecutive > max_bind:
+ max_bind = consecutive
else:
consecutive = 0
- max_bind = max(consecutive,max_bind)
-
return max_bind
def populate_locations(input_fn, mers, mer):