DNA RNA Protein
DNA RNA Protein
# Transcribe to mRNA
mRNA = dna_seq.transcribe()
print(f"mRNA Sequence: {mRNA}")
if not is_valid_dna(dna_input):
print("Error: Invalid DNA sequence. Only A, T, G, and C are allowed.")
else:
dna_seq = Seq(dna_input)
# Transcription
mRNA = dna_seq.transcribe()
print(f"mRNA Sequence: {mRNA}")
# Translation
protein = mRNA.translate(to_stop=True)
print(f"Protein Sequence: {protein}")
print("Codons:")
for i in range(0, len(mrna_sequence) - 2, 3):
codon = mrna_sequence[i:i+3]
print(codon)
Codons:
AUG
GCC
AUU
GUA
AUG
GGC
CGC
UGA
AAG
GGU
GCC
CGA
UAG
--------------------------------------------------
Codons:
UGU
UUC
CCG
GGA
AUC
UAA
--------------------------------------------------
Warning: Sequence length is not a multiple of 3. Extra nucleotides will be ignored.
Codons:
AUG
GGU
UGA
GUA
--------------------------------------------------
Warning: Sequence length is not a multiple of 3. Extra nucleotides will be ignored.
Codons:
UGA
GGG
UCC
CUG
--------------------------------------------------
print("Codons:")
for i in range(0, len(mrna_sequence) - 2, 3):
codon = mrna_sequence[i:i+3]
print(codon)
if codon in stop_codons:
print("Stop codon encountered. Translation terminated.")
break
Codons:
AUG
GCC
AUU
GUA
AUG
GGC
CGC
UGA
Stop codon encountered. Translation terminated.
--------------------------------------------------
Codons:
AUG
UUU
CCC
GGG
AAU
CUA
--------------------------------------------------
Codons:
AUG
GGU
UGA
Stop codon encountered. Translation terminated.
--------------------------------------------------
Codons:
AUG
AGG
GUC
CCU
--------------------------------------------------