Description Usage Arguments Details Value Note Author(s) See Also Examples
Compute counts per million (CPM) or reads per kilobase per million (RPKM).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## S3 method for class 'DGEList'
cpm(y, normalized.lib.sizes = TRUE,
log = FALSE, prior.count = 2, ...)
## S3 method for class 'SummarizedExperiment'
cpm(y, normalized.lib.sizes = TRUE,
log = FALSE, prior.count = 2, ...)
## S3 method for class 'DGEGLM'
cpm(y, log = FALSE, shrunk = TRUE, ...)
## Default S3 method:
cpm(y, lib.size = NULL, offset=NULL,
log = FALSE, prior.count = 2, ...)
## S3 method for class 'DGEList'
rpkm(y, gene.length = NULL, normalized.lib.sizes = TRUE,
log = FALSE, prior.count = 2, ...)
## S3 method for class 'SummarizedExperiment'
rpkm(y, gene.length = NULL, normalized.lib.sizes = TRUE,
log = FALSE, prior.count = 2, ...)
## S3 method for class 'DGEGLM'
rpkm(y, gene.length, log = FALSE, shrunk = TRUE, ...)
## Default S3 method:
rpkm(y, gene.length, lib.size = NULL, offset=NULL,
log = FALSE, prior.count = 2, ...)
## S3 method for class 'DGEList'
cpmByGroup(y, group = NULL, dispersion = NULL, ...)
## S3 method for class 'SummarizedExperiment'
cpmByGroup(y, group = NULL, dispersion = NULL, ...)
## Default S3 method:
cpmByGroup(y, group = NULL, dispersion = 0.05,
offset = NULL, weights = NULL, log = FALSE, prior.count = 2, ...)
## S3 method for class 'DGEList'
rpkmByGroup(y, group = NULL, gene.length = NULL, dispersion = NULL, ...)
## S3 method for class 'SummarizedExperiment'
rpkmByGroup(y, group = NULL, gene.length = NULL, dispersion = NULL, ...)
## Default S3 method:
rpkmByGroup(y, group = NULL, gene.length, dispersion = 0.05,
offset = NULL, weights = NULL, log = FALSE, prior.count = 2, ...)
|
y |
a matrix-like object containing counts.
Can be a numeric matrix, a |
normalized.lib.sizes |
logical, use normalized library sizes? |
lib.size |
library size, defaults to |
offset |
numeric matrix of same size as |
log |
logical, if |
prior.count |
average count to be added to each observation to avoid taking log of zero. Used only if |
shrunk |
logical, if |
gene.length |
vector of length |
group |
factor giving group membership for columns of |
dispersion |
numeric vector of negative binomial dispersions. |
weights |
numeric vector or matrix of non-negative quantitative weights.
Can be a vector of length equal to the number of libraries, or a matrix of the same size as |
... |
other arguments are not used. |
CPM or RPKM values are useful descriptive measures for the expression level of a gene.
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 y
to avoid taking the log of zero.
The rpkm
methods for DGEList
, DGEGLM
or DGELRT
objects will try to find the gene lengths in a column of y$genes
called Length
or length
.
Failing that, it will look for any column name containing "length"
in any capitalization.
The cpm
and rpkm
methods for DGEGLM
and DGELRT
fitted model objects return fitted CPM or RPKM values.
If shrunk=TRUE
, then the CPM or RPKM values will reflect the prior.count
input to the original linear model fit.
If shrunk=FALSE
, then the CPM or RPKM values will be computed with prior.count=0
.
Note that the latter could result in taking the log of near-zero values if log=TRUE
.
cpmByGroup
and rpkmByGroup
compute group average values on the unlogged scale.
A numeric matrix of CPM or RPKM values, on the log2 scale if log=TRUE
.
cpm
and rpkm
produce matrices of the same size as y
.
If y
was a data object, then observed values are returned.
If y
was a fitted model object, then fitted values are returned.
cpmByGroup
and rpkmByGroup
produce matrices with a column for each level of group
.
aveLogCPM(y)
, rowMeans(cpm(y,log=TRUE))
and log2(rowMeans(cpm(y))
all give slightly different results.
Davis McCarthy, Gordon Smyth, Yunshun Chen, Aaron Lun
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.