I’m trying to write a script that can use a reading frame of 3 to detect a certain pattern and then from that sequence, go in multiples of 3 to find another pattern
sequence = 'TCATGAGGCTTTGGTAAATAT'
i need it to:
…scan with a reading frame of 3 until it finds a desired pattern (i.e. ‘ATG’)
…mark the location of where the first pattern (‘ATG’) started in the original sequence and the position of where the second pattern started (‘TAA’). In this case, it would be position 3 for ‘ATG’ and 15 for ‘TAA’ .
…create a list with each triplet that follows the first pattern until it reaches the second pattern ‘TAA’ (i.e. ‘ATG’,’AGG’,’CTT’,TGG’,’TAA’)
How do I construct a reading frame to read it in sets of 3 ? I know that once i find a way to get the reading i can create an if statement saying
reading_frame=[]
for frame in sequence:
if k == 'ATG':
reading_frame.append(k)
first i need the reading frame
[‘ATG’, ‘AGG’, ‘CTT’, ‘TGG’, ‘TAA’]