translate {tidysq} | R Documentation |
Convert DNA or RNA into proteins using genetic code
Description
This function allows the user to input DNA or RNA sequences and acquire sequences of corresponding proteins, where correspondence is encoded in specified table.
Usage
translate(x, table = 1, ...)
## S3 method for class 'sq_dna_bsc'
translate(x, table = 1, ..., NA_letter = getOption("tidysq_NA_letter"))
## S3 method for class 'sq_rna_bsc'
translate(x, table = 1, ..., NA_letter = getOption("tidysq_NA_letter"))
Arguments
x |
[ |
table |
[ |
... |
further arguments to be passed from or to other methods. |
NA_letter |
[ |
Details
DNA and RNA sequences use combinations of three consecutive nucleic acids to encode one of 22 amino acids. This encoding is called "genetic code".
translate()
first splits passed DNA or RNA sequences into
three-letter chunks. Then searches the codon table for the entry where the
key is equal to the current chunk and the value is one letter that encodes
the corresponding protein. These resulting letters are then pasted into one
sequence for each input sequence.
Due to how the tables works, translate()
does not support inputting
sequences with extended alphabets, as ambiguous letters in most cases cannot
be translated into exactly one protein.
Moreover, this function raises an error whenever input sequence contain
either "-
" or NA
value.
Value
An object of class sq
with ami_bsc
type.
See Also
remove_ambiguous
, substitute_letters
and
typify
for necessary actions before using translate()
Functions interpreting sq in biological context:
%has%()
,
complement()
,
find_motifs()
Examples
sq_dna <- sq(c("TACTGGGCATGA", "CAGGTC", "TAGTCCTAG"), alphabet = "dna_bsc")
translate(sq_dna)