Entering edit mode
7.6 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
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:
Did you write this code yourself or modified it from somewhere? It seems... overly complex for generating 6 reading frames.
this screenshot is useful! hahaa
I'm going to keep my standard biostar moderations answer somewhere, getting real tired of typing the same over and over again :-D