RNAString-class {Biostrings} | R Documentation |
A RNAString
object allows efficient storage
and manipulation of a long RNA sequence.
The RNAString
class derives directly from the
BString
class (with no additional slot).
All functions and methods described in the
BString
man page also work
with a RNAString
object (inheritance).
Unlike a BString
object that allows storage
of any non-empty string (based on a single-byte character set)
a RNAString
object can only store a non-empty string
based on the RNAString alphabet (see below).
In addition, the letters stored in a RNAString
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
)
where "T"
is replaced by "U"
+ the gap letter "-"
.
It is stored in the RNA_ALPHABET
constant (character vector).
The alphabet
method also returns
RNA_ALPHABET
when applied to a RNAString
object and is provided for convenience only.
In the code snippet below,
src
can be a character vector
or a BString
(or derived) object.
RNAString(src)
:
Tries to convert src
into an RNAString
object.
src
can be a single string (character vector of length 1),
a BString object or a DNAString object.
In the code snippets below,
x
must be a BString
(or derived) object.
alphabet(x)
:
If x
is of class RNAString
, return the RNAString
alphabet (see above).
See the corresponding man pages when x
is of class
BString
, DNAString
or AAString
.
H. Pages
IUPAC_CODE_MAP
,
letter
,
subBString
,
BString-class,
DNAString-class,
BStringViews-class
d <- DNAString("TTGAAAA-CTC-N") r <- RNAString(d) # reflects the transcription processus alphabet(r) RNA_ALPHABET ## Note that comparing an RNAString instance with a DNAString ## instance is possible (and very fast): RNAString("GAAAU") == DNAString("CTTTA") # TRUE