Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Translating DNA to Protein | Protein and Amino Acid Analysis
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Python for Biologists

bookTranslating DNA to Protein

Understanding how DNA is translated into protein is a central concept in molecular biology. The genetic code is the set of rules that determines how a sequence of nucleotides in DNA is converted into a sequence of amino acids in a protein. Each group of three nucleotides in a DNA sequence, called a codon, corresponds to a specific amino acid or a stop signal. The process of translating DNA to protein involves reading the DNA sequence in groups of three nucleotides, mapping each codon to its corresponding amino acid using the genetic code, and assembling the resulting amino acids into a protein sequence. This translation is essential for expressing genetic information as functional proteins in living organisms.

1234567891011121314151617181920212223242526272829
# Dictionary mapping DNA codons to amino acids (single-letter code) CODON_TABLE = { "ATA":"I", "ATC":"I", "ATT":"I", "ATG":"M", "ACA":"T", "ACC":"T", "ACG":"T", "ACT":"T", "AAC":"N", "AAT":"N", "AAA":"K", "AAG":"K", "AGC":"S", "AGT":"S", "AGA":"R", "AGG":"R", "CTA":"L", "CTC":"L", "CTG":"L", "CTT":"L", "CCA":"P", "CCC":"P", "CCG":"P", "CCT":"P", "CAC":"H", "CAT":"H", "CAA":"Q", "CAG":"Q", "CGA":"R", "CGC":"R", "CGG":"R", "CGT":"R", "GTA":"V", "GTC":"V", "GTG":"V", "GTT":"V", "GCA":"A", "GCC":"A", "GCG":"A", "GCT":"A", "GAC":"D", "GAT":"D", "GAA":"E", "GAG":"E", "GGA":"G", "GGC":"G", "GGG":"G", "GGT":"G", "TCA":"S", "TCC":"S", "TCG":"S", "TCT":"S", "TTC":"F", "TTT":"F", "TTA":"L", "TTG":"L", "TAC":"Y", "TAT":"Y", "TAA":"*", "TAG":"*", "TGC":"C", "TGT":"C", "TGA":"*", "TGG":"W", } def translate_dna_to_protein(dna_seq): protein_seq = "" for i in range(0, len(dna_seq) - 2, 3): codon = dna_seq[i:i+3] amino_acid = CODON_TABLE.get(codon, "X") # "X" for unknown codon if amino_acid == "*": break # Stop translation at stop codon protein_seq += amino_acid return protein_seq
copy

The translation function works by iterating through the DNA sequence in steps of three nucleotides, extracting each codon, and using a codon table dictionary to look up the corresponding amino acid. If the codon is not found in the dictionary, it is translated as "X" to indicate an unknown or invalid codon. If a stop codon (represented by "*") is encountered, the function stops translating further, as this signals the end of the protein. The function also ignores any leftover nucleotides at the end of the sequence that do not form a complete codon, ensuring that only full codons are translated.

12345678
# Example DNA sequence dna_sequence = "ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG" # Translate DNA to protein protein_sequence = translate_dna_to_protein(dna_sequence) print("Protein sequence:", protein_sequence) # Output: Protein sequence: MAIVMGR*KGAR* # Note: Translation stops at the first stop codon ("*")
copy

1. What is a codon and how many nucleotides does it contain?

2. Fill in the blank: The genetic code translates every _____ nucleotides into one amino acid.

3. Why is it important to handle stop codons during translation?

question mark

What is a codon and how many nucleotides does it contain?

Select the correct answer

question-icon

Fill in the blank: The genetic code translates every _____ nucleotides into one amino acid.

question mark

Why is it important to handle stop codons during translation?

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 4

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Suggested prompts:

Can you explain why the translation stops at the first stop codon?

What does the "X" represent in the protein sequence?

How would the function handle a DNA sequence with invalid or incomplete codons?

bookTranslating DNA to Protein

Glissez pour afficher le menu

Understanding how DNA is translated into protein is a central concept in molecular biology. The genetic code is the set of rules that determines how a sequence of nucleotides in DNA is converted into a sequence of amino acids in a protein. Each group of three nucleotides in a DNA sequence, called a codon, corresponds to a specific amino acid or a stop signal. The process of translating DNA to protein involves reading the DNA sequence in groups of three nucleotides, mapping each codon to its corresponding amino acid using the genetic code, and assembling the resulting amino acids into a protein sequence. This translation is essential for expressing genetic information as functional proteins in living organisms.

1234567891011121314151617181920212223242526272829
# Dictionary mapping DNA codons to amino acids (single-letter code) CODON_TABLE = { "ATA":"I", "ATC":"I", "ATT":"I", "ATG":"M", "ACA":"T", "ACC":"T", "ACG":"T", "ACT":"T", "AAC":"N", "AAT":"N", "AAA":"K", "AAG":"K", "AGC":"S", "AGT":"S", "AGA":"R", "AGG":"R", "CTA":"L", "CTC":"L", "CTG":"L", "CTT":"L", "CCA":"P", "CCC":"P", "CCG":"P", "CCT":"P", "CAC":"H", "CAT":"H", "CAA":"Q", "CAG":"Q", "CGA":"R", "CGC":"R", "CGG":"R", "CGT":"R", "GTA":"V", "GTC":"V", "GTG":"V", "GTT":"V", "GCA":"A", "GCC":"A", "GCG":"A", "GCT":"A", "GAC":"D", "GAT":"D", "GAA":"E", "GAG":"E", "GGA":"G", "GGC":"G", "GGG":"G", "GGT":"G", "TCA":"S", "TCC":"S", "TCG":"S", "TCT":"S", "TTC":"F", "TTT":"F", "TTA":"L", "TTG":"L", "TAC":"Y", "TAT":"Y", "TAA":"*", "TAG":"*", "TGC":"C", "TGT":"C", "TGA":"*", "TGG":"W", } def translate_dna_to_protein(dna_seq): protein_seq = "" for i in range(0, len(dna_seq) - 2, 3): codon = dna_seq[i:i+3] amino_acid = CODON_TABLE.get(codon, "X") # "X" for unknown codon if amino_acid == "*": break # Stop translation at stop codon protein_seq += amino_acid return protein_seq
copy

The translation function works by iterating through the DNA sequence in steps of three nucleotides, extracting each codon, and using a codon table dictionary to look up the corresponding amino acid. If the codon is not found in the dictionary, it is translated as "X" to indicate an unknown or invalid codon. If a stop codon (represented by "*") is encountered, the function stops translating further, as this signals the end of the protein. The function also ignores any leftover nucleotides at the end of the sequence that do not form a complete codon, ensuring that only full codons are translated.

12345678
# Example DNA sequence dna_sequence = "ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG" # Translate DNA to protein protein_sequence = translate_dna_to_protein(dna_sequence) print("Protein sequence:", protein_sequence) # Output: Protein sequence: MAIVMGR*KGAR* # Note: Translation stops at the first stop codon ("*")
copy

1. What is a codon and how many nucleotides does it contain?

2. Fill in the blank: The genetic code translates every _____ nucleotides into one amino acid.

3. Why is it important to handle stop codons during translation?

question mark

What is a codon and how many nucleotides does it contain?

Select the correct answer

question-icon

Fill in the blank: The genetic code translates every _____ nucleotides into one amino acid.

question mark

Why is it important to handle stop codons during translation?

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 4
some-alt