Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i in range(0,len(nodes)):
- fragment = nodes[i]
- for l in range(0, length1):
- fragment1 = Text[l:int(l)+int(k)]
- count = [0]*gen_len
- for j in range( 0, gen_len ):
- if fragment[j] != fragment1[j]:
- count[j] = count[j]+1
- if j == (gen_len-1):
- if int(sum(count)) <= int(Num_mismatches):
- count2[i] = count2[i]+1
- result2[i] = fragment
- result.append(fragment)
- if count2[i] > maxval:
- maxval = count2[i]
- from itertools import islice, izip
- for i in xrange(0,len(nodes)):
- fragment = nodes[i]
- for l in xrange(0, length1):
- # fragment1 was replaced by islice to avoid list creation
- # It may or may not be faster. Try timing a version
- # where you replace islice(Text, 1, l+k) with Text[l:int(l)+int(k)]
- count = sum(f != f1 for f, f1 in izip(fragement, islice(Text, 1, l+k)))
- if count <= Num_mismatches:
- count2[i] += 1
- # code smell: why have both result and result2?
- result2[i] = fragment
- result.append(fragment)
- # you are not using maxval anywhere in these loops.
- # you may want to set it after these loops.
- if count2[i] > maxval:
- maxval = count2[i]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement