RNAString-class {Biostrings} | R Documentation

## RNAString objects

### Description

An RNAString object allows efficient storage and manipulation of a long RNA sequence.

### Details

The RNAString class is a direct XString subtype (with no additional slot). Therefore all functions and methods described in the XString man page also work with an RNAString object (inheritance).

Unlike the 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.

### The RNA alphabet

This alphabet contains all letters from the IUPAC Extended Genetic Alphabet (see `?IUPAC_CODE_MAP`) where `"T"` is replaced by `"U"` + the gap (`"-"`) and the hard masking (`"+"`) letters. It is stored in the `RNA_ALPHABET` constant (character vector). The `alphabet` method also returns `RNA_ALPHABET` when applied to an RNAString object and is provided for convenience only.

### Constructor-like functions and generics

In the code snippet below, `x` can be a single string (character vector of length 1), a BString object or a DNAString object.

  `RNAString(x, start=1, nchar=NA, check=TRUE)`: Tries to convert `x` into an RNAString object by reading `nchar` letters starting at position `start` in `x`.

### Accessor methods

In the code snippet below, `x` is an RNAString object.

  `alphabet(x)`: If `x` is an RNAString object, then return the RNA alphabet (see above). See the corresponding man pages when `x` is a BString, DNAString or AAString object.

### Author(s)

H. Pages

### See Also

`IUPAC_CODE_MAP`, `letter`, XString-class, DNAString-class, `reverseComplement`, `alphabetFrequency`

### Examples

      d <- DNAString("TTGAAAA-CTC-N")
      r <- RNAString(d)
      r
      alphabet(r)
      RNA_ALPHABET

      ## When comparing an RNAString object with a DNAString object,
      ## U and T are considered equals:
      r == d

[Package Biostrings version 2.8.18 Index]