This skill covers differential expression analysis using DESeq2, the most widely-used Bioconductor package for analyzing RNA-seq count data. DESeq2 uses a negative binomial model to test for differential expression between experimental conditions.
if (!require('BiocManager', quietly = TRUE))
install.packages('BiocManager')
BiocManager::install(c('DESeq2', 'apeglm'))
Tell your AI agent what you want to do: - "Run DESeq2 on my count matrix with treated vs control comparison" - "Analyze differential expression controlling for batch effects" - "Get significantly differentially expressed genes with padj < 0.05"
"Create a DESeqDataSet from my count matrix and sample metadata"
"Run the standard DESeq2 workflow on this RNA-seq data"
"Apply log fold change shrinkage to my DESeq2 results"
"Set up DESeq2 with batch correction"
"Create an interaction model for genotype and treatment"
"Compare multiple conditions against a control"
"Extract genes with adjusted p-value < 0.05 and |log2FC| > 1"
"Order results by significance"
"Export normalized counts and DE results"
| Input | Format | Description |
|---|---|---|
| Count matrix | Integer matrix | Genes (rows) x Samples (columns) |
| Sample metadata | Data frame | Rownames matching count column names |
| Design formula | R formula | Variables from metadata (~condition) |
results())lfcShrink() with type='apeglm' for better fold change estimates -- but note apeglm requires coef= and cannot use contrast=; rebuild design as ~ 0 + group for interaction contrasts, or use type='ashr'vst() instead of rlog() for large datasets (>100 samples)DESeq() -- alphabetical default silently inverts fold-change directionresultsNames(dds) to see available coefficients and ALWAYS pass name= or contrast= explicitly; results(dds) with no argument returns the last coefficient and depends on design ordertest='LRT'), use padj only as an omnibus screen -- the reported LFC is for the last coefficient, NOT an omnibus summary