[Tutor] ORFs Python question

ani ben ani.benabbas at gmail.com
Sat May 17 09:00:31 CEST 2014


Hello,

So I thought it would be cool to read a sequence at three different frames,
which I have pasted below. However, I've come across a conundrum: how to
make a list of lists. See, I'd like a final output that displays data of
the type of frame with a + or a - to signify the direction of the read
(+1,+2, +3, -1, -2, -3), the numerical position of each start codon along
with its stop codon, and the length between the start and stop codons. (I
am only looking for the longest ORFs) An example of the output would look
like this:

 +1 57166..61908  4743.

The reason why I'd like a list of lists is so that I can take all the
Starts I found in the code below, store it, then be able to place it in to
the output somehow. I thought that maybe a list of lists would be the best
way of getting this information from three different frames. However, I'm
not sure how to go about this... could someone give me a way to start? The
while loops work fine, last time I checked. Thanks.

def codons(self, frame_one, frame_two, frame_three):
    while frame_one <=len(self.seq):
        yield (self.seq[frame_one:frame_one+3])
        frame_one += 3

    while frame_two <=len(self.seq):
        yield (self.seq[frame_two:frame_two+3])
        frame_two += 3

    while frame_three <=len(self.seq):
        yield (self.seq[frame_three:frame_three+3])
        frame_three += 3

val = seq.codons(0,1,2)
for i in val:
    return(i)

self.startlist.append[[frame_one], [frame_two], [frame_three]]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140517/c07d0f28/attachment-0001.html>


More information about the Tutor mailing list