Question: In the below python pInput sequence: ggg aug aaa ugu ucc cgg uaa aug aau gcc cgg gaa auv uag ccu gac aug a here

In the below python pInput sequence: ggg aug aaa ugu ucc cgg uaa aug aau gcc cgg gaa auv uag ccu gac aug a
here
[]
here
[]rogram the code doesn't execute the loop but rather skip it.
'''''''
import re
class FindSomething(object):
forward_pattern = re.compile(r'ATG(?:...)*(?:(?:TGA)|(?:TAA)|(?:TAG))')
backward_pattern = re.compile(r'(TGA|TAA|TAG)(?:...)*ATG')
def __init__(self):
pass
def Find_it(self, sequence, mode=True):
found_things =[]
if mode:
pattern = FindSomething.forward_pattern
else:
pattern = FindSomething.backward_pattern
count =0
match = pattern.finditer(sequence, re.IGNORECASE)
print('here')
for m in match:
count +=1
if count >25: # This is here just to avoid inadvertent infinite loops while you are testing
print('Quitting... too many times through the while loop!') # and getting things figured out!
print("Here's what I found before quiting:", found_things)
break
found_things.append(m.group())
next_position = m.start()+1
sequence = sequence[next_position:]
print("Matches found:", m)
found_things.extend(m)
return found_things
def main():
a = FindSomething()
seq ='ggg aug aaa ugu ucc cgg uaa aug aau gcc cgg gaa auu uag ccu gac aug a'
print('Input sequence: ', seq)
print(a.Find_it(seq, mode=True))
print(a.Find_it(seq, mode=False))
if __name__=="__main__":
main()
''''
The result I get is an empty list as nothing is found. Please help me fix the error.
 In the below python pInput sequence: ggg aug aaa ugu ucc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!