| conversion | R Documentation |
These functions convert DNA and amino acid sequences in "DNAbin" or "AAbin" format to concatenated character strings, and vice versa.
dna2char(x)
aa2char(x)
char2dna(z, simplify = FALSE)
char2aa(z, simplify = FALSE)
x |
a "DNAbin" or "AAbin" object. |
z |
a vector of concatenated strings representing DNA or amino acid sequences in upper case. |
simplify |
logical indicating whether length-one "DNAbin" or "AAbin" objects should be simplified to vectors. Defaults to FALSE. |
These functions are used to convert concatenated character strings
(e.g. "TAACGC") to binary format and vice versa.
To convert DNAbin and AAbin objects to non-concatenated
character objects (e.g. c("T", "A", "A", "C", "G", "C"))
refer to the ape package functions
as.character.DNAbin and
as.character.AAbin.
Likewise the ape package functions
as.DNAbin and as.AAbin
are used to convert non-concatenated character
objects to binary format.
dna2char and aa2char return vectors of upper case
character strings.
char2dna and char2aa return "DNAbin" and "AAbin" objects,
respectively. These will be lists unless the input object
has length one and simplify = TRUE, in which case the returned object
will be a vector.
Shaun Wilkinson
Paradis E, Claude J, Strimmer K, (2004) APE: analyses of phylogenetics and evolution in R language. Bioinformatics 20, 289-290.
Paradis E (2007) A bit-level coding scheme for nucleotides. https://emmanuelparadis.github.io/misc/BitLevelCodingScheme_20April2007.pdf.
Paradis E (2012) Analysis of Phylogenetics and Evolution with R (Second Edition). Springer, New York.
char2dna("TAACGC")
char2aa("VGAHAGEY")
dna2char(char2dna("TAACGC"))
aa2char(char2aa("VGAHAGEY"))
char2dna(list(seq1 = "TAACGC", seq2 = "ATTGCG"))
char2aa(list(seq1 = "VGAHAGEY", seq2 = "VNVDEV"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.