Starting off in Bioinformatics — Turning DNA sequences into Protein sequences | by Vijini Mallawaarachchi | Towards Data Science

In this article, we will be learning about proteins and how to convert a DNA sequence into a protein sequence. I suggest you read my previous article on DNA nuleotides and strands if you missed it, so this article will make more sense as you read. So let’s move on to proteins.
Proteins are large chainlike molecules which are made out of amino acids. Proteins differ from one another mainly in their sequence of amino acids, which is decided by the nucleotide sequence of their genes. Before moving on to proteins, let’s see what amino acids are.
Amino acids are complex organic molecules, primarily made of carbon, hydrogen, oxygen, and nitrogen, along with a few other atoms. It contains an amine group and a carboxyl group, along with a side chain (R group) which is specific to each amino acid.
About 500 amino acids are known at present but only 20 appear in our genetic code. These 20 amino acids are the building blocks in which we are interested in.
The diagram given below shows the 20 common amino acids which appear in our genetic code, along with their full names, three-letter codes, and one-letter codes.
Biochemists have recognized that a given type of protein always contains precisely the same number of total amino acids (generically called residues) in the same proportion. For example,
insulin = (30 glycines + 44 alanines + 5 tyrosines + 14 glutamines + . . .)
Furthermore, amino acids are linked together as a chain. The identity of a protein is obtained from its composition as well as the precise order of its constituent amino acids. Hence insulin can be represented as,
insulin = MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERG FFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN
Proteins are formed by amino acids with their amine and carboxyl groups to form the bonds known as peptide bonds between the successive residues in the sequence. The two diagrams given below depicts how free amino acids form a protein by forming peptide bonds.
You can see that there is an unused amine group on the left extreme and an unused carboxyl group on the right extreme. These extremities are respectively called the N-terminus and C-terminus of the protein chain. The sequence of a protein is read by its constituent amino acids, listed in order from the N-terminus to the C-terminus. Hence the sequence of the protein found in the above diagram will be,
MAVLD = Met-Ala-Val-Leu-Asp      = Methionine–Alanine-Valine–Leucine-Aspartic
When you know a DNA sequence, you can translate it into the corresponding protein sequence by using the genetic code. This is the same way the cell itself generates a protein sequence. This process is known as DNA to protein translation.
The genetic code (referred as DNA codon table for DNA sequences) shows how we uniquely relate a 4-nucleotide sequence (A, T, G, C) to a set of 20 amino acids. It describes a set of rules by which information encoded within genetic material is translated into proteins by living cells. The diagram given below shows the DNA codon table in the form of a chart.
First you should get your DNA string.
ATGGAAGTATTTAAAGCGCCACCTATTGGGATATAAG
Then start reading sequences of 3 nucleotides (one triplet) at a time.
ATG GAA GTA TTT AAA GCG CCA CCT ATT GGG ATA TAA G...
Now, use the genetic code chart to read which amino acid corresponds to the current triplet (technically referred to as codons). The first circle starting from the center represents the first character of the triplet, the second circle represents the second character and the third circle represents the last character. After translating, you will get the protein sequence which corresponds to the aforementioned DNA sequence.
M E V F K A P P I G I STOPM E V F K A P P I G I
TAA, TAG and TGA are known as termination signals where you stop the translation process.
The Python code given below takes a DNA sequence and converts it to the corresponding protein sequence. I have created a dictionary to store the information of the genetic code chart. Feel free to try out the code and see what happens.
I have given the same DNA sequence we discussed previously as input in the sample_dna.txt file.
ATGGAAGTATTTAAAGCGCCACCTATTGGGATATAAG
Given below are the results obtained.
If you know where a protein-coding region starts in a DNA sequence, your computer can generate the corresponding protein sequence consisting of the amino acids, using a simple code. Many sequence analysis programs use this translation method, so you can process DNA sequences as virtual protein sequences using your computer.
Hope you enjoyed reading this article and learned something useful.
Since I’m still very new to this field, I would like to hear your advice. 😇
Stay tuned for my next article on bioinformatics which will be about RNA sequences.
Thanks for reading... 😃