Translate DNA/RNA sequences into amino acids

seq_translate(x, code = 1, codon_frame = 1, codon_init = FALSE)

Arguments

x

a vector of DNA (bioseq_dna) or RNA (bioseq_rna).

code

an integer indicating the genetic code to use for translation (default 1 uses the Standard genetic code). See Details.

codon_frame

an integer giving the nucleotide position where to start translation.

codon_init

a logical indicating whether the first codon is evaluated as a possible codon start and translated to methionine.

Value

An amino acid vector (bioseq_aa).

Details

Several genetic codes can be used for translation. See genetic-codes to get the list of available genetic codes and their ID number.

Gaps (-) are interpreted as unknown nucleotides (N) but can be removed prior to the translation with the function seq_remove_gap.

The function deals with ambiguities on both sides. This means that if ambiguous codons cannot be translated to amino acid, they are translated to the most specific ambiguous amino acids (X in the most extreme case).

See also

Other biological operations: rev_complement, seq_rev_translate(), transcription

Examples

x <- dna(c("ATGCAGA", "GGR","TTGCCTAGKTGAACC", "AGGNGC", "NNN"))
seq_translate(x)
#> AA vector of 5 sequences
#> >   MQ
#> >   G
#> >   LPX*T
#> >   RX
#> >   X