calculateCPM: Calculate CPMs

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Calculate counts-per-million (CPM) values from the count data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
calculateCPM(x, ...)

## S4 method for signature 'ANY'
calculateCPM(
  x,
  size.factors = NULL,
  subset.row = NULL,
  size_factors = NULL,
  subset_row = NULL
)

## S4 method for signature 'SummarizedExperiment'
calculateCPM(x, ..., assay.type = "counts", exprs_values = NULL)

## S4 method for signature 'SingleCellExperiment'
calculateCPM(x, size.factors = NULL, ...)

Arguments

x

A numeric matrix of counts where features are rows and cells are columns.

Alternatively, a SummarizedExperiment or a SingleCellExperiment containing such counts.

...

For the generic, arguments to pass to specific methods.

For the SummarizedExperiment method, further arguments to pass to the ANY method.

For the SingleCellExperiment method, further arguments to pass to the SummarizedExperiment method.

size.factors

A numeric vector containing size factors to adjust the library sizes. If NULL, the library sizes are used directly.

subset.row

A vector specifying the subset of rows of x for which to return a result.

size_factors, subset_row, exprs_values

Soft-deprecated counterparts to the arguments above.

assay.type

A string or integer scalar specifying the assay of x containing the count matrix.

Details

If size.factors are provided or available in x, they are used to define the effective library sizes. This is done by scaling all size factors such that the mean factor is equal to the mean sum of counts across all features. The effective library sizes are then used as the denominator of the CPM calculation.

Value

A numeric matrix of CPM values with the same dimensions as x (unless subset.row is specified).

Author(s)

Aaron Lun

See Also

normalizeCounts, on which this function is based.

Examples

1
2
3
example_sce <- mockSCE()
cpm(example_sce) <- calculateCPM(example_sce)
str(cpm(example_sce))

scuttle documentation built on Dec. 19, 2020, 2 a.m.