codon_random-methods: Generate random synonymous mutations

codon_randomR Documentation

Generate random synonymous mutations

Description

Generating random synonymous mutations (in user-defined region), with optionally keeping/not keeping the original codon usage bias.

Usage

codon_random(object, n = 1, keep = FALSE, numcode = 1, ...)

## S4 method for signature 'regioned_dna'
codon_random(object, n, keep, numcode)

## S4 method for signature 'DNAStringSet'
codon_random(object, n, keep, numcode)

Arguments

object

A regioned_dna object.

n

Optional n parameter specifying what proportion of the codons to be mutated. Default value: 1.

keep

Logical parameter controling whether keeping the codon usage bias

numcode

The ncbi genetic code number for translation. Default value: 1. Details please refer to ?seqinr::translate ("https://rdrr.io/cran/seqinr/man/translate.html").

...

...

Details

This method randomly sample synonymous codons for n propotion of every mutable codons in the sequences. This process will be likely to alter the codon usage bias of the original sequences. However the keep = TRUE argument help to preserve the codon usage bias. It is done via the synsequence function in seqinr package. The synsequence function essentially swaps the position of the synonymous codons without introducing new codons into the original sequences.

Value

A regioned_dna object containing the mutants; Or a DNAStringSet object if the input is a DNAStringSet object.

See Also

input_seq, dinu_to, codon_to, codon_mimic

Examples

filepath <- system.file("extdata", "example.fasta", package = "SynMut")
rgd.seq <- input_seq(filepath)
set.seed(2019)
get_cu(codon_random(rgd.seq, n = 0.5))
get_cu(codon_random(rgd.seq))

Koohoko/SynMut documentation built on Jan. 9, 2023, 12:11 p.m.