problem in generating 6 frames
1
0
Entering edit mode
7.1 years ago
swats1994 • 0
import sys
import re 
from Bio.Seq import Seq
from Bio import SeqIO
from Bio.Alphabet import generic_dna
gcf=open(sys.argv[1],'r')
fasta= SeqIO.read(sys.argv[2], "fasta")
fout=open('six_frame.csv','w')

one=[]
two=[]

for lin in gcf:
    word =lin.split()
    one.append((word[2]))
    two.append((word[3]))
one.pop(0)
one.pop(0)
two.pop(0)
table=11
count=0
for i in range(len(two)-1):
    k= fasta.seq[int(two[i]):int(one[i])]
    count +=1
    for strand, nuc in [(+1, k), (-1, k.reverse_complement())]:
        for frame in range(3):
            length=3*((len(k)-1)/3)                 
                for pro in nuc[frame:frame+length].translate(table).split("*"):
                    fout.write((str(two[i])+'-'+str(one[i]) +'\t'+ str(pro)+'\t'+' length '+'\t'+ str(len(pro))+'\t'+" strand "+'\t'+ str(strand)+'\t'+" frame "+'\t'+ str(frame))+'\n')

this is the code the problem is this is not generating 6 reading frames , it generating frames but is not able to stop where ever it is encountering the stop codon and is reading the sequence ... and generating many frames of the single sequence , so please help me , this is python code

genome • 1.1k views
ADD COMMENT
1
Entering edit mode

I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:

101010 Button

Did you write this code yourself or modified it from somewhere? It seems... overly complex for generating 6 reading frames.

ADD REPLY
0
Entering edit mode

this screenshot is useful! hahaa

ADD REPLY
0
Entering edit mode

I'm going to keep my standard biostar moderations answer somewhere, getting real tired of typing the same over and over again :-D

ADD REPLY
0
Entering edit mode
7.1 years ago
st.ph.n ★ 2.7k

With translate, you can tell it to use stop codons: translate(coding_dna, to_stop=True)

ADD COMMENT

Login before adding your answer.

Traffic: 2574 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6