I was wondering how I can make a list of pulled specific sequence values (the first three) following a common sequence, to place onto another list. This is more conceptual based versus an actual application if that makes sense. This is an example of what I am trying to accomplish,
seq = 'ATTACGA'
og_list = ['ATGGGCATAGA', 'GCCTGAACTT', 'GAATTACGAAGAGT', 'AAGTCCAAT', 'GCACATTACGATAG']
It would ideally pull the remaining sequence from the common sequence stored in the seq variable to get:
['AGA', 'TAG']
This is because these values are the three after the seq common sequence value. I would imagine the find (.find()) function could be used, but as I am new to Python, if someone can help me figure this out that would be great.
Here is what I have so far:
seq = 'ATTACGA'
og_list = ['ATGGGCATAGA', 'GCCTGAACTT', 'GAATTACGAAGAGT', 'AAGTCCAAT', 'GCACATTACGATAG']
new_list = []
if seq in og_list:
og_list.find(seq)
new_list.append(seq)
print(seq)
This is clearly not cutting it. I am unsure of how to get the next three values from the common seq — perhaps slicing might be effective?