Answers.Body: <p>There seems to be a bioconductor package named <code>synmut</code> which does just that.
  Apparently, it can take codon usage into account when generating synonymous mutations.</p>
  
  <p>Copy pasting an example that matches your use case from <a href="https://bioconductor.org/packages/3.11/bioc/vignettes/SynMut/inst/doc/SynMut.html" rel="nofollow noreferrer">the official doc</a>:</p>
  
  <pre class="lang-r prettyprint-override"><code>library("SynMut")
  filepath.fasta &lt;- system.file("extdata", "example.fasta", package = "SynMut")
  filepath.csv &lt;- system.file("extdata", "target_regions.csv", package = "SynMut")
  region &lt;- read.csv(filepath.csv)
  rgd.seq &lt;- input_seq(filepath.fasta, region)
  mut.seq &lt;- codon_random(rgd.seq, keep = TRUE)
  Biostrings::writeXStringSet(get_dna(mut.seq), "rgd.fasta")
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-30T09:26:57.183Z
Answers.Text: Brilliant, thanks, that package works well
Answers.UserDisplayName: Mike
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-24T12:20:46.033Z
Answers.LastActivityDate: 2020-04-24T12:20:46.033Z
Answers.UserDisplayName: cmdoret
Answers.Body: <p><a href="https://edinburgh-genome-foundry.github.io/DnaChisel/" rel="nofollow noreferrer">DNA Chisel</a> can introduce synonymous mutations into your sequence.
  Annotate the coding sequence with the <a href="https://edinburgh-genome-foundry.github.io/DnaChisel/genbank/genbank_api.html#indicating-coding-sequences" rel="nofollow noreferrer">@cds constraint</a> and the <a href="https://edinburgh-genome-foundry.github.io/DnaChisel/genbank/genbank_api.html#forcing-changes" rel="nofollow noreferrer">~change objective</a>.</p>
  <p>Additionally, you may also optimize the codon usage to match your species with <a href="https://edinburgh-genome-foundry.github.io/DnaChisel/genbank/genbank_api.html#codon-optimization" rel="nofollow noreferrer">~match_codon_usage</a> or one of the other options.</p>
  <p>A web interface is also provided at EGF CUBA (Collection of Useful Biological Apps): <a href="https://cuba.genomefoundry.org/sculpt_a_sequence" rel="nofollow noreferrer">Sculpt a Sequence</a></p>
  <p><em>Disclaimer: I'm the current maintainer of DNA Chisel</em></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-27T14:54:18.717Z
Answers.LastActivityDate: 2020-11-27T14:54:18.717Z
Answers.UserDisplayName: Peter
Body: <p>I've got a DNA sequence that I'd like to make synonymous mutations throughout, thereby preserving the amino acid sequence. Does anyone know of a tool to achieve this</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-22T08:42:24.393Z
Comments.Text: I don't but it wouldn't it be easier to write one?  The other issue is that context would be useful, it is fairly common to consider synonymous mutations in fitness, particularly cancers and it would make sense to construct a null distribution.
Comments.UserDisplayName: M__
Tags: <r><bioconductor><mutations><synonymous-mutations>
Title: Is there a tool for synonymous recoding of DNA sequences?
ThreadText: # Is there a tool for synonymous recoding of DNA sequences?
  
  (Asked by: username_0 on 2020-04-22)
  
  I've got a DNA sequence that I'd like to make synonymous mutations throughout, thereby preserving the amino acid sequence. Does anyone know of a tool to achieve this
  
  **Tags:** r, bioconductor, mutations, synonymous-mutations
  
  > **Comments:**
  > **username_1**: I don't but it wouldn't it be easier to write one?  The other issue is that context would be useful, it is fairly common to consider synonymous mutations in fitness, particularly cancers and it would make sense to construct a null distribution.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2020-04-24. Score: 2 | Accepted answer
  
  There seems to be a bioconductor package named `synmut` which does just that.
  Apparently, it can take codon usage into account when generating synonymous mutations.
  
  Copy pasting an example that matches your use case from [the official doc](https://bioconductor.org/packages/3.11/bioc/vignettes/SynMut/inst/doc/SynMut.html):
  
  ```r
  library("SynMut")
  filepath.fasta <- system.file("extdata", "example.fasta", package = "SynMut")
  filepath.csv <- system.file("extdata", "target_regions.csv", package = "SynMut")
  region <- read.csv(filepath.csv)
  rgd.seq <- input_seq(filepath.fasta, region)
  mut.seq <- codon_random(rgd.seq, keep = TRUE)
  Biostrings::writeXStringSet(get_dna(mut.seq), "rgd.fasta")
  
  ```
  
  > **Comments:**
  > **username_0**: Brilliant, thanks, that package works well  
  
  ---
  
  ### Answer by username_3 on 2020-11-27. Score: 0
  
  [DNA Chisel](https://edinburgh-genome-foundry.github.io/DnaChisel/) can introduce synonymous mutations into your sequence.
  Annotate the coding sequence with the [@cds constraint](https://edinburgh-genome-foundry.github.io/DnaChisel/genbank/genbank_api.html#indicating-coding-sequences) and the [~change objective](https://edinburgh-genome-foundry.github.io/DnaChisel/genbank/genbank_api.html#forcing-changes).
  
  Additionally, you may also optimize the codon usage to match your species with [~match\_codon\_usage](https://edinburgh-genome-foundry.github.io/DnaChisel/genbank/genbank_api.html#codon-optimization) or one of the other options.
  
  A web interface is also provided at EGF CUBA (Collection of Useful Biological Apps): [Sculpt a Sequence](https://cuba.genomefoundry.org/sculpt_a_sequence)
  
  *Disclaimer: I'm the current maintainer of DNA Chisel*
  
  
  ---
  
  