DESeq2_tidiers {biobroom} | R Documentation |
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.
## S3 method for class 'DESeqDataSet' tidy(x, colData = FALSE, intercept = FALSE, ...) ## S3 method for class 'DESeqResults' tidy(x, ...)
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) |
colDat=TRUE
adds covariates from colData to the data frame.
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
|
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)
.
# 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") } }