-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdna - rna.py
41 lines (37 loc) · 2.58 KB
/
dna - rna.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def complementoRNA(dna):
rna = ''
for base_nitrogenada in dna:
if base_nitrogenada == 'A':
rna+='U'
elif base_nitrogenada=='T':
rna+='A'
elif base_nitrogenada=='C':
rna+='G'
elif base_nitrogenada=='G':
rna+='C'
else:
rna+=base_nitrogenada
return rna
def complemento(dna):
dnacomplemento = ''
for base_nitrogenada in dna:
if base_nitrogenada == 'A':
dnacomplemento+='T'
elif base_nitrogenada=='T':
dnacomplemento+='A'
elif base_nitrogenada=='C':
dnacomplemento+='G'
elif base_nitrogenada=='G':
dnacomplemento+='C'
else:
dnacomplemento+=base_nitrogenada
return dnacomplemento
def transcricao(dna):
return complementoRNA(complemento(dna))
if __name__ == '__main__':
entrada = 'CCAAATATATGATCTATATTCAGGTGAAACGGGCCTCATCGGGTATCCCGGTGCACGAGACAGAAGGGAGCAATACACTCGGGAGATCTGGTCTTTACTTGGCAAAGTTATGCGAAAGACAAAGCCTAACTTAAACCTCGTGTCGTTTGGCTACAAGTAGCCACGTGATTCAATGTCTCTATTAGCAATACATAGGTTGTAGATTTGTAGTGTATACTTGTACGCAGCAAGTCGGTAAAGCGCATAAGGCCGTATCCCTAGTAGCTTGCTGTTAAGCATGGTTACGTGTCACTAACCGCCGGCTACTCCTTAGTCAGAGTTCTGGTAGTCCGTGTCACATAGATTAGGGAAAAGTACACCATCGCAAATGAGTGCTGGCGAGCTCGCGTATTGTATGCAGGTCCCGCCGTGGAAGCGGCAAGCATCCTCGCAGGCCGCAGCATACGTGGTTCCCTGGGTGTCTTTCTCGCAGCGATGGGGCTTCACGACAGCGCTGATCCAAACCTTCTCCGGTGCCCCCGAACTTTCATGTGTTTTCTCCCTTAGTGGATAATATCTGAGTTCTATGCTTGGGTATGTTTCTCGCATACTCTGACACAGTGACTACTGAGGTCCCTCAAATTCATCGGCCGCAGACACGGTGGACAAGGCATCAGTCTTCAGATAAGAAATGAGGCCACCCTATTATCTCAGTTTAGCCTGCTCCACGGTCTATTAACTGAGTCGTCATTTGGGGGGTAGCGTGGTAAATAAGCCGATCGTATGTCCTCGATGTGATCTTCGCGTATGGGTGAACGAATACGTAGACCTCACCATGGGTGGTCTGACCTTCTCACCTCCCTCCGGCGATGAAAAAGGCTCCGAAGGTCCCTGATTGTCTCGGACGCTCGGTACGTTTCTTCGGCACTAAACCAACTAGTGTACTTAGTTGAGTCTCATGGACTCTGTTTGTAGCCGGGCCGAGCCCACCCCCGGCACGTGGGGCGCTGGGCTCTTGACGCTCGATGGGATGCATCTATTGATGAATAGGCCCGATGCTCCAGACGGAGCTTTATTATGTTTGCTTGAACGAAGGAGTCCACAGAGGGCCGCACAGTTCGTGACAGCAGTTCCTCAGCTCGCTGGCGCGAGTATGCGGCTTTTTTGTCCGAATAACATCGACTTAAAAGGGCGTCGGTTCGACCCCACTACAGAACCTACCAGACCGTTCCGGACGCGCCGCTTATTAGGCTCATTTTGAGATTTGGATGACCGGTTACCGTTTCTAGCGTATCCCGACTCGCTTCTATAGTACCCGTCTCCGCATCTGTCTTTTGACAGTCCAGTATCGTCGTGAGACCATACCGGACAGGGCACGCATAGCTACTAGAGCAGCGTTATGCTTACGCGCATAGACGATCTATACATGCCTCTAAACCACGCCACGGCATGAAATGTAAACATCGCTTTTTTGGACGAGCTCTGCAGGGACTGCGGTTTGATTGCAGAGGGGACCATACC'
arquivo = open('rna-mensageiro-output.txt','w')
saida = transcricao(entrada)
arquivo.write(saida+'\n')
arquivo.close()
print("Saída salva, no diretório corrente!")