\HeaderA{DNAString-class}{DNAString objects}{DNAString.Rdash.class}
\aliasA{class:DNAString}{DNAString-class}{class:DNAString}
\aliasA{DNAString}{DNAString-class}{DNAString}
\aliasA{DNA\_ALPHABET}{DNAString-class}{DNA.Rul.ALPHABET}
\aliasA{DNA\_BASES}{DNAString-class}{DNA.Rul.BASES}
\keyword{methods}{DNAString-class}
\keyword{classes}{DNAString-class}
\begin{Description}\relax
A DNAString object allows efficient storage
and manipulation of a long DNA sequence.
\end{Description}
\begin{Details}\relax
The DNAString class is a direct \LinkA{XString}{XString} subclass
(with no additional slot).
Therefore all functions and methods described in the
\LinkA{XString}{XString} man page also work
with a DNAString object (inheritance).

Unlike the \LinkA{BString}{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.
\end{Details}
\begin{Section}{The DNA alphabet}
This alphabet contains all letters from the
IUPAC Extended Genetic Alphabet (see \code{?\LinkA{IUPAC\_CODE\_MAP}{IUPAC.Rul.CODE.Rul.MAP}})
+ the gap (\code{"-"}) and the hard masking (\code{"+"}) letters.
It is stored in the \code{DNA\_ALPHABET} constant (character vector).
The \code{alphabet} method also returns
\code{DNA\_ALPHABET} when applied to a DNAString
object and is provided for convenience only.
\end{Section}
\begin{Section}{Constructor-like functions and generics}
In the code snippet below,
\code{x} can be a single string (character vector of length 1),
a \LinkA{BString}{BString} object or an \LinkA{RNAString}{RNAString} object.

\describe{
\item[] \code{DNAString(x="", start=1, nchar=NA)}:
Tries to convert \code{x} into a DNAString object by reading
\code{nchar} letters starting at position \code{start} in \code{x}.

}
\end{Section}
\begin{Section}{Accessor methods}
In the code snippet below, \code{x} is a DNAString object.

\describe{
\item[] \code{alphabet(x, baseOnly=FALSE)}:
If \code{x} is a DNAString object, then return the DNA
alphabet (see above).
See the corresponding man pages when \code{x} is a
\LinkA{BString}{BString}, \LinkA{RNAString}{RNAString} or \LinkA{AAString}{AAString} object.

}
\end{Section}
\begin{Author}\relax
H. Pages
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{IUPAC\_CODE\_MAP}{IUPAC.Rul.CODE.Rul.MAP}},
\code{\LinkA{letter}{letter}},
\LinkA{XString-class}{XString.Rdash.class},
\LinkA{RNAString-class}{RNAString.Rdash.class},
\code{\LinkA{reverseComplement}{reverseComplement}},
\code{\LinkA{alphabetFrequency}{alphabetFrequency}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  DNA_BASES
  DNA_ALPHABET
  d <- DNAString("TTGAAAA-CTC-N")
  length(d)
  alphabet(d)                 # DNA_ALPHABET
  alphabet(d, baseOnly=TRUE)  # DNA_BASES
\end{ExampleCode}
\end{Examples}

