Created
July 30, 2012 15:25
-
-
Save sammyrulez/3207780 to your computer and use it in GitHub Desktop.
mismatcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_mismatch_list(base_query, mismatch_n): | |
for i, ch in enumerate(base_query): | |
gap_filler = "" | |
out_str = "" | |
for m in range(0, mismatch_n): | |
true_index = i + m | |
if true_index >= len(base_query): | |
true_index = true_index - len(base_query) | |
target_element = base_query[true_index] | |
print 'target ', target_element | |
yield base_query[0:i] + gap_filler + base_query[1 + i:] | |
def test_mismatch_list(): | |
out_l = get_mismatch_list("abcdefgh", 3) | |
for a in out_l: | |
print a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment