\HeaderA{RNAString-class}{RNAString objects}{RNAString.Rdash.class}
\aliasA{class:RNAString}{RNAString-class}{class:RNAString}
\aliasA{RNAString}{RNAString-class}{RNAString}
\aliasA{RNA\_ALPHABET}{RNAString-class}{RNA.Rul.ALPHABET}
\aliasA{RNA\_BASES}{RNAString-class}{RNA.Rul.BASES}
\keyword{methods}{RNAString-class}
\keyword{classes}{RNAString-class}
\begin{Description}\relax
An RNAString object allows efficient storage
and manipulation of a long RNA sequence.
\end{Description}
\begin{Details}\relax
The RNAString 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 an RNAString object (inheritance).

Unlike the \LinkA{BString}{BString} container that allows storage
of any single string (based on a single-byte character set)
the RNAString container can only store a string
based on the RNA alphabet (see below).
In addition, the letters stored in an RNAString object
are encoded in a way that optimizes fast search algorithms.
\end{Details}
\begin{Section}{The RNA alphabet}
This alphabet contains all letters from the
IUPAC Extended Genetic Alphabet (see \code{?\LinkA{IUPAC\_CODE\_MAP}{IUPAC.Rul.CODE.Rul.MAP}})
where \code{"T"} is replaced by \code{"U"}
+ the gap (\code{"-"}) and the hard masking (\code{"+"}) letters.
It is stored in the \code{RNA\_ALPHABET} constant (character vector).
The \code{alphabet} method also returns
\code{RNA\_ALPHABET} when applied to an RNAString
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 a \LinkA{DNAString}{DNAString} object.

\describe{
\item[] \code{RNAString(x="", start=1, nchar=NA)}:
Tries to convert \code{x} into an RNAString 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 an RNAString object.

\describe{
\item[] \code{alphabet(x, baseOnly=FALSE)}:
If \code{x} is an RNAString object, then return the RNA
alphabet (see above).
See the corresponding man pages when \code{x} is a
\LinkA{BString}{BString}, \LinkA{DNAString}{DNAString} 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{DNAString-class}{DNAString.Rdash.class},
\code{\LinkA{reverseComplement}{reverseComplement}},
\code{\LinkA{alphabetFrequency}{alphabetFrequency}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  RNA_BASES
  RNA_ALPHABET
  d <- DNAString("TTGAAAA-CTC-N")
  r <- RNAString(d)
  r
  alphabet(r)                 # RNA_ALPHABET
  alphabet(r, baseOnly=TRUE)  # RNA_BASES

  ## When comparing an RNAString object with a DNAString object,
  ## U and T are considered equals:
  r == d  # TRUE
\end{ExampleCode}
\end{Examples}

