cpm {edgeR}R Documentation

Counts per Million or Reads per Kilobase per Million

Description

Computes counts per million (CPM) or reads per kilobase per million (RPKM) values.

Usage

## S3 method for class 'DGEList'
cpm(x, normalized.lib.sizes=TRUE, log=FALSE, prior.count=0.25, ...)
## Default S3 method:
cpm(x, lib.size=NULL, log=FALSE, prior.count=0.25, ...)
rpkm(x, gene.length, normalized.lib.sizes=TRUE, log=FALSE, prior.count=0.25)

Arguments

x

matrix of counts or a DGEList object

normalized.lib.sizes

logical, use normalized library sizes?

lib.size

library size, defaults to colSums(x).

log

logical, if TRUE then log2 values are returned.

prior.count

average count to be added to each observation to avoid taking log of zero. Used only if log=TRUE.

gene.length

vector of length nrow(x) giving gene length in bases.

...

other arguments are not currently used

Details

CPM or RPKM values are useful descriptive measures for the expression level of a gene or transcript. By default, the normalized library sizes are used in the computation for DGEList objects but simple column sums for matrices.

If log-values are computed, then a small count, given by prior.count but scaled to be proportional to the library size, is added to x to avoid taking the log of zero.

Value

numeric matrix of CPM or RPKM values.

Note

aveLogCPM(x), rowMeans(cpm(x,log=TRUE)) and log2(rowMeans(cpm(x)) all give slightly different results.

Author(s)

Davis McCarthy, Gordon Smyth

See Also

aveLogCPM

Examples

y <- matrix(rnbinom(20,size=1,mu=10),5,4)
cpm(y)
d <- DGEList(counts=y, lib.size=1001:1004)
cpm(d)
cpm(d,log=TRUE)

[Package edgeR version 3.4.2 Index]