im trying to enter a string into the one_frame function (one_frame("catatgdaftgaatg")
What i am trying to do is return a list ["atgdaf","atg"]. whenever i find "atg" in the string, i want to grab that "atg" and whatever is after that until i reach either "taa" "tga" "tag". This is what i have so far but it only returns ["atg"].
What i am trying to do is return a list ["atgdaf","atg"]. whenever i find "atg" in the string, i want to grab that "atg" and whatever is after that until i reach either "taa" "tga" "tag". This is what i have so far but it only returns ["atg"].
def get_orf(dna_seq): for x in dna_seq: if("taa" in dna_seq or "tag" in dna_seq or "tga" in dna_seq): dna_seq=dna_seq.replace("taa","") dna_seq=dna_seq.replace("tga","") dna_seq=dna_seq.replace("tag","") return dna_seq else: return dna_seq def one_frame(dna): c=0 q=3 dna_list=[] dna_string="" while(q<=len(dna)): dna_string=dna[c:q] c=c+3 q=q+3 if(dna_string=="atg"): dna_list.append(get_orf(dna_string))