equalizeLibSizes {edgeR} | R Documentation |
A function that uses a NB quantile-to-quantile method to adjust the libraries of counts so that library sizes are equal for a fixed value of the dispersion parameter.
equalizeLibSizes(object, disp=0, N=exp(mean(log(object$samples$lib.size*object$samples$norm.factors))),null.hypothesis=FALSE)
object |
|
disp |
numeric scalar or vector of |
N |
numeric scalar, the library size to normalize to; default is the geometric mean of the original library sizes |
null.hypothesis |
logical, whether to calculate the |
The function equalizeLibSizes
provides the necessary framework and calculations to call q2qnbinom
, for given value(s) of the dispersion parameter. The function q2qnbinom
actually generates the pseudocounts, the counts that have been adjusted for normalized library sizes. These pseudocounts are required to estimate the dispersion parameter, as the methods used by estimateCommonDisp
and estimateTagwiseDisp
rely on the assumption of equal library sizes. This function calls estimatePs
to estimate the expression proportion for each tag, which is needed to calculate the input.mean
and output.mean
for each tag, which are passed to q2qnbinom
along with the unadjusted counts and the fixed value(s) for the dispersion parameter.
A list with elements
pseudo |
numeric matrix of pseudocounts, i.e. adjusted counts for equalized libraries |
conc |
list with elements |
N |
normalized library size |
Mark Robinson, Davis McCarthy
y<-matrix(rnbinom(10000,size=2,mu=10),ncol=4) d<-DGEList(counts=y,group=rep(1:2,each=2),lib.size=rep(c(1000,1010),2)) ps<-estimatePs(d,r=2) q2q.out<-equalizeLibSizes(d,disp=0.5,null.hypothesis=FALSE)