equalizeLibSizes {edgeR}R Documentation

Quantile Adjustment to Equalize Library Sizes for a Fixed Value of the Dispersion Parameter

Description

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.

Usage

equalizeLibSizes(object, disp=0, N=exp(mean(log(object$samples$lib.size*object$samples$norm.factors))),null.hypothesis=FALSE)

Arguments

object

DGEList object containing the raw counts with elements counts (table of counts), group (vector indicating group) and lib.size (vector of library sizes)

disp

numeric scalar or vector of dispersion parameters; if a scalar, then a common dispersion parameter is used for all tags

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 input.mean and output.mean under the null hypothesis; default is FALSE

Details

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.

Value

A list with elements

pseudo

numeric matrix of pseudocounts, i.e. adjusted counts for equalized libraries

conc

list with elements conc.common (vector giving overall proportion/concentration for each tag), and conc.group (matrix with columns giving estimates of tag/gene concentrations (proportion of total RNA for that group that that particular tag/gene contributes) for different groups); output from estimatePs

N

normalized library size

Author(s)

Mark Robinson, Davis McCarthy

Examples

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)

[Package edgeR version 2.4.3 Index]