<p>Although there is not a unique nucleotide sequence that translates to a given protein, one can list all the possible DNA sequences that do translate to that protein.</p>

<p>An online tool that does just that is <a href="https://www.ebi.ac.uk/Tools/st/emboss_backtranambig/" rel="noreferrer">Backtranambig</a>, from EMBOSS. It produces a DNA sequence representing all the nucleotide sequences matching the input protein, using <a href="https://droog.gs.washington.edu/parc/images/iupac.html" rel="noreferrer">IUPAC ambiguity codes</a>.</p>

CC BY-SA 4.0
2020-02-09T16:57:30.287Z
2020-02-09T16:57:30.287Z
PedroSebe
<p><a href="https://edinburgh-genome-foundry.github.io/DnaChisel/index.html" rel="nofollow noreferrer">DNA Chisel</a> (written in Python) can <a href="https://edinburgh-genome-foundry.github.io/DnaChisel/ref/biotools.html?highlight=reverse_translate#dnachisel.biotools.reverse_translate" rel="nofollow noreferrer">reverse translate</a> a protein sequence:</p>
<pre class="lang-py prettyprint-override"><code>import dnachisel
from dnachisel.biotools import reverse_translate

record = dnachisel.load_record(&quot;seq.fa&quot;)
reverse_translate(str(record.seq))
# GGTCATATTTTAAAAATGTTTCCT
</code></pre>

CC BY-SA 4.0
2020-11-23T16:01:58.590Z
2020-11-23T16:01:58.590Z
Peter
<p>You can't do this because there is redundancy in the genetic code and the <em>same</em> protein sequences can be encoded by <em>different</em> nucleotide sequences. There are 64 codons and ~20 amino acids, e.g. <code>GCT</code>, <code>GCC</code>, <code>GCA</code> and <code>GCG</code> all encode Alanine.</p>



CC BY-SA 4.0
2020-02-09T10:33:04.247Z
For the sake of the programming exercise, one could use IUPAC ambiguity codes to reflect the set of possible codons for a given amino-acid.
bli
CC BY-SA 4.0
2020-02-09T12:24:32.843Z
@bli Agreed, one could even build a model to predict the underlying codons since there is codon usage bias. For practical purposes I'd do a TBLASTN against NT or similar
Chris_Rands
CC BY-SA 4.0
2020-02-09T09:57:14.263Z
2020-06-16T12:15:28.983Z
2020-06-16T12:15:28.983Z
Chris_Rands
<p>I want to convert a list of fasta ( protein sequences) in a .text file into corresponding nucleotide sequences. A Google search gives me result of DNA to protein conversion but not vice versa. Also, I came across How do I find the nucleotide sequence of a protein using Biopython?, but this is what I am not looking for. Is there any possible way to do it using python.Moreover, I would like to solve it using python programming. I am sure there must be some way to do it rather than writing a code from scratch. Thanks!</p>

<proteins><python><phylogenetics><sequence>
How to translate amino acid sequences to Nucleotide sequences
# How to translate amino acid sequences to Nucleotide sequences

(Asked by: username_0 on 2020-02-08)

I want to convert a list of fasta ( protein sequences) in a .text file into corresponding nucleotide sequences. A Google search gives me result of DNA to protein conversion but not vice versa. Also, I came across How do I find the nucleotide sequence of a protein using Biopython?, but this is what I am not looking for. Is there any possible way to do it using python.Moreover, I would like to solve it using python programming. I am sure there must be some way to do it rather than writing a code from scratch. Thanks!

**Tags:** proteins, python, phylogenetics, sequence

---

## 3 answers

### Answer by username_1 on 2020-02-09. Score: 5

Although there is not a unique nucleotide sequence that translates to a given protein, one can list all the possible DNA sequences that do translate to that protein.

An online tool that does just that is [Backtranambig](https://www.ebi.ac.uk/Tools/st/emboss_backtranambig/), from EMBOSS. It produces a DNA sequence representing all the nucleotide sequences matching the input protein, using [IUPAC ambiguity codes](https://droog.gs.washington.edu/parc/images/iupac.html).


---

### Answer by username_2 on 2020-11-23. Score: 2

DNA Chisel (written in Python) can reverse translate a protein sequence:
import dnachisel
from dnachisel.biotools import reverse_translate

record = dnachisel.load_record("seq.fa")
reverse_translate(str(record.seq))
# GGTCATATTTTAAAAATGTTTCCT


---

### Answer by username_3 on 2020-02-09. Score: 1

You can't do this because there is redundancy in the genetic code and the *same* protein sequences can be encoded by *different* nucleotide sequences. There are 64 codons and ~20 amino acids, e.g. `GCT`, `GCC`, `GCA` and `GCG` all encode Alanine.

> **Comments:**
> **username_4**: For the sake of the programming exercise, one could use IUPAC ambiguity codes to reflect the set of possible codons for a given amino-acid.  
> **username_3**: @bli Agreed, one could even build a model to predict the underlying codons since there is codon usage bias. For practical purposes I'd do a TBLASTN against NT or similar  

---

