| DNAString-class {Biostrings} | R Documentation |
A DNAString object allows efficient storage and manipulation of a long DNA sequence.
The DNAString class is a direct XString subtype (with no additional slot). Therefore all functions and methods described in the XString man page also work with a DNAString object (inheritance).
Unlike the BString container that allows storage of any single string (based on a single-byte character set) the DNAString container can only store a string based on the DNA alphabet (see below). In addition, the letters stored in a DNAString object are encoded in a way that optimizes fast search algorithms.
This alphabet contains all letters from the
IUPAC Extended Genetic Alphabet (see ?IUPAC_CODE_MAP)
+ the gap ("-") and the hard masking ("+") letters.
It is stored in the DNA_ALPHABET constant (character vector).
The alphabet method also returns
DNA_ALPHABET when applied to a DNAString
object and is provided for convenience only.
In the code snippet below,
x can be a single string (character vector of length 1),
a BString object or an RNAString object.
DNAString(x, start=1, nchar=NA, check=TRUE):
Tries to convert x into a DNAString object by reading
nchar letters starting at position start in x.
In the code snippet below, x is a DNAString object.
alphabet(x):
If x is a DNAString object, then return the DNA
alphabet (see above).
See the corresponding man pages when x is a
BString, RNAString or AAString object.
H. Pages
IUPAC_CODE_MAP,
letter,
XString-class,
RNAString-class,
reverseComplement,
alphabetFrequency
DNA_ALPHABET
d <- DNAString("TTGAAAA-CTC-N")
length(d)
alphabet(d)