S4 class to store data from differentially expression analysis. It should be compatible with different package and stores the information in a way the methods will work with all of them.

DEGSet(resList, default)

DEGSet(resList, default)

as.DEGSet(object, ...)

# S4 method for TopTags
as.DEGSet(object, default = "raw", extras = NULL)

# S4 method for data.frame
as.DEGSet(object, contrast, default = "raw",
  extras = NULL)

# S4 method for DESeqResults
as.DEGSet(object, default = "shrunken",
  extras = NULL)

Arguments

resList

List with results as elements containing log2FoldChange, pvalues and padj as column. Rownames should be feature names. Elements should have names.

default

The name of the element to use by default.

object

Different objects to be transformed to DEGSet when using as.DEGSet.

...

Optional parameters of the generic.

extras

List of extra tables related to the same comparison when using as.DEGSet.

contrast

To name the comparison when using as.DEGSet.

Details

For now supporting only DESeq2::results() output. Use constructor degComps() to create the object.

The list will contain one element for each comparison done. Each element has the following structure:

  • DEG table

  • Optional table with shrunk Fold Change when it has been done.

To access the raw table use deg(dgs, "raw"), to access the shrunken table use deg(dgs, "shrunken") or just deg(dgs).

Examples

library(DESeq2)
#> Loading required package: S4Vectors
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> Loading required package: parallel
#> #> Attaching package: ‘BiocGenerics’
#> The following objects are masked from ‘package:parallel’: #> #> clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, #> clusterExport, clusterMap, parApply, parCapply, parLapply, #> parLapplyLB, parRapply, parSapply, parSapplyLB
#> The following objects are masked from ‘package:stats’: #> #> IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’: #> #> anyDuplicated, append, as.data.frame, basename, cbind, colMeans, #> colnames, colSums, dirname, do.call, duplicated, eval, evalq, #> Filter, Find, get, grep, grepl, intersect, is.unsorted, lapply, #> lengths, Map, mapply, match, mget, order, paste, pmax, pmax.int, #> pmin, pmin.int, Position, rank, rbind, Reduce, rowMeans, rownames, #> rowSums, sapply, setdiff, sort, table, tapply, union, unique, #> unsplit, which, which.max, which.min
#> #> Attaching package: ‘S4Vectors’
#> The following object is masked from ‘package:base’: #> #> expand.grid
#> Loading required package: IRanges
#> Loading required package: GenomicRanges
#> Loading required package: GenomeInfoDb
#> Loading required package: SummarizedExperiment
#> Loading required package: Biobase
#> Welcome to Bioconductor #> #> Vignettes contain introductory material; view with #> 'browseVignettes()'. To cite Bioconductor, see #> 'citation("Biobase")', and for packages 'citation("pkgname")'.
#> Loading required package: DelayedArray
#> Loading required package: matrixStats
#> #> Attaching package: ‘matrixStats’
#> The following objects are masked from ‘package:Biobase’: #> #> anyMissing, rowMedians
#> Loading required package: BiocParallel
#> #> Attaching package: ‘DelayedArray’
#> The following objects are masked from ‘package:matrixStats’: #> #> colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges
#> The following objects are masked from ‘package:base’: #> #> aperm, apply
library(edgeR)
#> Loading required package: limma
#> #> Attaching package: ‘limma’
#> The following object is masked from ‘package:DESeq2’: #> #> plotMA
#> The following object is masked from ‘package:BiocGenerics’: #> #> plotMA
library(limma) dds <- makeExampleDESeqDataSet(betaSD = 1) colData(dds)[["treatment"]] <- sample(colData(dds)[["condition"]], 12) design(dds) <- ~ condition + treatment dds <- DESeq(dds)
#> estimating size factors
#> estimating dispersions
#> gene-wise dispersion estimates
#> mean-dispersion relationship
#> final dispersion estimates
#> fitting model and testing
res <- degComps(dds, combs = c("condition"))
#> Doing 1 element(s).
#> Doing results() for each element.
#> Doing lcfSrink() for each element.
deg(res[[1]])
#> log2 fold change (MAP): condition B vs A #> Wald test p-value: condition B vs A #> DataFrame with 1000 rows and 6 columns #> baseMean log2FoldChange lfcSE #> <numeric> <numeric> <numeric> #> gene202 595.738080502665 2.69290441661694 0.312772825764591 #> gene710 117.423055944441 2.39202225442696 0.309387809822349 #> gene365 62.4434899710059 2.68819163853763 0.347014786363427 #> gene364 504.522116500683 2.13726876442053 0.304160581713146 #> gene92 220.780204589055 2.05762907387256 0.326874656707121 #> ... ... ... ... #> gene984 3.56063169601722 1.18342031931477 0.558212799249338 #> gene986 1.03912504596143 -0.131696247712928 0.550000503156253 #> gene989 1.84138670225673 0.797083476699305 0.567712937423255 #> gene995 2.88636057994642 0.0840813792066131 0.555663728011982 #> gene1000 2.5816660463203 -0.535343293319606 0.564961445050577 #> stat pvalue padj #> <numeric> <numeric> <numeric> #> gene202 7.82879005947595 4.92587384985754e-15 4.05892005228261e-12 #> gene710 6.93369964061162 4.0997464674756e-12 1.68909554459995e-09 #> gene365 6.79494555755484 1.08353438828276e-11 2.9761077864833e-09 #> gene364 6.56399761634188 5.23840391930272e-11 1.07911120737636e-08 #> gene92 5.4297680851086 5.64273306072517e-08 9.29922408407507e-06 #> ... ... ... ... #> gene984 1.56606943948116 0.117332361646146 NA #> gene986 -0.743786405055134 0.457005706109876 NA #> gene989 1.31499465077388 0.188511700254376 NA #> gene995 1.09138089416803 0.275105315817471 NA #> gene1000 -0.806243807885651 0.420102283688199 NA
deg(res[[1]], tidy = "tibble")
#> # A tibble: 1,000 x 7 #> gene baseMean log2FoldChange lfcSE stat pvalue padj #> * <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 gene202 596. 2.69 0.313 7.83 4.93e-15 4.06e-12 #> 2 gene710 117. 2.39 0.309 6.93 4.10e-12 1.69e- 9 #> 3 gene365 62.4 2.69 0.347 6.79 1.08e-11 2.98e- 9 #> 4 gene364 505. 2.14 0.304 6.56 5.24e-11 1.08e- 8 #> 5 gene92 221. 2.06 0.327 5.43 5.64e- 8 9.30e- 6 #> 6 gene664 110. 1.97 0.350 5.20 2.03e- 7 2.79e- 5 #> 7 gene577 135. -1.66 0.295 -5.17 2.37e- 7 2.79e- 5 #> 8 gene564 83.3 -1.93 0.361 -5.12 3.08e- 7 3.10e- 5 #> 9 gene787 71.0 1.92 0.360 5.08 3.76e- 7 3.10e- 5 #> 10 gene836 49.2 2.25 0.377 5.08 3.71e- 7 3.10e- 5 #> # ... with 990 more rows
# From edgeR dge <- DGEList(counts=counts(dds), group=colData(dds)[["treatment"]]) dge <- estimateCommonDisp(dge) res <- as.DEGSet(topTags(exactTest(dge))) # From limma v <- voom(counts(dds), model.matrix(~treatment, colData(dds)), plot=FALSE) fit <- lmFit(v) fit <- eBayes(fit, robust=TRUE) res <- as.DEGSet(topTable(fit, n = "Inf"), "A_vs_B")
#> Removing intercept from test coefficients