Entering edit mode
10.2 years ago
joaosilvaourico
•
0
Hello, i'm having difficulties in a python exercice, where i need to translate a dna sequence to it's aminoacid correrspondents. I have the whole program written, but i'm having difficulties with the way in wich the output is being writen.
In sumarry, i have this final piece of code:
for x in f1:
x = x.strip()
if x.count("seq"):
f2.write((x)+("_1_+\n"))
f2.write((x)+("_2_+\n"))
f2.write((x)+("_3_+\n"))
f2.write((x)+("_1_-\n"))
f2.write((x)+("_2_-\n"))
f2.write((x)+("_3_-\n"))
else:
f2.write((translate1(x))+("\n"))
f2.write((translate2(x))+("\n"))
f2.write((translate3(x))+("\n"))
f2.write((translate1neg(x))+("\n"))
f2.write((translate2neg(x))+("\n"))
f2.write((translate3neg(x))+("\n"))
that gives this output:
>seq1_1_+
>seq1_2_+
>seq1_3_+
>seq1_1_-
>seq1_2_-
>seq1_3_-
iyyslrs-las-smrlssiv-m
fiirydrs-ladrcgshrssk
llfativas-lidaalidrl
frrsmraasis-lativannkm
lddr-ephrsas-lrs-riin
-tidesridqlasydrse--m
But what i need is something like this:
>seq1_1_+
iyyslrs-las-smrlssiv-m
>seq1_2_+
fiirydrs-ladrcgshrssk
>seq1_3_+
llfativas-lidaalidrl
>seq1_1_-
frrsmraasis-lativannkm
>seq1_2_-
lddr-ephrsas-lrs-riin
>seq1_3_-
-tidesridqlasydrse--m
So, my question is, how can i resolve this?
Thanks
thank you so much :D