DESeq2_tidiers: Tidying methods for DESeq2 DESeqDataSet objects

Description Usage Arguments Details Value Examples

Description

This reshapes a DESeq2 expressionset object into a tidy format. If the dataset contains hypothesis test results (p-values and estimates), this summarizes one row per gene per possible contrast.

Usage

1
2
3
4
5
## S3 method for class 'DESeqDataSet'
tidy(x, colData = FALSE, intercept = FALSE, ...)

## S3 method for class 'DESeqResults'
tidy(x, ...)

Arguments

x

DESeqDataSet object

colData

whether colData should be included in the tidied output for those in the DESeqDataSet object. If dataset includes hypothesis test results, this is ignored

intercept

whether to include hypothesis test results from the (Intercept) term. If dataset does not include hypothesis testing, this is ignored

...

extra arguments (not used)

Details

colDat=TRUE adds covariates from colData to the data frame.

Value

If the dataset contains results (p-values and log2 fold changes), the result is a data frame with the columns

term

The contrast being tested, as given to results

gene

gene ID

baseMean

mean abundance level

estimate

estimated log2 fold change

stderror

standard error in log2 fold change estimate

statistic

test statistic

p.value

p-value

p.adjusted

adjusted p-value

If the dataset does not contain results (DESeq has not been run on it), tidy defaults to tidying the counts in the dataset:

gene

gene ID

sample

sample ID

count

number of reads in this gene in this sample

If colData = TRUE, it also merges this with the columns present in colData(x).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# From DESeq2 documentation

if (require("DESeq2")) {
    dds <- makeExampleDESeqDataSet(betaSD = 1)

    tidy(dds)
    # With design included
    tidy(dds, colData=TRUE)

    # add a noise confounding effect
    colData(dds)$noise <- rnorm(nrow(colData(dds)))
    design(dds) <- (~ condition + noise)

    # perform differential expression tests
    ddsres <- DESeq(dds, test = "Wald")
    # now results are per-gene, per-term
    tidied <- tidy(ddsres)
    tidied

    if (require("ggplot2")) {
        ggplot(tidied, aes(p.value)) + geom_histogram(binwidth = .05) +
            facet_wrap(~ term, scale = "free_y")
    }
}

biobroom documentation built on Nov. 8, 2020, 5:20 p.m.