Description Usage Arguments Details Value Author(s) See Also Examples
Calculate counts-per-million (CPM) values for each feature.
1 2 | calculateCPM(object, use.norm.factors=TRUE, use.offsets=FALSE,
log=TRUE, prior.count=1, assay.id="counts")
|
object |
A SummarizedExperiment object containing a count matrix, as produced by |
use.norm.factors |
A logical scalar indicating whether to use normalization factors, if available. |
use.offsets |
A logical scalar indicating whether to use offsets, if available. |
log |
A logical scalar indicating whether log2-transformed CPM values should be returned. |
prior.count |
A numeric scalar specifying the prior count to add when |
assay.id |
A string or integer scalar indicating which assay of |
CPMs are calculated in the standard manner when log=FALSE
, use.offsets=FALSE
and use.norm.factors=FALSE
.
When log=TRUE
, a library size-adjusted prior count is added to both the counts and the library sizes, see cpm
for details.
When use.norm.factors=TRUE
, the effective library size is used for computing CPMs, provided that normalization factors are available in object
.
This is defined as the product of the library size in object$totals
and the normalization factor in object$norm.factors
.
If use.offsets=TRUE
, the offsets are converted into effective library sizes using scaleOffset
.
If log=TRUE
, this is done after addition of a prior count to both the counts and library sizes, see addPriorCount
for details.
A matrix of the same dimensions as object
, containing (log-)transformed CPM values for each feature in each sample.
Aaron Lun
cpm
,
scaleOffset
,
addPriorCount
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | bamFiles <- system.file("exdata", c("rep1.bam", "rep2.bam"), package="csaw")
data1 <- windowCounts(bamFiles, width=50, filter=1)
head(calculateCPM(data1))
data1$norm.factors <- c(0.5, 1.5)
head(calculateCPM(data1))
head(calculateCPM(data1, log=FALSE))
# With offsets:
assay(data1, "offset") <- matrix(rnorm(nrow(data1)*ncol(data1)),
nrow=nrow(data1), ncol=ncol(data1))
head(calculateCPM(data1, use.offsets=TRUE))
head(calculateCPM(data1, use.offsets=FALSE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.