| aveLogCPM {edgeR} | R Documentation |
Compute average log2 counts-per-million for each row of counts.
## S3 method for class 'DGEList' aveLogCPM(y, normalized.lib.sizes=TRUE, prior.count=2, dispersion=0.05, ...) ## Default S3 method: aveLogCPM(y, lib.size=NULL, prior.count=2, dispersion=0.05, ...)
y |
numeric matrix containing counts. Rows for tags and columns for libraries. |
normalized.lib.sizes |
logical, use normalized library sizes? |
lib.size |
numeric vector of library sizes. Defaults to |
prior.count |
average value to be added to each count, to avoid infinite values on the log-scale. |
dispersion |
numeric scalar or vector of negative-binomial dispersions. |
... |
other arguments are not currently used |
This function uses mglmOneGroup to compute average counts-per-million (AveCPM) for each row of counts, and returns log2(AveCPM).
An average value of prior.count is added to the counts before running mglmOneGroup.
This function is similar to rowMeans(cpm(y, log=TRUE, ...)), but with the refinement that larger library sizes are given more weight in the average.
This function converges to rowMeans(cpm(y, log=TRUE, ...)) for large values of dispersion,
Numeric vector giving log2(AveCPM) for each row of y.
Gordon Smyth
See cpm for individual logCPM values, rather than tagwise averages.
The computations for aveLogCPM are done by mglmOneGroup.
y <- matrix(c(0,100,30,40),2,2) lib.size <- c(1000,10000) # With disp large, the function is equivalent to row-wise averages of individual cpms: aveLogCPM(y, dispersion=1e4) cpm(y, log=TRUE, prior.count=2) # With disp=0, the function is equivalent to pooling the counts before dividing by lib.size: aveLogCPM(y,prior.count=0,dispersion=0) cpms <- rowSums(y)/sum(lib.size)*1e6 log2(cpms)