Extract results from a DESeq2 analysis and return a tidy tibble with tRNA identifiers and significance flags.
Arguments
- dds
A
DESeqDataSetobject (fromrun_deseq()).- contrast
A contrast specification: either a character vector of length 3 (e.g.,
c("condition", "mutant", "wildtype")) or a list for coefficient-based contrasts.- name
Name of a single model coefficient to extract, as returned by
DESeq2::resultsNames(). Use this for interaction terms.- padj_cutoff
Adjusted p-value threshold for significance. Default
0.05.
Details
Give either contrast or name, not both. A contrast compares two levels
of one factor. A name addresses a single model coefficient, which is the
only way to reach an interaction term: in a design such as
~ genotype + charge_status + genotype:charge_status, the interaction
coefficient is what carries differential charging, and no contrast
specification refers to it. Use DESeq2::resultsNames() to list the
available coefficients.
Examples
# \donttest{
se <- create_clover(clover_example("ecoli/config.yaml"))
counts <- SummarizedExperiment::assay(se, "counts")
coldata <- as.data.frame(SummarizedExperiment::colData(se))
coldata$condition <- ifelse(
grepl("ctl", coldata$sample_id), "ctl", "inf"
)
dds <- run_deseq(counts, coldata, design = ~condition)
#> Warning: some variables in design formula are characters, converting to factors
#> estimating size factors
#> estimating dispersions
#> gene-wise dispersion estimates
#> mean-dispersion relationship
#> final dispersion estimates
#> fitting model and testing
tidy_deseq_results(dds, contrast = c("condition", "inf", "ctl"))
#> # A tibble: 190 × 6
#> ref log2FoldChange lfcSE pvalue padj significant
#> <chr> <dbl> <dbl> <dbl> <dbl> <lgl>
#> 1 host-tRNA-Ala-GGC-1-1 -0.236 0.393 0.548 0.822 FALSE
#> 2 host-tRNA-Ala-GGC-1-1-uncharged 0.163 0.352 0.643 0.857 FALSE
#> 3 host-tRNA-Ala-GGC-1-2 0.145 0.434 0.739 0.896 FALSE
#> 4 host-tRNA-Ala-GGC-1-2-uncharged 0.166 0.360 0.645 0.857 FALSE
#> 5 host-tRNA-Ala-TGC-1-1 -0.424 0.350 0.225 0.769 FALSE
#> 6 host-tRNA-Ala-TGC-1-1-uncharged 0.0849 0.267 0.750 0.900 FALSE
#> 7 host-tRNA-Ala-TGC-1-2 -0.314 0.395 0.427 0.790 FALSE
#> 8 host-tRNA-Ala-TGC-1-2-uncharged 0.260 0.472 0.581 0.832 FALSE
#> 9 host-tRNA-Ala-TGC-1-3 0.0823 0.427 0.847 0.922 FALSE
#> 10 host-tRNA-Ala-TGC-1-3-uncharged 0.112 0.294 0.703 0.896 FALSE
#> # ℹ 180 more rows
# An interaction coefficient, by name
DESeq2::resultsNames(dds)
#> [1] "Intercept" "condition_inf_vs_ctl"
tidy_deseq_results(dds, name = "condition_inf_vs_ctl")
#> # A tibble: 190 × 6
#> ref log2FoldChange lfcSE pvalue padj significant
#> <chr> <dbl> <dbl> <dbl> <dbl> <lgl>
#> 1 host-tRNA-Ala-GGC-1-1 -0.236 0.393 0.548 0.822 FALSE
#> 2 host-tRNA-Ala-GGC-1-1-uncharged 0.163 0.352 0.643 0.857 FALSE
#> 3 host-tRNA-Ala-GGC-1-2 0.145 0.434 0.739 0.896 FALSE
#> 4 host-tRNA-Ala-GGC-1-2-uncharged 0.166 0.360 0.645 0.857 FALSE
#> 5 host-tRNA-Ala-TGC-1-1 -0.424 0.350 0.225 0.769 FALSE
#> 6 host-tRNA-Ala-TGC-1-1-uncharged 0.0849 0.267 0.750 0.900 FALSE
#> 7 host-tRNA-Ala-TGC-1-2 -0.314 0.395 0.427 0.790 FALSE
#> 8 host-tRNA-Ala-TGC-1-2-uncharged 0.260 0.472 0.581 0.832 FALSE
#> 9 host-tRNA-Ala-TGC-1-3 0.0823 0.427 0.847 0.922 FALSE
#> 10 host-tRNA-Ala-TGC-1-3-uncharged 0.112 0.294 0.703 0.896 FALSE
#> # ℹ 180 more rows
# }