Description Usage Arguments Format Details Value Examples
Translate a vector of nucleotide sequences into a vector of protein sequences.
1 2 3 4 | translate(x, type = Biostrings::DNAStringSet, translation = TRANSLATION,
start = "ATG", ambiguities = "solve")
TRANSLATION
|
x |
Sequences to translate. Must only contain valid IUPAC DNA or RNA characters. |
type |
Used to coerce x to a class compatible with Biostrings::translate. Typically one of Biostrings::DNAStringSet, or Biostrings::RNAStringSet. Defaults to Biostrings::DNAStringSet. |
translation |
Amino acid letters with names corresponding to each of the 64 possible DNA
codons. Defaults to |
start |
Start codons. The first occurence of one of these codons will be
translated to |
abiguities |
How ambiguities be handled. See Biostrings::translate for more details.
Defaults to |
TRANSLATION - A named character
vector with length 64. Names
correspond to codons, values correspond to single letter amino acid codes,
and '*' for stop.
This function is a simple wrapper around Biostrings::translate that
takes a character vector as input and a returns a character vector.
The default behavior is slightly different in that ambiguous bases will
be solved rather than causing an error, and alternative start codons are
not used without being explicitly specified with the start
parameter.
This prevents a common "gotcha" when translating a subsequence with
Biostrings::translate using the default Biostrings::GENETIC_CODE
where it would unexpectedly translate "TTG"
, or "CTG"
to "M"
rather
than "L"
without any warning. To reproduce this behavior, simply specify
start = c('ATG', 'TTG', 'CTG')
which is only sensible if you are
translating an entire coding sequence.
Returns a character vector with the same length as x
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Default settings assume DNA input and will attempt to solve ambiguity
translate(c('ATGAAAGGRTGA', 'ATGGGRRAATAA'))
# RNA can also be translated
translate('AUGAAAGGRUGA', type = Biostrings::RNAStringSet)
# Alternative start codons may be specified
translate(c('AAAATGAAA', 'ATGAAAAAA'), start = c('ATG', 'AAA'))
# Alternative translation code can be specified
codon_code <- TRANSLATION
codon_code['TGG'] <- 'R'
translate(c('AAATGGTGG', 'ATGTGGTGG'), translation = codon_code)
# Other common translation tables
Biostrings::GENETIC_CODE_TABLE
Biostrings::getGeneticCode('Yeast Mitochondrial', full.search = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.