translate: Convert DNA or RNA into proteins using genetic code

View source: R/translate.R

translateR 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

[sq_dna_bsc || sq_rna_bsc]
An object this function is applied to.

table

[integer(1)]
The number of translation table used, as specified here.

...

further arguments to be passed from or to other methods.

NA_letter

[character(1)]
A string that is used to interpret and display NA value in the context of sq class. Default value equals to "!".

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)


michbur/tidysq documentation built on April 1, 2022, 5:18 p.m.