BString-class {Biostrings} | R Documentation |
The BString
class is a general container for storing
a big string (a long sequence of characters) and to make its
manipulation easy and efficient.
The DNAString
, RNAString
and AAString
classes are direct BString
derivations with the more specific purpose of storing a DNA sequence
(DNAString
), a RNA sequence (RNAString
)
or a sequence of amino acids (AAString
).
The 2 main differences between a BString
object
and a standard character vector are:
(1) the data stored in a BString
object are not copied
on object duplication and (2) a BString
can only store
a single string (see the BStringViews
for an
efficient way to store a collection of big strings in a single object).
A BString
object can be used to store any non-empty
string based on a single-byte character set.
In the code snippets below,
x
is a BString
(or derived) object
and i
is a numeric vector.
letter(x, i)
:
[TODO: Document me]
In the code snippet below,
src
can be a character vector
or a BString
(or derived) object.
BString(src)
:
[TODO: Document me]
In the code snippets below,
x
, object
, e1
and e2
are BString
(or derived) objects,
and i
is a numeric vector.
length(x)
or nchar(x)
:
Used to get the length of a BString
, i.e., its number of letters
x[i]
:
[TODO: Document me]
e1 == e2
:
[TODO: Document me]
e1 != e2
:
[TODO: Document me]
as.character(x)
:
[TODO: Document me]
toString(x)
:
[TODO: Document me]
In the code snippets below,
x
is a BString
(or derived) object
and first
and last
are single numerics.
subBString(x, first, last)
:
[TODO: Document me]
H. Pages
DNAString-class, RNAString-class, AAString-class BStringViews-class
b <- BString("I am a BString object") length(b)