MultiDE – automated multi-contrast bulk RNA-seq DEA
This Python script loops over every treatment level in the metadata file and runs one differential-expression test per treatment vs control, then (if ≥ 2 treatments are present) a pooled “ALL vs CTRL” comparison.
The design matrix is chosen automatically:
• ~ Batch + Condition
when a Batch
column exists, otherwise ~ Condition
.
Normalisation workflow:
• Before differential expression analysis: Median-of-ratios normalization (dds.deseq2()) is used to correct for differences in sequencing depth across samples.
• After differential expression analysis: VST (Variance Stabilizing Transformation) is applied for exploratory analyses such as PCA, clustering, and heatmaps.
Statistical test:
each contrast is analysed with the Wald test implemented in PyDESeq2’s DeseqStats
.
The Wald test is used to compare two conditions.
The null hypothesis of the Wald test states that for each gene, there is no differential expression between two sample groups (e.g., treated vs. control).
If the p-value is small (e.g., p < 0.05), the null hypothesis is rejected, suggesting there is only a 5% chance that the observed difference occurred by random chance.
However, when testing many genes, a number of non-differentially expressed genes may still appear significant due to random chance (false positives).
Visual outputs:
• pydesq2_results_table.csv
— DE results sorted by log2FoldChange
(raw Wald values).
• Volcano plot Volcano_<contrast>
(red = sig, grey = non-sig).
• Heat-map Heatmap_<contrast>
for the top-50 DE genes (VST counts).
• Global PCA: `.
Example of metadata file:
Sample forward-absolute-filepath reverse-absolute-filepath Condition Replicate Batch
SRR13978645 SRR13978645_1.fastq.gz SRR13978645_2.fastq.gz CTRL R1 Batch1
SRR13978644 SRR13978644_1.fastq.gz SRR13978644_2.fastq.gz CTRL R2 Batch1
SRR13978643 SRR13978643_1.fastq.gz SRR13978643_2.fastq.gz CTRL R3 Batch2
SRR13978642 SRR13978642_1.fastq.gz SRR13978642_2.fastq.gz SPRC1 R1 Batch1
SRR13978641 SRR13978641_1.fastq.gz SRR13978641_2.fastq.gz SPRC2 R1 Batch1
SRR13978640 SRR13978640_1.fastq.gz SRR13978640_2.fastq.gz SPRC2 R2 Batch2