Skip to content

Instantly share code, notes, and snippets.

@sammyrulez
Created July 30, 2012 15:25
Show Gist options
  • Save sammyrulez/3207780 to your computer and use it in GitHub Desktop.
Save sammyrulez/3207780 to your computer and use it in GitHub Desktop.
mismatcher
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