Skip to contents

codon_optimize takes a coding sequence (without stop codon) and replace each codon to the corresponding synonymous optimal codon.

Usage

codon_optimize(
  seq,
  optimal_codons,
  codon_table = get_codon_table(),
  level = "subfam"
)

Arguments

seq

DNAString, or an object that can be coerced to a DNAString.

optimal_codons

table optimze codons as generated by est_optimal_codons.

codon_table

a table of genetic code derived from get_codon_table or create_codon_table.

level

"subfam" (default) or "amino_acid". Optimize codon usage at which level.

Value

a DNAString of the optimized coding sequence.

Examples

cf_all <- count_codons(yeast_cds)
optimal_codons <- est_optimal_codons(cf_all)
seq <- 'ATGCTACGA'
codon_optimize(seq, optimal_codons)
#> 9-letter DNAString object
#> seq: ATGCTACGT