Skip to contents

Class containing all elements generated during differential expression analysis with DESeq2. This class is essentially a list with validity checks to ensure DESeqTransform and DESeqResults correspond to the DESeqDataSet.

Usage

DESeqAnalysis(data, transform, results, lfcShrink = NULL)

Arguments

data

DESeqDataSet.

transform

DESeqTransform. DESeq2::varianceStabilizingTransformation() recommended by default.

results

list or single DESeqResults. One or more unshrunken DESeqResults. Assign the DESeq2::results() return here.

lfcShrink

list, single DESeqResults, or NULL. Optional. One or more shrunken DESeqResults. Assign the DESeq2::lfcShrink() return here.

Value

DESeqAnalysis.

Note

Updated 2021-03-15.

Examples

suppressPackageStartupMessages({
    library(S4Vectors)
    library(SummarizedExperiment)
})
data <- DESeq2::makeExampleDESeqDataSet()
rowRanges <- AcidGenomes::emptyRanges(names = rownames(data))
mcols(rowRanges)[["geneId"]] <- paste0("id", seq_len(length(rowRanges)))
mcols(rowRanges)[["geneName"]] <- paste0("name", seq_len(length(rowRanges)))
rowRanges(data) <- rowRanges
data <- DESeq2::DESeq(data)
#> estimating size factors
#> estimating dispersions
#> gene-wise dispersion estimates
#> mean-dispersion relationship
#> final dispersion estimates
#> fitting model and testing
class(data)
#> [1] "DESeqDataSet"
#> attr(,"package")
#> [1] "DESeq2"

transform <- DESeq2::varianceStabilizingTransformation(data)
class(transform)
#> [1] "DESeqTransform"
#> attr(,"package")
#> [1] "DESeq2"

resultsNames(data)
#> [1] "Intercept"        "condition_B_vs_A"
name <- resultsNames(data)[[2L]]
results <- DESeq2::results(data, name = name)
class(results)
#> [1] "DESeqResults"
#> attr(,"package")
#> [1] "DESeq2"

lfcShrink <- DESeq2::lfcShrink(dds = data, res = results, coef = 2L)
#> using 'apeglm' for LFC shrinkage. If used in published research, please cite:
#>     Zhu, A., Ibrahim, J.G., Love, M.I. (2018) Heavy-tailed prior distributions for
#>     sequence count data: removing the noise and preserving large differences.
#>     Bioinformatics. https://doi.org/10.1093/bioinformatics/bty895

results <- list(results)
names(results) <- name

lfcShrink <- list(lfcShrink)
names(lfcShrink) <- name

object <- DESeqAnalysis(
    data = data,
    transform = transform,
    results = results,
    lfcShrink = lfcShrink
)
print(object)
#> DESeqAnalysis 0.7.1; DESeq2 1.42.1
#> data:
#>   dim: 1000 12 
#>   metadata(1): version
#>   assays(4): counts mu H cooks
#>   rownames(1000): gene1 gene2 ... gene999 gene1000
#>   rowData names(24): geneId geneName ... deviance maxCooks
#>   colnames(12): sample1 sample2 ... sample11 sample12
#>   colData names(2): condition sizeFactor
#> transformType: varianceStabilizingTransformation
#> resultsNames: condition_B_vs_A
#> alphaThreshold: 0.1
#> lfcShrinkType: apeglm