BioPython: Translation

Shubham Thorat
0


In molecular biology, one of the fundamental processes is the translation of genetic information from DNA or messenger RNA (mRNA) sequences into protein sequences. This process is crucial for understanding gene function and protein synthesis. With BioPython, this translation process is made straightforward using the translate() method of the Seq object. 



Image created using biorender.com

Let's understand how to translate DNA or mRNA sequences into protein sequences, discussing various options and considerations along the way.

🚀 Running Python in Google Colab? If you're unsure how to run this code, check out our Google Colab getting started guide here for easy steps! 📝(alert-success)


1. Basic Translation

First, let's see how to translate a DNA or mRNA sequence into a protein sequence using the translate() method:


!pip install biopython


from Bio.Seq import Seq

# Define the mRNA sequence
messenger_rna = Seq("AUGGCCAUUGUAAUGGGCCGCUGAAAGGGUGCCCGAUAG")

# Translate mRNA sequence to protein sequence
protein_sequence = messenger_rna.translate()

print(protein_sequence)(code-box)


Output:

MAIVMGR*KGAR*



2. Using DNA Sequence

Alternatively, you can directly translate a coding strand DNA sequence:


from Bio.Seq import Seq

# Define the coding DNA sequence
coding_dna = Seq("ATGGCCATTGTAATGGGCCGCTGAAGGGATGCCCGATAG")

# Translate coding DNA sequence to protein sequence
protein_sequence = coding_dna.translate()

print(protein_sequence)(code-box)

Output:

MAIVMGR*RDAR*



3. Using Alternative Genetic Codes

By default, translation uses the standard genetic code (NCBI table id 1). However, you can specify alternative genetic codes, such as for mitochondrial sequences:

from Bio.Seq import Seq

# Define the coding DNA sequence
coding_dna = Seq("ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG")

# Translate using vertebrate mitochondrial genetic code
protein_sequence = coding_dna.translate(table="Vertebrate Mitochondrial")

print(protein_sequence)(code-box)

Output:

MAIVMGRWKGAR*



4. Translating Up to the First Stop Codon

If you only want to translate up to the first in-frame stop codon:


from Bio.Seq import Seq

# Define the coding DNA sequence
coding_dna = Seq("ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG")

# Translate up to the first stop codon
protein_sequence = coding_dna.translate(to_stop=True)

print(protein_sequence)(code-box)

Output:

MAIVMGR



5. Specifying Stop Symbol

You can specify the stop symbol if you don’t want to use the default asterisk:


from Bio.Seq import Seq

# Define the coding DNA sequence
coding_dna = Seq("ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG")

# Translate with a different stop symbol
protein_sequence = coding_dna.translate(stop_symbol="@")

print(protein_sequence)(code-box)

Output:

MAIVMGR@KGAR@



6. Translating Complete Coding Sequences(CDS)

If you have a complete coding sequence (CDS), you can use the cds=True option:


from Bio.Seq import Seq

# Define the coding DNA sequence
gene = Seq(
    "GTGAAAAAGATGCAATCTATCGTACTCGCACTTTCCCTGGTTCTGGTCGCTCCCATGGCA"
    "GCACAGGCTGCGGAAATTACGTTAGTCCCGTCAGTAAAATTACAGATAGGCGATCGTGAT"
    "AATCGTGGCTATTACTGGGATGGAGGTCACTGGCGCGACCACGGCTGGTGGAAACAACAT"
    "TATGAATGGCGAGGCAATCGCTGGCACCTACACGGACCGCCGCCACCGCCGCGCCACCAT"
    "AAGAAAGCTCCTCATGATCATCACGGCGGTCATGGTCCAGGCAAACATCACCGCTAA"
)

# Translate with bacterial genetic code and as a complete CDS
protein_sequence = gene.translate(table="Bacterial", cds=True)

print(protein_sequence)(code-box)

Output:

MKKMQSIVLALSLVLVAPMAAQAAEITLVPSVKLQIGDRDNRGYYWDGGHWRDHGWWKQHYEWRGNRWHLHGPPPPPRHHKKAPHDHHGGHGPGKHHR



Significance:

BioPython provides powerful tools for translating DNA or mRNA sequences into protein sequences. With options to handle alternative genetic codes, stop symbols, and complete coding sequences, it offers flexibility for various molecular biology applications. By understanding these methods and options, researchers can accurately translate genetic information to study gene functions and protein structures.


Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our app uses cookies to enhance your experience. Check Now
Ok, Go it!