Skip to content

Instantly share code, notes, and snippets.

@JohnLonginotto
Last active May 27, 2016 00:23
Show Gist options
  • Save JohnLonginotto/f80391fcd4129a2324b9be1f7189e5cf to your computer and use it in GitHub Desktop.
Save JohnLonginotto/f80391fcd4129a2324b9be1f7189e5cf to your computer and use it in GitHub Desktop.
yup = 0
b = 'AATTCCGGAATT'
p = set([b])
for x in range(0,len(b)):
for x_val in ['A','C','G','T']:
for y in range(0,len(b)):
for y_val in ['A','C','G','T']:
temp = list(b)
temp[x],temp[y] = x_val,y_val
p.add( ''.join(temp) )
try:
with open("/Users/John/Desktop/ENCFF001LCU.fq",'r') as f:
next(f); new_line = next(f)
while True:
yup += any([frag in p for frag in [new_line[s:e] for s,e in enumerate(xrange(len(b),len(new_line)+1))]])
next(f);next(f);next(f); new_line = next(f)
except StopIteration:
print 'Final Result:',yup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment