So I'm trying to create a class that reads a DNA string in three different frames - one that starts at position 0 (or the first base), another that starts in position 1 (the second base), and a third that starts reading at position 2 (the third base). So far, this is what I've been playing around with:
def codons(self, frame_one, frame_two, frame_three):
start = frame_one
while start + 3 <=len(self.seq):
yield (self.seq[start:start+3], start)
start += 3
start+1 = frame_two
while start + 3 <=len(self.seq):
yield (self.seq[start+1:start+4], start)
start += 3
start+2 = frame_three
while start + 3 <=len(self.seq):
yield (self.seq[start+2:start+5], start)
start += 3
I think it's pretty much nonsense at this point, but I tried my best. If anybody can give me an idea on where I can start to correct in this class, that would be great.