R: Translation from DNA to Amino Acid Sequences

trans {ape} | R Documentation

## Translation from DNA to Amino Acid Sequences

### Description

`trans` translates DNA sequences into amino acids. `complement` returns the (reverse) complement sequences.

### Usage

    trans(x, code = 1, codonstart = 1)
    complement(x)

### Arguments

`x` | an object of class `"DNAbin"` (vector, matrix or list).
`code` | an integer value giving the genetic code to be used. Currently only the genetic codes 1 to 6 are supported.
`codonstart` | an integer giving where to start the translation. This should be 1, 2, or 3, but larger values are accepted and have for effect to start the translation further towards the 3'-end of the sequence.

### Details

With `trans`, if the sequence length is not a multiple of three, a warning message is printed. Alignment gaps are simply ignored (i.e., `AG-` returns `X` with no special warning or message). Base ambiguities are taken into account where relevant: for instance, `GGN`, `GGA`, `GGR`, etc, all return `G`.

See the link given in the References for details about the taxonomic coverage and alternative codons of each code.

### Value

an object of class `"AAbin"` or `"DNAbin"`, respectively.

### Note

These functions are equivalent to `translate` and `comp` in the package seqinr with the difference that there is no need to convert the sequences into character strings.

### Author(s)

Emmanuel Paradis

### References

https://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/index.cgi?chapter=cgencodes

### See Also

`AAbin`, `checkAlignment`, `alview`

### Examples

    data(woodmouse)
    X <- trans(woodmouse) # not correct
    X2 <- trans(woodmouse, 2) # using the correct code
    identical(X, X2)
    alview(X[1:2, 1:60]) # some 'Stop' codons (*)
    alview(X2[, 1:60])
    X2

[Package ape version 5.6 Index]