Answers.Body: <p>Given the table above the solution for CYCLE is:</p>
  <pre><code>from itertools import product
  
  prot = 'CYCLE'
  degenDict = dict()
  for v,k in table.items():
      if k in degenDict:
          degenDict[k].append(v)
      else:
          degenDict[k]=[]
          degenDict[k].append(v)
  nucs = [degenDict[resid] for resid in prot]
  for degenNuc in product(*nucs):
      print(''.join(degenNuc))
  </code></pre>
  <blockquote>
  <p>TGCTACTGCCTAGAA
  TGCTACTGCCTAGAG
  TGCTACTGCCTCGAA
  TGCTACTGCCTCGAG
  TGCTACTGCCTGGAA
  TGCTACTGCCTGGAG
  TGCTACTGCCTTGAA
  TGCTACTGCCTTGAG
  TGCTACTGCTTAGAA
  TGCTACTGCTTAGAG
  TGCTACTGCTTGGAA
  TGCTACTGCTTGGAG
  TGCTACTGTCTAGAA
  TGCTACTGTCTAGAG
  TGCTACTGTCTCGAA
  TGCTACTGTCTCGAG
  TGCTACTGTCTGGAA
  TGCTACTGTCTGGAG
  TGCTACTGTCTTGAA
  TGCTACTGTCTTGAG
  TGCTACTGTTTAGAA
  TGCTACTGTTTAGAG
  TGCTACTGTTTGGAA
  TGCTACTGTTTGGAG
  TGCTATTGCCTAGAA
  TGCTATTGCCTAGAG
  TGCTATTGCCTCGAA
  TGCTATTGCCTCGAG
  TGCTATTGCCTGGAA
  TGCTATTGCCTGGAG
  TGCTATTGCCTTGAA
  TGCTATTGCCTTGAG
  TGCTATTGCTTAGAA
  TGCTATTGCTTAGAG
  TGCTATTGCTTGGAA
  TGCTATTGCTTGGAG
  TGCTATTGTCTAGAA
  TGCTATTGTCTAGAG
  TGCTATTGTCTCGAA
  TGCTATTGTCTCGAG
  TGCTATTGTCTGGAA
  TGCTATTGTCTGGAG
  TGCTATTGTCTTGAA
  TGCTATTGTCTTGAG
  TGCTATTGTTTAGAA
  TGCTATTGTTTAGAG
  TGCTATTGTTTGGAA
  TGCTATTGTTTGGAG
  TGTTACTGCCTAGAA
  TGTTACTGCCTAGAG
  TGTTACTGCCTCGAA
  TGTTACTGCCTCGAG
  TGTTACTGCCTGGAA
  TGTTACTGCCTGGAG
  TGTTACTGCCTTGAA
  TGTTACTGCCTTGAG
  TGTTACTGCTTAGAA
  TGTTACTGCTTAGAG
  TGTTACTGCTTGGAA
  TGTTACTGCTTGGAG
  TGTTACTGTCTAGAA
  TGTTACTGTCTAGAG
  TGTTACTGTCTCGAA
  TGTTACTGTCTCGAG
  TGTTACTGTCTGGAA
  TGTTACTGTCTGGAG
  TGTTACTGTCTTGAA
  TGTTACTGTCTTGAG
  TGTTACTGTTTAGAA
  TGTTACTGTTTAGAG
  TGTTACTGTTTGGAA
  TGTTACTGTTTGGAG
  TGTTATTGCCTAGAA
  TGTTATTGCCTAGAG
  TGTTATTGCCTCGAA
  TGTTATTGCCTCGAG
  TGTTATTGCCTGGAA
  TGTTATTGCCTGGAG
  TGTTATTGCCTTGAA
  TGTTATTGCCTTGAG
  TGTTATTGCTTAGAA
  TGTTATTGCTTAGAG
  TGTTATTGCTTGGAA
  TGTTATTGCTTGGAG
  TGTTATTGTCTAGAA
  TGTTATTGTCTAGAG
  TGTTATTGTCTCGAA
  TGTTATTGTCTCGAG
  TGTTATTGTCTGGAA
  TGTTATTGTCTGGAG
  TGTTATTGTCTTGAA
  TGTTATTGTCTTGAG
  TGTTATTGTTTAGAA
  TGTTATTGTTTAGAG
  TGTTATTGTTTGGAA
  TGTTATTGTTTGGAG</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-02T15:01:19.477Z
Answers.LastActivityDate: 2022-08-02T15:01:19.477Z
Answers.UserDisplayName: M__
Body: <p>what is the opposite of <a href="https://biopython.org/docs/1.75/api/Bio.Seq.html#Bio.Seq.Seq.translate" rel="nofollow noreferrer">.translate()</a> function calls ?</p>
  <p>I mean let's say I am given an amino acid string <code>CYCLIC</code>, how do I obtain <strong>all the possible combinations of DNA strings</strong> before the translation process ?</p>
  <p>Note: I was told that <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4135748/" rel="nofollow noreferrer">degeneracy</a> has an important role in this particular aspect, but I am not entirely sure about the degeneracy calculation in the following screenshot highlighted in yellow color.</p>
  <p><a href="https://i.sstatic.net/R0aG5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/R0aG5.png" alt="degeneracy" /></a></p>
  <p>The degenerate code is as follows:</p>
  <pre><code>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',
      }
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-02T14:25:33.383Z
Comments.Text: There isn't a function that will do the reverse translation, so it user code and requires the degenerate amino acid table. Degeneracy is important into primer design agreed. I'm not around for several days.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-02T14:43:00.173Z
Comments.Text: May I know where exactly did you obtain the degenerate code table ?
Comments.UserDisplayName: kevin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-02T15:02:47.347Z
Comments.Text: There everywhere, I got it from Geek for Geeks
Comments.UserDisplayName: M__
Tags: <python><phylogenetics><phylogeny><sequence-analysis>
Title: reverse translation from amino acid string to DNA strings
ThreadText: # reverse translation from amino acid string to DNA strings
  
  (Asked by: username_0 on 2022-08-02)
  
  what is the opposite of [.translate()](https://biopython.org/docs/1.75/api/Bio.Seq.html#Bio.Seq.Seq.translate) function calls ?
  
  I mean let's say I am given an amino acid string `CYCLIC`, how do I obtain **all the possible combinations of DNA strings** before the translation process ?
  
  Note: I was told that [degeneracy](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4135748/) has an important role in this particular aspect, but I am not entirely sure about the degeneracy calculation in the following screenshot highlighted in yellow color.
  
  [![degeneracy](https://i.sstatic.net/R0aG5.png)](https://i.sstatic.net/R0aG5.png)
  
  The degenerate code is as follows:
  
  ```
  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',
      }
  
  ```
  
  **Tags:** python, phylogenetics, phylogeny, sequence-analysis
  
  > **Comments:**
  > **username_1**: There isn't a function that will do the reverse translation, so it user code and requires the degenerate amino acid table. Degeneracy is important into primer design agreed. I'm not around for several days.  
  > **username_0**: May I know where exactly did you obtain the degenerate code table ?  
  > **username_1**: There everywhere, I got it from Geek for Geeks  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-08-02. Score: 3 | Accepted answer
  
  Given the table above the solution for CYCLE is:
  
  ```
  from itertools import product
  
  prot = 'CYCLE'
  degenDict = dict()
  for v,k in table.items():
      if k in degenDict:
          degenDict[k].append(v)
      else:
          degenDict[k]=[]
          degenDict[k].append(v)
  nucs = [degenDict[resid] for resid in prot]
  for degenNuc in product(*nucs):
      print(''.join(degenNuc))
  
  ```
  
  > TGCTACTGCCTAGAA
  > TGCTACTGCCTAGAG
  > TGCTACTGCCTCGAA
  > TGCTACTGCCTCGAG
  > TGCTACTGCCTGGAA
  > TGCTACTGCCTGGAG
  > TGCTACTGCCTTGAA
  > TGCTACTGCCTTGAG
  > TGCTACTGCTTAGAA
  > TGCTACTGCTTAGAG
  > TGCTACTGCTTGGAA
  > TGCTACTGCTTGGAG
  > TGCTACTGTCTAGAA
  > TGCTACTGTCTAGAG
  > TGCTACTGTCTCGAA
  > TGCTACTGTCTCGAG
  > TGCTACTGTCTGGAA
  > TGCTACTGTCTGGAG
  > TGCTACTGTCTTGAA
  > TGCTACTGTCTTGAG
  > TGCTACTGTTTAGAA
  > TGCTACTGTTTAGAG
  > TGCTACTGTTTGGAA
  > TGCTACTGTTTGGAG
  > TGCTATTGCCTAGAA
  > TGCTATTGCCTAGAG
  > TGCTATTGCCTCGAA
  > TGCTATTGCCTCGAG
  > TGCTATTGCCTGGAA
  > TGCTATTGCCTGGAG
  > TGCTATTGCCTTGAA
  > TGCTATTGCCTTGAG
  > TGCTATTGCTTAGAA
  > TGCTATTGCTTAGAG
  > TGCTATTGCTTGGAA
  > TGCTATTGCTTGGAG
  > TGCTATTGTCTAGAA
  > TGCTATTGTCTAGAG
  > TGCTATTGTCTCGAA
  > TGCTATTGTCTCGAG
  > TGCTATTGTCTGGAA
  > TGCTATTGTCTGGAG
  > TGCTATTGTCTTGAA
  > TGCTATTGTCTTGAG
  > TGCTATTGTTTAGAA
  > TGCTATTGTTTAGAG
  > TGCTATTGTTTGGAA
  > TGCTATTGTTTGGAG
  > TGTTACTGCCTAGAA
  > TGTTACTGCCTAGAG
  > TGTTACTGCCTCGAA
  > TGTTACTGCCTCGAG
  > TGTTACTGCCTGGAA
  > TGTTACTGCCTGGAG
  > TGTTACTGCCTTGAA
  > TGTTACTGCCTTGAG
  > TGTTACTGCTTAGAA
  > TGTTACTGCTTAGAG
  > TGTTACTGCTTGGAA
  > TGTTACTGCTTGGAG
  > TGTTACTGTCTAGAA
  > TGTTACTGTCTAGAG
  > TGTTACTGTCTCGAA
  > TGTTACTGTCTCGAG
  > TGTTACTGTCTGGAA
  > TGTTACTGTCTGGAG
  > TGTTACTGTCTTGAA
  > TGTTACTGTCTTGAG
  > TGTTACTGTTTAGAA
  > TGTTACTGTTTAGAG
  > TGTTACTGTTTGGAA
  > TGTTACTGTTTGGAG
  > TGTTATTGCCTAGAA
  > TGTTATTGCCTAGAG
  > TGTTATTGCCTCGAA
  > TGTTATTGCCTCGAG
  > TGTTATTGCCTGGAA
  > TGTTATTGCCTGGAG
  > TGTTATTGCCTTGAA
  > TGTTATTGCCTTGAG
  > TGTTATTGCTTAGAA
  > TGTTATTGCTTAGAG
  > TGTTATTGCTTGGAA
  > TGTTATTGCTTGGAG
  > TGTTATTGTCTAGAA
  > TGTTATTGTCTAGAG
  > TGTTATTGTCTCGAA
  > TGTTATTGTCTCGAG
  > TGTTATTGTCTGGAA
  > TGTTATTGTCTGGAG
  > TGTTATTGTCTTGAA
  > TGTTATTGTCTTGAG
  > TGTTATTGTTTAGAA
  > TGTTATTGTTTAGAG
  > TGTTATTGTTTGGAA
  > TGTTATTGTTTGGAG
  
  
  ---
  
  