Skip to content
songif edited this page Jun 15, 2026 · 6 revisions

DSGE: Disruption Score of Gene Expression

Pathway-level transcriptional perturbation analysis. Converts differential expression p-values into absolute z-scores and tests whether GO, KEGG, or Reactome pathways show significantly stronger transcriptional disruption than expected by chance, using permutation-based null distributions with optional GPD tail extrapolation.

Installation

# install.packages("devtools")   # if not already installed
devtools::install_github("LHJLab/DSGE")

Quick Start — GO

library(DSGE)
library(org.Hs.eg.db)

# Build GO pathway-gene map from Bioconductor OrgDb
pw <- get_pathway_genes_db(org.Hs.eg.db, min_size = 10)

# Read DE results (any tool — DESeq2, edgeR, limma, Seurat, etc.)
res <- read.csv("your_de_results.csv")

# Run pathway analysis
result <- pathway_dsge(pw, pvalue = res$pvalue, base_mean = res$AveExpr,
                        gene_names = res$gene,
                        n_perm = 100000, n_cores = 4,
                        directional = TRUE, direction_vec = res$log2FoldChange,
                        nds_top_frac = 0.25, return_null = TRUE)

# Significant pathways
head(result$table[result$table$p_adj < 0.05, c("go_id", "go_name", "dsge_std", "p_adj")])

# Plot null distribution for selected pathways
plot_dsge(result, pathway_ids = c("GO:0007264", "GO:0018108"))

Quick Start — KEGG / Reactome

# KEGG pathways (requires KEGGREST, online name lookup)
pw_kegg <- get_pathway_genes_kegg(org.Hs.eg.db, min_size = 10)
result_kegg <- pathway_dsge(pw_kegg, pvalue = res$pvalue, base_mean = res$AveExpr,
                             gene_names = res$gene, n_perm = 100000, return_null = TRUE)
head(result_kegg$table[, c("kegg_id", "kegg_name", "dsge_std", "p_adj")])

# Reactome pathways (requires reactome.db, local name lookup)
pw_react <- get_pathway_genes_reactome(org.Hs.eg.db, min_size = 10)
result_react <- pathway_dsge(pw_react, pvalue = res$pvalue, base_mean = res$AveExpr,
                              gene_names = res$gene, n_perm = 100000, return_null = TRUE)
head(result_react$table[, c("reactome_id", "reactome_name", "dsge_std", "p_adj")])

Workflow

The typical DSGE analysis follows these steps:

Step Function Description
1 read.csv() Import differential expression results
2 read_gaf() / read_obo() Read GO annotation files (GAF mode)
3 get_pathway_genes() / get_pathway_genes_db() Build GO pathway-gene mapping
3b get_pathway_genes_kegg() Build KEGG pathway-gene mapping
3c get_pathway_genes_reactome() Build Reactome pathway-gene mapping
4 pathway_dsge() Core analysis (permutation test, auto-detects source)
5 plot_dsge() Visualise null distributions

Data Sources

Source Function Name Lookup Output Columns
GO get_pathway_genes_db() GO.db (local) go_id, go_name, aspect
KEGG get_pathway_genes_kegg() KEGGREST (online) kegg_id, kegg_name
Reactome get_pathway_genes_reactome() reactome.db (local) reactome_id, reactome_name

Clone this wiki locally