Learn R Programming

Polyfit (version 1.6.0)

pfNbinomTest: The Polyfit extension to the DESeq functions nbinomTest() and nbinomTestForMatrices()

Description

Polyfit extensions to the DESeq functions nbinomTest and nbinomTestForMatrices which test for differences between the base means of two conditions (i.e., for differential expression in the case of RNA-Seq).

Usage

pfNbinomTest(cds, condA, condB, pvals_only = FALSE, eps = NULL) pfNbinomTestForMatrices(countsA, countsB, sizeFactorsA, sizeFactorsB, dispsA, dispsB )

Arguments

cds
a CountDataSet with size factors and raw variance functions
condA
one of the conditions in 'cds'
condB
another one of the conditions in 'cds'
pvals_only
return only a vector of (unadjusted) p values instead of the data frame described below
eps
This argument is no longer used. Do not use it
countsA
A matrix of counts, where each column is a replicate
countsB
Another matrix of counts, where each column is a replicate
sizeFactorsA
Size factors for the columns of the matrix 'countsA'
sizeFactorsB
Size factors for the columns of the matrix 'countsB'
dispsA
The dispersions for 'countsA', a vector with one value per gene
dispsB
The same for 'countsB'

Value

pfNbinomTest gives a data frame with the following columns:
id
The ID of the observable, taken from the row names of the counts slots.
baseMean
The base mean (i.e., mean of the counts divided by the size factors) for the counts for both conditions
baseMeanA
The base mean (i.e., mean of the counts divided by the size factors) for the counts for condition A
baseMeanB
The base mean for condition B
foldChange
The ratio meanB/meanA
log2FoldChange
The log2 of the fold change
pval
The p value for rejecting the null hypothesis 'meanA==meanB'
padj
The adjusted p values (adjusted with 'p.adjust( pval, method="BH")')
pfNbinomTestForMatrices gives a vector of unadjusted p values, one for each row in the counts matrices.

Details

These functions have the same behaviour as the DESeq functions nbinomTest and nbinomTestForMatrices, except that the `flagpole' in the P-value histogram, particularly at p = 1 is redistributed using the function twoSidedPValueFromDiscrete.

References

Burden, C.J., Qureshi, S. and Wilson, S.R. (2014). Error estimates for the analysis of differential expression from RNA-seq count data, PeerJ PrePrints 2:e400v1.

Anders, S. and Huber, W. (2010). Differential expression analysis for sequence count data. Genome Biology, 11(10), R106.

Examples

Run this code
cds <- makeExampleCountDataSet()
cds <- estimateSizeFactors( cds )
cds <- estimateDispersions( cds )
nbT <- nbinomTest( cds, "A", "B" )
head( nbT )
nbTPolyfit <- pfNbinomTest( cds, "A", "B" )
head( nbTPolyfit )

oldpar <- par(mfrow=c(1,2))
hist(nbT$pval,breaks=seq(0,1,by=0.01), 
   				xlab="P-value", main="DESeq")
hist(nbTPolyfit$pval,breaks=seq(0,1,by=0.01), 
 					xlab="P-value", main="polyfit-DESeq")
par(oldpar)

Run the code above in your browser using DataLab