I am attempting to create a simple program that reads enzyme cuts from a dna sequence file. My problem is that I cannot get the first block to repeat in a loop. What am I doing wrong so I can turn this into a loop? Any help is greatly appreciated, thanks!!
sequence = open('sequence.txt').read().replace('\n','')
enzymes = {}
fh = open('enzymes.txt')
print('Restriction Enzyme Counter')
inez = input('Enter a Restricting Enzyme: ')
def servx():
for line in fh.readlines():
(name, site, junk, junk) = line.split()
enzymes[name] = site
if inez in line:
xcr = site
print('Active Bases:', site)
for line in sequence.split():
if xcr in line:
bs = (sequence.count(xcr))
print('Enzyme', inez, 'appears', bs, 'times in Sequence.')
servx()
inez = input('Find another Enzyme? [Yes/No]:')
if inez is 'Yes':
servx()
fh.close()