Translation Theory : DNA ⇒ RNA ⇒ Protein
Life depends on the ability of cells to store, retrieve, and translate genetic instructions.These instructions are needed to make and maintain living organisms. For a long time, it was not clear what molecules were able to copy and transmit genetic information. We now know that this information is carried by the dioxyribonucleic acid or DNA in all living things.
DNA: DNA is a discrete code physically present in almost every cell of an organism. We can think of DNA as a one dimensional string of characters with four characters to choose from. These characters are A, C, G, and T. They stand for the first letters with the four nucleotides used to construct DNA. The full names of these nucleotides are Adenine, Cytosine, Guanine, and Thymine. Each unique three character sequence of nucleotides, sometimes called a nucleotide triplet, corresponds to one amino acid. The sequence of amino acids is unique for each type of protein and all proteins are built from the same set of just 20 amino acids for all living things.
Instructions in the DNA are first transcribed into RNA and the RNA is then translated into proteins. We can think of DNA, when read as sequences of three letters, as a dictionary of life.
Aim: Convert a given sequence of DNA into its Protein equivalent.
Source: Download a DNA strand as a text file from a public web-based repository of DNA sequences from NCBI.The Nucleotide sample is ( NM_207618.2 ), which can be found here.To download the file :
Steps: Required steps to convert DNA sequence to a sequence of Amino acids are :
1. Code to translate the DNA sequence to a sequence of Amino acids where each Amino acid is represented by a unique letter. 2. Download the Amino acid sequence from NCBI to check our solution.
The very first step is to put the original unaltered DNA sequence text file into the working path directory.Check your working path directory in the Python shell,
Next, we need to open the file in Python and read it. By default, the text file contains some unformatted hidden characters. These hidden characters such as “/n” or “/r” needs to be formatted and removed. So we use replace() function and get the altered DNA sequence txt file from the Original txt file.
Next, we will build a function called translate() which will convert the altered DNA sequence into its Protein equivalent and return it. We will feed the altered DNA sequence as a parameter to the function.
The table in the code above is for reference and can be found in biology manuals. Since triplet nucleotide called the codon forms a single amino acid, so we check if the altered DNA sequence is divisible by 3 in ( if len(seq)%3 == 0: ). Next, the code is self explanatory where we form codons and match them with the Amino acids in the table. Atlast, we form the Amino acid sequence also called the Protein and return it.
The last step is to match our Amino Acid sequence with that to the original one found on the NCBI website. We will compare both of the Amino acid sequences in Python, character by character and return true if both are exactly the same copy.
First download the unaltered amino acid sequence txt file and open it in Python. We will build a function called read_seq() to remove the unwanted characters and form the altered amino acid’s sequence txt file.
The last step is to compare both the files and check if both are the same.If the output is true, we have succeeded in translating DNA to Protein.
Output : True
This article is contributed by Amartya Ranjan Saikia. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Protein structure prediction in Cloud Computing
- What other than Python and R?
- Comparing Python with C and C++
- URL Shorteners and its API in Python | Set-1
- URL Shorteners and its API in Python | Set-2
- MongoDB and Python
- XML parsing in Python
- Reading images in Python
- IDE for Python programming on Windows
- Text Analysis in Python 3
- Website Blocker Using Python
- Hangman Game in Python
- FuzzyWuzzy Python library
- Design a Keylogger in Python