QualityScore-class {ShortRead} | R Documentation

## Quality scores for short reads and their alignments

### Description

This class hierarchy represents quality scores for short reads. `QualityScore` is a virtual base class, with derived classes offering different ways of representing qualities. Methods defined on `QualityScore` are implemented in all derived classes.

### Objects from the Class

Objects from the class are created using constructors (e.g., `NumericQuality`) named after the class name.

Defined classes are as follows:

QualityScore

  Virtual base class; instances cannot be instantiated.

NumericQuality

  A single numeric vector, where values represent quality scores on an arbitrary scale.

IntegerQuality

  A integer numeric vector, where values represent quality scores on an arbitrary scale.

MatrixQuality

  A rectangular matrix of quality scores, with rows representing reads and columns cycles. The content and interpretation of row and column entries is arbitrary; the rectangular nature implies quality scores from equal-length reads.

FastqQuality

  ‘fastq’ encoded quality scores stored in a `BStringSet` instance. Base qualities of a single read are represented as an ASCII character string. The integer-valued quality score of a single base is encoded as its ASCII equivalent plus 33. The precise definition of the integer-valued quality score is unspecified, but is usually a Phred score; the meaning can be determined from the source of the quality scores. Multiple reads are stored as a `BStringSet`, and so can be of varying lengths.

SolexaQuality

  As with `FastqQuality`, but with integer qualities encoded as ASCII equivalent plus 64.

### Extends

Class `".ShortReadBase"`, directly.

### Methods

The following methods are defined on all `QualityScore` and derived classes:

[

  `signature(x = "QualityScore", i = "ANY", j = "missing")`

[

  `signature(x = "MatrixQuality", i = "ANY", j = "missing")`:

  Subset the object, with index `i` indicating the reads for which quality scores are to be extracted. The class of the result is the same as the class of `x`. It is an error to provide any argument other than `i`.

[[

  `signature(x = "QualityScore", i = "ANY", j = "ANY")`:

  Subset the object, returning the quality score (e.g., numeric value) of the `i`th read.

[[

  `signature(x = "MatrixQuality", i = "ANY", j = "ANY")`:

  Returns the vector of quality scores associated with the `i`th read.

dim

  `signature(x = "MatrixQuality")`:

  The integer(2) dimension (e.g., number of reads, read width) represented by the quality score.

length

  `signature(x = "QualityScore")`:

length

  `signature(x = "MatrixQuality")`:

  The integer(1) length (e.g., number of reads) represented by the quality score. Note that `length` of `MatrixQuailty` is the number of rows of the corresponding matrix, and not the length of the corresponding numeric vector.

append

  `signature(x = "QualityScore", values = "QualityScore")`: append `values` after `x`.

width

  `signature(x = "QualityScore")`:

width

  `signature(x = "NumericQuality")`:

width

  `signature(x = "MatrixQuality")`:

width

  `signature(x = "FastqQuality")`:

  A numeric vector with length equal to the number of quality scores, and value equal to the number of quality scores for each read. For instance, a `FastqQuality` will have widths equal to the number of nucleotides in the underlying short read.

show

  `signature(object = "QualityScore")`:

show

  `signature(object = "NumericQuality")`:

show

  `signature(object = "FastqQuality")`:

  provide a brief summary of the object content.

detail

  `signature(x = "QualityScore")`:

  provide a more detailed view of object content.

The following methods are defined on specific classes:

alphabet

  `signature(x = "FastqQuality", ...)`: Return a character vector of valid quality characters.

encoding

  `signature(x = "FastqQuality", ...)`, `signature(x = "SFastqQuality", ...)`: Returns a named character vector of integer encodings.

alphabetFrequency

  `signature(stringSet = "FastqQuality")`:

  Apply `alphabetFrequency` to quality scores, returning a matrix as described in `alphabetFrequency`.

alphabetByCycle

  `signature(stringSet = "FastqQuality")`:

  Apply `alphabetByCycle` to quality scores, returning a matrix as described in `alphabetByCycle`.

alphabetScore

  `signature(object = "FastqQuality")`:

alphabetScore

  `signature(object = "SFastqQuality")`:

alphabetScore

  `signature(object = "PhredQuality")`:

  Apply `alphabetScore` (i.e., summed base quality, per read) to `object`.

coerce

  `signature(from = "FastqQuality", to = "numeric")`:

coerce

  `signature(from = "FastqQuality", to = "matrix")`:

coerce

  `signature(from = "FastqQuality", to = "PhredQuality")`:

coerce

  `signature(from = "SFastqQuality", to = "matrix")`:

coerce

  `signature(from = "SFastqQuality", to = "SolexaQuality")`:

  Use `as(from, "matrix")`) and similar to coerce objects of class `from` to class `to`, using the quality encoding implied by the class. When `to` is “matrix”, the result is a matrix of type `integer` with number of columns equal to the maximum width of `from`; elements `i, j` with `j > width(from)[i]` have value `NA_integer_`. The result always represents the integer encoding of the corresponding quality string.

reverse

  `signature(x = "FastqQuality", ...`: reverse the quality sequence.

narrow

  `signature(x = "FastqQuality", start = NA, end = NA, width = NA, use.names = TRUE)`: ‘narrow’ `quality` so that scores are between `start` and `end` bases, according to `narrow` in the `IRanges` package.

trimTailw

  `signature(object="FastqQuality", k="integer", a="character", halfwidth="integer", ..., ranges=FALSE)`: trim trailing nucleotides when a window of width 2 * halfwidth + 1 contains `k` or more quality scores falling at or below `a`.

trimTails

  `signature(object="FastqQuality", k="integer", a="character", successive=FALSE, ..., ranges=FALSE)`: trim trailing scores if `k` scores fall below the quality encoded by `a`. If `successive=FALSE`, the k'th failing score and all subseqent scores are trimmed. If `successive=TRUE`, failing scores must occur successively; the sequence is trimmed from the first of the successive failing score.

srorder

  `signature(x = "FastqQuality")`:

srrank

  `signature(x = "FastqQuality")`:

srduplicated

  `signature(x = "FastqQuality")`:

  Apply `srsort`, `srorder`, `srrank`, and `srduplicated` to quality scores, returning objects as described on the appropriate help page.

Integer representations of `SFastqQuality` and `FastqQuality` can be obtained with `as(x, "matrix")`.

### Author(s)

Martin Morgan <mtmorgan@fhcrc.org>

### See Also

`NumericQuality` and other constructors.

### Examples

    names(slot(getClass("QualityScore"), "subclasses"))
    encoding(FastqQuality())
    encoding(SFastqQuality())

[Package ShortRead version 1.50.0 Index]