R/edger.R
edger_confects.Rd
For all possible absolute log2 fold changes (LFC), which genes have at least this fold change at a specified False Discovery Rate?
edger_confects(fit, coef = NULL, contrast = NULL, fdr = 0.05, step = 0.01, null = "worst.case")
fit | An edgeR DGEGLM object produced using |
---|---|
coef | Coefficient to test, as per |
contrast | Contrast to test, as per |
fdr | False Discovery Rate to control for. |
step | Granularity of log2 fold changes to test. |
null | "null" parameter passed through to edger::glmTreat (if coef or contrast given). Choices are "worst.case" or "interval". Note that the default here is "worst.case", to be consistent with other functions in topconfects. This differs from the default for glmTreat. |
See nest_confects
for details of how to interpret the result.
Results are presented in a table such that for any given LFC, if the reader chooses the genes with abs(confect) less than this they are assured that this set of genes has at least this LFC (with the specified FDR). The confect column may also be viewed as a confidence bound on the LFC of each gene, with a dynamic correction for multiple testing.
# Generate some random data n <- 100 folds <- seq(-4,4,length.out=n) row_means <- runif(n, min=0, max=5) lib_scale <- c(1,2,3,4) means <- 2^(outer(folds, c(-0.5,-0.5,0.5,0.5))) * row_means * rep(lib_scale,each=n) counts <- rnbinom(length(means), mu=means, size=1/0.1) dim(counts) <- dim(means) design <- cbind(c(1,1,0,0), c(0,0,1,1)) # Fit data using edgeR quasi-likelihood library(edgeR) y <- DGEList(counts) y <- calcNormFactors(y) y <- estimateDisp(y, design) fit <- glmQLFit(y, design) # Find top confident effect sizes edger_confects(fit, contrast=c(-1,1))#> $table #> rank index confect effect logCPM name #> 1 100 2.11 8.097865 14.69108 100 #> 2 6 -2.06 -5.428159 13.81863 6 #> 3 1 -1.84 -4.635763 13.83865 1 #> 4 97 1.84 5.119667 15.29797 97 #> 5 93 1.84 5.194132 14.55974 93 #> 6 90 1.71 4.927676 14.33546 90 #> 7 89 1.45 4.572224 14.08565 89 #> 8 91 1.44 4.474489 13.97148 91 #> 9 23 -1.44 -5.863799 12.55957 23 #> 10 22 -1.39 -3.554236 13.80631 22 #> ... #> 54 of 100 non-zero log2 fold change at FDR 0.05 #> Prior df Inf #> Dispersion 0.089 to 0.12 #> Biological CV 29.8% to 34.3%