cpm {edgeR} | R Documentation |
Returns counts per million from a DGEList or matrix object by dividing raw counts by library size (which can be normalized) and multiplying by one million.
cpm(x, normalized.lib.sizes=FALSE)
x |
either a matrix of counts or a |
normalized.lib.sizes |
logical, should the library sizes (total sum of counts for each library) be normalized using the |
A convenience function to compute the counts per million for plotting and comparing libraries on a convenient scale. Essentially just does the calculation 1e06*t(t(x)/lib.size)
to produce counts per million, where x
is a matrix of counts and the lib.size
can be the total sum of counts in each library or a normalized version of this using TMM normalization or equivalent method.
getPriorN
returns a numeric scalar
Davis McCarthy, Gordon Smyth
DGEList
for more information about the DGEList
class.
# generate raw counts from NB, create list object y<-matrix(rnbinom(20,size=1,mu=10),nrow=5) cpm(y) d<-DGEList(counts=y,group=rep(1:2,each=2),lib.size=rep(c(1000:1001),2)) # When applied to a DGEList object, x$samples$lib.size is used cpm(d) # As x$samples$lib.size here is very different from colSums(y), cpm(y) and cpm(d) give very different results for the counts per million