Package 'CDEnrich'

Title: Enrichment Analysis for Cell Death Pathways
Description: Provides a curated collection of gene sets for major cell death modalities, together with tools for over-representation analysis, gene set enrichment analysis, single-sample gene set enrichment analysis, differential pathway analysis, and visualization.
Authors: Yushan Chen [aut, cre]
Maintainer: Yushan Chen <[email protected]>
License: MIT + file LICENSE
Version: 0.99.1
Built: 2026-10-13 11:14:37 UTC
Source: https://github.com/BiocStaging/CDEnrich

Help Index


Curated Cell Death Pathway Gene Sets

Description

Curated cell death pathway gene sets collected from published literature, GeneCards and pathway databases. This is the underlying table loaded by load_cell_death_genes.

Usage

data(cd_Genesets)

Format

A data frame with two columns:

term

Pathway (gene set) name, e.g. Ferroptosis_FerrDb V2(36305834).

gene

Gene symbol belonging to the pathway.

Source

Curated from public cell death literature and databases; see data-raw/ for the construction scripts.


CDEnrich Demonstration Data

Description

Small simulated datasets used in CDEnrich examples and vignettes.

Details

The ORA and ssGSEA datasets are built from the recommended Ferroptosis gene set (FerrDb V2, PMID: 36305834), and the GSEA datasets from the representative Apoptosis gene set (PMID: 37968457). Background genes are synthetic placeholders (BackgroundGene_1 ... BackgroundGene_3000). All datasets are generated by data-raw/demo_data.R with a fixed random seed and are fully reproducible.

Value

This help page is an overview of the demonstration datasets shipped with CDEnrich; see the individual dataset pages for details.


Curated Data Included in CDEnrich

Description

Data objects used by CDEnrich to provide curated cell death pathway gene sets and representative pathway recommendations.

Details

Value

This help page is an overview of the curated datasets shipped with CDEnrich; see the linked pages for each dataset.


ORA Enrichment Analysis for Cell Death Pathways (Multi-Group Comparison)

Description

Perform multi-group over-representation analysis (ORA) to compare cell death pathway enrichment across multiple gene lists. Support two modes:

  1. Global mode: all groups vs all cell death pathways

  2. Targeted mode: all groups vs one specific pathway

Usage

celldeath_compare_enrich(
  deg_list_list,
  term_select = NULL,
  use_recommended = TRUE,
  universe = NULL,
  pvalueCutoff = 1,
  qvalueCutoff = 1,
  minGSSize = 3,
  savefile = FALSE,
  filename = "celldeath_compareORA_result.csv"
)

Arguments

deg_list_list

A named list of gene vectors, where each element corresponds to a group of differentially expressed genes (gene symbols).

term_select

Character. Either an exact gene set name (e.g. "Disulfidptosis_Up_36747082") used directly, or a cell death type name (e.g. "Disulfidptosis"): for the 13 types with curated recommendations, the recommended representative gene set is used automatically (see get_representative_pathway); for other types with a single gene set, that gene set is used with a notice. Default NULL uses all cell death pathways (global mode).

use_recommended

Logical. Only takes effect when term_select is a cell death type with a curated recommendation: TRUE (default) uses only the recommended representative gene set; FALSE runs against ALL gene sets under that death type.

universe

Character vector of background genes. Default NULL uses all genes in the curated cell death collection. For formal analysis, pass all genes detected in your experiment (e.g. all expressed genes).

pvalueCutoff

P-value cutoff for significance (default: 0.05).

qvalueCutoff

Q-value cutoff for false positive control (default: 0.2).

minGSSize

Minimum gene set size to retain (default: 3).

savefile

Whether to save the results as a CSV file (default: FALSE)

filename

File name (default: "cell_death_ORA_result.csv")

Value

A compareClusterResult object for visualization. Returns NULL if no significant pathways are identified.

Examples

group1 <- c("GPX4","ACSL4","SLC7A11","GSDMD")
group2 <- c("BAX","CASP3","RIPK1","FDX1")
deg_list <- list(Control = group1, Treatment = group2)

# 1. Global mode: all groups vs all cell death pathways
compare_res_all <- celldeath_compare_enrich(deg_list)

# 2. Targeted mode by death type: use the recommended gene set (default)
compare_res_rec <- celldeath_compare_enrich(deg_list, term_select = "Ferroptosis")

# 3. Targeted mode by death type: run against ALL Ferroptosis gene sets
compare_res_type <- celldeath_compare_enrich(deg_list, term_select = "Ferroptosis",
                                             use_recommended = FALSE)

# 4. Targeted mode by exact gene set name
compare_res_exact <- celldeath_compare_enrich(deg_list,
                                              term_select = "Disulfidptosis_Up_36747082")

ORA Enrichment Analysis for Cell Death Pathways (Single Group)

Description

Perform Over-Representation Analysis (ORA) for a list of DEGs based on curated cell death gene sets. Support two modes:

  1. Global mode: one group vs all cell death pathways

  2. Targeted mode: one group vs one specific pathway

Usage

celldeath_enrich(
  deg,
  term_select = NULL,
  use_recommended = TRUE,
  universe = NULL,
  pvalueCutoff = 0.05,
  qvalueCutoff = 0.2,
  minGSSize = 3,
  savefile = FALSE,
  filename = "celldeath_ORA_result.csv"
)

Arguments

deg

A character vector of input genes (gene symbols) for enrichment analysis.

term_select

Character. Either an exact gene set name (e.g. "Disulfidptosis_Up_36747082") used directly, or a cell death type name (e.g. "Disulfidptosis"): for the 13 types with curated recommendations, the recommended representative gene set is used automatically (see get_representative_pathway); for other types with a single gene set, that gene set is used with a notice. Default NULL uses all cell death pathways (global mode).

use_recommended

Logical. Only takes effect when term_select is a cell death type with a curated recommendation: TRUE (default) uses only the recommended representative gene set; FALSE runs against ALL gene sets under that death type.

universe

Character vector of background genes. Default NULL uses all genes in the curated cell death collection. For formal analysis, pass all genes detected in your experiment (e.g. all expressed genes).

pvalueCutoff

P-value cutoff for significance (default: 0.05).

qvalueCutoff

Q-value cutoff for filtering false positives (default: 0.2).

minGSSize

Minimum gene set size to retain (default: 3).

savefile

Whether to save the results as a CSV file (default: FALSE)

filename

File name (default: "celldeath_ORA_result.csv")

Value

An enrichResult object for visualization and result export.

See Also

get_representative_pathway for recommendation details.

Examples

deg <- c("GPX4","ACSL4","SLC7A11","GSDMD","CASP3","BAX")

# 1. Global ORA: vs all cell death pathways
enrich_res <- celldeath_enrich(deg)

# 2. Targeted ORA by death type: use the recommended gene set (default)
enrich_res_rec <- celldeath_enrich(deg, term_select = "Ferroptosis")

# 3. Targeted ORA by death type: run against ALL Ferroptosis gene sets
enrich_res_all <- celldeath_enrich(deg, term_select = "Ferroptosis",
                                   use_recommended = FALSE)

# 4. Targeted ORA by exact gene set name
enrich_res_exact <- celldeath_enrich(deg, term_select = "Disulfidptosis_Up_36747082")

Cell Death Pathway GSEA Analysis

Description

This function performs GSEA using user-defined cell death gene sets. Support two modes:

  1. Global mode: ranked gene list vs all cell death pathways

  2. Targeted mode: ranked gene list vs one specific pathway

Usage

celldeath_gsea(
  geneList,
  term_select = NULL,
  use_recommended = TRUE,
  pvalueCutoff = 1,
  verbose = FALSE,
  savefile = FALSE,
  filename = "celldeath_gsea_result.csv"
)

Arguments

geneList

A named numeric vector, sorted descendingly.

term_select

Character. Either an exact gene set name (e.g. "Disulfidptosis_Up_36747082") used directly, or a cell death type name (e.g. "Disulfidptosis"): for the 13 types with curated recommendations, the recommended representative gene set is used automatically (see get_representative_pathway); for other types with a single gene set, that gene set is used with a notice. Default NULL uses all cell death pathways (global mode).

use_recommended

Logical. Only takes effect when term_select is a cell death type with a curated recommendation: TRUE (default) uses only the recommended representative gene set; FALSE runs against ALL gene sets under that death type.

pvalueCutoff

P-value cutoff.

verbose

Print messages.

savefile

Whether to save the results as a CSV file (default: FALSE)

filename

File name (default: "celldeath_gsea_result.csv")

Value

A gseaResult object.

See Also

get_representative_pathway for recommendation details.

Examples

# Prepare ranked gene vector (descending)
gene_rank <- c(GPX4=2.5, ACSL4=2.2, SLC7A11=1.8, BAX=-1.2, CASP3=-1.9)

# 1. Global GSEA: vs all cell death pathways
gsea_all <- celldeath_gsea(gene_rank)

# 2. Targeted GSEA by death type: use the recommended gene set (default)
gsea_rec <- celldeath_gsea(gene_rank, term_select = "Ferroptosis")

# 3. Targeted GSEA by death type: run against ALL Ferroptosis gene sets
gsea_all_type <- celldeath_gsea(gene_rank, term_select = "Ferroptosis",
                                 use_recommended = FALSE)

# 4. Targeted GSEA by exact gene set name
gsea_exact <- celldeath_gsea(gene_rank, term_select = "Disulfidptosis_Up_36747082")

Multiple Group Cell Death Pathway GSEA Analysis

Description

This function performs GSEA for multiple gene lists. Support two modes:

  1. Global mode: all groups vs all cell death pathways

  2. Targeted mode: all groups vs one specific pathway

Usage

celldeath_gsea_multiple(
  geneList_list,
  term_select = NULL,
  use_recommended = TRUE,
  pvalueCutoff = 1,
  verbose = FALSE,
  savefile = FALSE
)

Arguments

geneList_list

A named list of numeric vectors, each vector is sorted descendingly.

term_select

Character. Either an exact gene set name (e.g. "Disulfidptosis_Up_36747082") used directly, or a cell death type name (e.g. "Disulfidptosis"): for the 13 types with curated recommendations, the recommended representative gene set is used automatically (see get_representative_pathway); for other types with a single gene set, that gene set is used with a notice. Default NULL uses all cell death pathways (global mode).

use_recommended

Logical. Only takes effect when term_select is a cell death type with a curated recommendation: TRUE (default) uses only the recommended representative gene set; FALSE runs against ALL gene sets under that death type.

pvalueCutoff

P-value cutoff.

verbose

Print messages.

savefile

Whether to save all results as CSV files (default: FALSE)

Value

A named list of gseaResult objects.

See Also

get_representative_pathway for recommendation details.

Examples

# Multi-group ranked list
group1 <- c(GPX4=2.5, ACSL4=2.2, NUBPL=1.8, BAX=-1.2)
group2 <- c(GSDMD=2.8, SLC3A2=2.0, GPX4=-1.5)
gene_list <- list(Control = group1, Treatment = group2)

# 1. Global mode: all pathways
res_all <- celldeath_gsea_multiple(gene_list)

# 2. Targeted mode by death type: use the recommended gene set (default)
res_rec <- celldeath_gsea_multiple(gene_list, term_select = "Ferroptosis")

# 3. Targeted mode by death type: run against ALL Ferroptosis gene sets
res_all_type <- celldeath_gsea_multiple(gene_list, term_select = "Ferroptosis",
                                         use_recommended = FALSE)

# 4. Targeted mode by exact gene set name
res_exact <- celldeath_gsea_multiple(gene_list,
                                      term_select = "Disulfidptosis_Up_36747082")

ssGSEA Analysis for Cell Death Pathways

Description

Perform single-sample Gene Set Enrichment Analysis (ssGSEA) on an expression matrix based on curated cell death gene sets. Unlike ORA/GSEA, ssGSEA computes an enrichment score for each sample on each pathway, enabling sample-level comparison of cell death activity. Support two modes:

  1. Global mode: expression matrix vs all cell death pathways

  2. Targeted mode: expression matrix vs one specific pathway

Usage

celldeath_ssgsea(
  expr,
  group = NULL,
  term_select = NULL,
  use_recommended = TRUE,
  min_size = 3,
  normalize = TRUE,
  savefile = FALSE,
  filename = "celldeath_ssgsea_score.csv"
)

Arguments

expr

A numeric matrix or data.frame of expression values, with genes (gene symbols) as rows and samples as columns.

group

An optional character or factor vector of group labels, with length equal to the number of samples (columns of expr). If provided, group information is attached to the result for downstream differential analysis and visualization. Default NULL.

term_select

Character. Either an exact gene set name (e.g. "Disulfidptosis_Up_36747082") used directly, or a cell death type name (e.g. "Disulfidptosis"): for the 13 types with curated recommendations, the recommended representative gene set is used automatically (see get_representative_pathway); for other types with a single gene set, that gene set is used with a notice. Default NULL uses all cell death pathways (global mode).

use_recommended

Logical. Only takes effect when term_select is a cell death type with a curated recommendation: TRUE (default) uses only the recommended representative gene set; FALSE scores ALL gene sets under that death type.

min_size

Minimum gene set size to retain (default: 3).

normalize

Logical. Whether to normalize ssGSEA scores by the difference between the maximum and minimum scores (default: TRUE).

savefile

Whether to save the results as a CSV file (default: FALSE)

filename

File name (default: "celldeath_ssgsea_score.csv")

Details

Multi-group comparison is supported via the group parameter. All samples are scored together on the same expression background to guarantee score comparability across groups.

Value

A named list of class celldeath_ssgsea with two elements:

  • score: a numeric matrix of ssGSEA scores (pathways x samples);

  • group: a factor of sample group labels (NULL if not provided).

See Also

get_representative_pathway for recommendation details.

Examples

# expr: gene x sample expression matrix (rows = genes, columns = samples)
gene_sets <- load_cell_death_genes()
all_genes <- unique(unlist(gene_sets))
set.seed(123)
expr <- matrix(rnorm(length(all_genes) * 10),
               nrow = length(all_genes), ncol = 10,
               dimnames = list(all_genes, paste0("Sample", 1:10)))
group <- rep(c("Control", "Treatment"), each = 5)

# 1. Global mode: all cell death pathways, no grouping
ssgsea_res <- celldeath_ssgsea(expr)

# 2. Multi-group mode: with group labels for downstream comparison
ssgsea_res_group <- celldeath_ssgsea(expr, group = group)

# 3. Targeted mode by death type: use the recommended gene set (default)
ssgsea_ferro <- celldeath_ssgsea(expr, group = group, term_select = "Ferroptosis")

# 4. Targeted mode by death type: score ALL Ferroptosis gene sets
ssgsea_ferro_all <- celldeath_ssgsea(expr, group = group, term_select = "Ferroptosis",
                                     use_recommended = FALSE)

# 5. Targeted mode by exact gene set name
ssgsea_exact <- celldeath_ssgsea(expr, group = group,
                                 term_select = "Disulfidptosis_Up_36747082")

Differential Analysis of ssGSEA Scores Between Groups

Description

Perform group-wise differential analysis on cell death pathway ssGSEA scores. Wilcoxon rank-sum test is used for two groups, and Kruskal-Wallis test for three or more groups.

Usage

celldeath_ssgsea_diff(
  ssgsea_result,
  pAdjustMethod = "BH",
  savefile = FALSE,
  filename = "celldeath_ssgsea_diff.csv"
)

Arguments

ssgsea_result

A celldeath_ssgsea object returned by celldeath_ssgsea (must have non-NULL group).

pAdjustMethod

Multiple testing correction method passed to p.adjust (default: "BH").

savefile

Whether to save the results as a CSV file (default: FALSE)

filename

File name (default: "celldeath_ssgsea_diff.csv")

Value

A data.frame with per-pathway statistics, sorted by p-value: pathway name, mean score per group, test statistic, p-value and adjusted p-value.

Examples

# expr: gene x sample expression matrix (rows = genes, columns = samples)
gene_sets <- load_cell_death_genes()
all_genes <- unique(unlist(gene_sets))
set.seed(123)
expr <- matrix(rnorm(length(all_genes) * 10),
               nrow = length(all_genes), ncol = 10,
               dimnames = list(all_genes, paste0("Sample", 1:10)))
group <- rep(c("Control", "Treatment"), each = 5)

ssgsea_res <- celldeath_ssgsea(expr, group = group)
diff_res <- celldeath_ssgsea_diff(ssgsea_res)
head(diff_res)

Demonstration Background Gene Universe

Description

A character vector combining the recommended Ferroptosis gene set with 3000 synthetic background genes. Used as the ORA background universe.

Usage

data(demo_all_genes)

Format

A character vector of gene symbols.


Demonstration DEG List for Single-Group ORA

Description

Up to 100 real genes taken from the recommended Ferroptosis gene set, providing a strong and reproducible enrichment signal.

Usage

data(demo_deg)

Format

A character vector of gene symbols.


Demonstration DEG Lists for Multi-Group ORA

Description

A named list with two groups: Control (15 Ferroptosis genes) and Treatment (up to 100 Ferroptosis genes).

Usage

data(demo_deg_list)

Format

A named list of two character vectors.


Demonstration Expression Matrix for ssGSEA

Description

A numeric expression matrix with genes as rows and 12 samples as columns. Ferroptosis genes are shifted upwards in Treatment samples, creating higher Ferroptosis activity in that group.

Usage

data(demo_expr)

Format

A numeric matrix (genes x samples).


Demonstration Sample Groups for ssGSEA

Description

A factor assigning the 12 samples of demo_expr to Control and Treatment groups (6 samples each).

Usage

data(demo_group)

Format

A factor with two levels (Control, Treatment).


Demonstration Ranked Gene List for Single-Group GSEA

Description

A decreasingly sorted named numeric vector. All genes from the representative Apoptosis gene set are assigned large positive ranking statistics, creating a clear enrichment signal.

Usage

data(demo_rank_apop)

Format

A decreasingly sorted named numeric vector.


Demonstration Ranked Gene Lists for Multi-Group GSEA

Description

A named list of two decreasingly sorted numeric vectors: Control has no intentionally introduced signal, Treatment carries the same strong Apoptosis signal as demo_rank_apop.

Usage

data(demo_rank_apop_list)

Format

A named list of two decreasingly sorted numeric vectors.


Demonstration DEG List for Targeted ORA

Description

Identical to demo_deg; kept as a separate object so the targeted ORA example reads as an independent workflow.

Usage

data(demo_targeted_deg)

Format

A character vector of gene symbols.


Get the Recommended Representative Gene Set for a Cell Death Type

Description

Look up the curated recommendation for a cell death type that has multiple PMID-based gene sets. 13 of the cell death types in this package have a recommended representative gene set.

Usage

get_representative_pathway(death_type)

Arguments

death_type

Character(1). A cell death type name, e.g. "Disulfidptosis". Matching is exact (case-sensitive).

Details

The lookup table can be overridden via options(CDEnrich.representative_pathways = <data.frame>) (mainly for testing); the override replaces the built-in table completely for the duration it is set.

Value

A one-row data.frame with the recommendation metadata (pathway name, PMID, source, etc.), or NULL if the death type has no recommendation.

Examples

get_representative_pathway("Disulfidptosis")
get_representative_pathway("Mitosis")   # returns NULL

Load Curated Cell Death Gene Sets

Description

Load and prepare cell death pathway gene sets for ORA and GSEA analysis. This function returns a gene list compatible with clusterProfiler functions. The 13 recommended representative gene sets are automatically merged in (see representative_pathways for their curation metadata).

Usage

load_cell_death_genes(.test_df = NULL, .test_rep = NULL)

Arguments

.test_df

Internal parameter for unit testing. A data.frame with term and gene columns; when provided, the built-in dataset and the representative gene sets are NOT used.

.test_rep

Internal parameter for unit testing. A named list of gene vectors used in place of the built-in representative gene sets; when provided together with .test_df, the merge step is still exercised

Value

A named list of gene vectors, each element representing a cell death pathway.

Examples

gene_sets <- load_cell_death_genes()
length(gene_sets)
names(gene_sets)

Visualization of Multi-Group Cell Death Enrichment Comparison

Description

Generate a dotplot for multi-group cell death pathway enrichment comparison. Support two analysis modes from celldeath_compare_enrich():

  1. Global mode: all groups compare against all cell death pathways

  2. Targeted mode: all groups compare against one single specified pathway

Usage

plot_death_compare_bubble(
  compare_res,
  show_category = 10,
  palette = c("#2E8B57", "#F39C12", "#E74C3C"),
  title = "Cell Death Pathway Enrichment (Multi-Group)",
  filename = NULL,
  return_data = FALSE
)

Arguments

compare_res

A compareClusterResult object returned by celldeath_compare_enrich().

show_category

Number of top pathways to display per group (sorted by p-value).

palette

Color palette for p.adjust (low to high). Default: c("#2E8B57", "#F39C12", "#E74C3C").

title

Plot title. Default: "Cell Death Pathway Enrichment (Multi-Group)".

filename

If provided, save plot to file (e.g., "compare_bubble.png"). Default: NULL.

return_data

If TRUE, return the data frame used for plotting. Default: FALSE.

Value

A ggplot2 object (or data frame if return_data = TRUE).

Examples

data("demo_deg_list", package = "CDEnrich")
data("demo_all_genes", package = "CDEnrich")
data("representative_genes", package = "CDEnrich")

compare_result <- celldeath_compare_enrich(
  deg_list_list = demo_deg_list,
  universe = demo_all_genes
)

plot_death_compare_bubble(
  compare_result,
  show_category = 10
)

Visualization of Multi-Group Cell Death Enrichment Comparison (Heatmap)

Description

Generate a heatmap for multi-group cell death pathway enrichment comparison, showing -log10(p.adjust) for each pathway-group pair. Compatible with two analysis modes from celldeath_compare_enrich():

  1. Global mode: all groups compare against all cell death pathways

  2. Targeted mode: all groups compare against one single specified pathway

Usage

plot_death_compare_heatmap(
  compare_res,
  show_category = 10,
  palette = c("#2E8B57", "#F39C12", "#E74C3C"),
  title = "Cell Death Pathway Enrichment (Multi-Group Heatmap)",
  filename = NULL,
  return_data = FALSE
)

Arguments

compare_res

A compareClusterResult object returned by celldeath_compare_enrich().

show_category

Number of top pathways to display (selected by lowest p.adjust across groups).

palette

Color palette for fill (low to high). Default: c("#2E8B57", "#F39C12", "#E74C3C").

title

Plot title. Default: "Cell Death Pathway Enrichment (Multi-Group Heatmap)".

filename

If provided, save plot to file (e.g., "compare_heatmap.png"). Default: NULL.

return_data

If TRUE, return the data frame used for plotting. Default: FALSE.

Value

A ggplot2 object (or data frame if return_data = TRUE).

Examples

data("demo_deg_list", package = "CDEnrich")
data("demo_all_genes", package = "CDEnrich")
data("representative_genes", package = "CDEnrich")

compare_result <- celldeath_compare_enrich(
  deg_list_list = demo_deg_list,
  universe = demo_all_genes
)

plot_death_compare_heatmap(
  compare_result,
  show_category = 10
)

Visualization of Cell Death Enrichment Results (Bubble Plot)

Description

Generate a dotplot for single-group cell death pathway enrichment analysis. Automatically adapt for two modes:

  1. Global mode: multiple pathways bubble plot

  2. Targeted mode: single-pathway ORA plot layout adjustment

Usage

plot_death_enrich_bubble(
  enrich_res,
  show_category = 10,
  palette = c("#2E8B57", "#F39C12", "#E74C3C"),
  size_range = c(2, 8),
  title = "Cell Death Pathway Enrichment",
  filename = NULL,
  return_data = FALSE
)

Arguments

enrich_res

An enrichResult object returned by celldeath_enrich().

show_category

Number of top pathways to display (sorted by p-value).

palette

Color palette for p.adjust (low to high). Default: c("#2E8B57", "#F39C12", "#E74C3C").

size_range

Range of point size (min, max). Default: c(2, 8).

title

Plot title. Default: "Cell Death Pathway Enrichment".

filename

If provided, save plot to file (e.g., "bubble.png"). Default: NULL.

return_data

If TRUE, return the data frame used for plotting. Default: FALSE.

Value

A ggplot2 object (or data frame if return_data = TRUE).

Examples

data("demo_deg", package = "CDEnrich")
data("demo_all_genes", package = "CDEnrich")
data("representative_genes", package = "CDEnrich")

ora_result <- celldeath_enrich(
  deg = demo_deg,
  universe = demo_all_genes
)

plot_death_enrich_bubble(
  ora_result,
  show_category = 10
)

Visualization of Cell Death Enrichment Results (Enrichment Network)

Description

Generate an enrichment network plot for single-group cell death pathway enrichment analysis. Automatically adapt two analysis modes from celldeath_enrich():

  1. Global mode: multiple pathways, full gene overlap network with edges

  2. Targeted mode: single specified pathway, simple single-node plot Nodes represent pathways, edges represent gene overlaps (similarity)(only for multi-pathway).

Usage

plot_death_enrich_network(
  enrich_res,
  show_category = 30,
  color = "p.adjust",
  filename = NULL,
  ...
)

Arguments

enrich_res

An enrichResult object returned by celldeath_enrich().

show_category

Number of top pathways to display (sorted by p-value). Default: 30.

color

Which variable to use for node color. Options: "p.adjust" (default), "pvalue", "qvalue", "Count", etc.

filename

If provided, save plot to file (e.g., "enrich_network.png"). Default: NULL.

...

Additional arguments passed to enrichplot::emapplot (e.g., node_label, cex_label_group).

Value

A ggplot2 object.

Examples

data("demo_deg", package = "CDEnrich")
data("demo_all_genes", package = "CDEnrich")
data("representative_genes", package = "CDEnrich")

ora_result <- celldeath_enrich(
  deg = demo_deg,
  universe = demo_all_genes
)

plot_death_enrich_network(
  ora_result,
  show_category = 10
)

Targeted Single-Pathway ORA Summary Plot

Description

Generate a compact summary plot for a targeted ORA result containing exactly one pathway. The bar shows the number of overlapping genes and the annotation reports GeneRatio, BgRatio, and adjusted P-value.

Usage

plot_death_enrich_targeted(
  enrich_res,
  color = "#F39C12",
  title = "Targeted Cell Death Pathway Enrichment",
  filename = NULL,
  return_data = FALSE
)

Arguments

enrich_res

An enrichResult object or data frame returned by celldeath_enrich().

color

Bar color. Default: "#F39C12".

title

Plot title. Default: "Targeted Cell Death Pathway Enrichment".

filename

If provided, save plot to file. Default: NULL.

return_data

If TRUE, return the data frame used for plotting. Default: FALSE.

Value

A ggplot2 object (or data frame if return_data = TRUE).

Examples

data("demo_targeted_deg", package = "CDEnrich")
data("demo_all_genes", package = "CDEnrich")
data("representative_pathways", package = "CDEnrich")

ora_ferroptosis <- celldeath_enrich(
  deg = demo_targeted_deg,
  universe = demo_all_genes,
  term_select = "Ferroptosis"
)

plot_death_enrich_targeted(ora_ferroptosis)

Plot GSEA Curve for Cell Death Pathways

Description

Generate standard three-panel GSEA enrichment plot for cell death pathway. Support both global multi-pathway mode and targeted single-pathway mode.

Usage

plot_death_gsea_curve(gsea_res, pathway, use_recommended = TRUE)

Arguments

gsea_res

Result from celldeath_gsea().

pathway

Character. Either an exact pathway ID present in the result, or a cell death type name (e.g. "Ferroptosis"), which is resolved to the recommended representative gene set when available (see get_representative_pathway).

use_recommended

Logical. Only takes effect when pathway is a cell death type with a curated recommendation: TRUE (default) plots the recommended representative gene set; FALSE plots ALL gene sets of this type present in the result.

Value

A ggplot2 object.

Examples

data("demo_rank_apop", package = "CDEnrich")
data("representative_pathways", package = "CDEnrich")

apoptosis_id <- get_representative_pathway("Apoptosis")$Pathway

gsea_result <- celldeath_gsea(
  geneList = demo_rank_apop
)

plot_death_gsea_curve(
  gsea_result,
  pathway = apoptosis_id
)

Plot GSEA Curves for Multiple Group Cell Death Pathways

Description

Plot GSEA Curves for Multiple Group Cell Death Pathways

Usage

plot_death_gsea_curve_multiple(
  gsea_res_list,
  pathway,
  use_recommended = TRUE,
  filename_prefix = NULL,
  ...
)

Arguments

gsea_res_list

Named list of GSEA results from celldeath_gsea_multiple().

pathway

Character. Either an exact pathway ID present in the results, or a cell death type name (e.g. "Ferroptosis"), which is resolved to the recommended representative gene set when available (see get_representative_pathway).

use_recommended

Logical. Only takes effect when pathway is a cell death type with a curated recommendation: TRUE (default) plots the recommended representative gene set; FALSE plots ALL gene sets of this type present in each group's result.

filename_prefix

If provided, save each plot as "prefix_groupname.png". Default: NULL.

...

Additional arguments passed to plot_death_gsea_curve.

Value

A named list of ggplot2 objects, each containing one GSEA curve.

Examples

data("demo_rank_apop_list", package = "CDEnrich")
data("representative_pathways", package = "CDEnrich")

apoptosis_id <- get_representative_pathway("Apoptosis")$Pathway

gsea_groups <- celldeath_gsea_multiple(
  geneList_list = demo_rank_apop_list,
  pvalueCutoff = 1
)

curves <- plot_death_gsea_curve_multiple(
  gsea_groups,
  pathway = apoptosis_id
)

curves$Control
curves$Treatment

Heatmap for Multi-Group GSEA Results

Description

Generate a heatmap to compare pathway statistics (e.g., NES, -log10 p.adjust) across multiple GSEA groups. Compatible with two modes from celldeath_gsea():

  1. Global mode: ranked list vs all cell death pathways

  2. Targeted mode: ranked list vs one specific single pathway Missing pathway in certain group will be shown as grey tile.

Usage

plot_death_gsea_heatmap_multiple(
  gsea_res_list,
  show_category = 10,
  statistic = c("NES", "p.adjust"),
  palette = c("#2E8B57", "#F39C12", "#E74C3C"),
  title = "GSEA Multi-Group Enrichment Heatmap",
  filename = NULL,
  return_data = FALSE
)

Arguments

gsea_res_list

A named list of GSEA result objects (from celldeath_gsea_multiple).

show_category

Number of top pathways to display. Default: 10.

statistic

Which statistic to plot. Options: "NES" (default) or "p.adjust".

palette

Color palette for fill (low to high). Default: c("#2E8B57", "#F39C12", "#E74C3C").

title

Plot title. Default: "GSEA Multi-Group Enrichment Heatmap".

filename

If provided, save plot to file. Default: NULL.

return_data

If TRUE, return the data frame used for plotting. Default: FALSE.

Value

A ggplot2 object (or data frame if return_data = TRUE).

Examples

data("demo_rank_apop_list", package = "CDEnrich")
data("representative_genes", package = "CDEnrich")

gsea_groups <- celldeath_gsea_multiple(
  geneList_list = demo_rank_apop_list,
  pvalueCutoff = 1
)

plot_death_gsea_heatmap_multiple(
  gsea_groups,
  statistic = "NES",
  show_category = 10
)

Plot GSEA Ranking Score Curve for Cell Death Pathways

Description

Generate a running score plot (ranked list metric) for a single GSEA result. Compatible with two modes from celldeath_gsea():

  1. Global mode: ranked list vs all cell death pathways

  2. Targeted mode: ranked list vs one specific single pathway This plot shows the enrichment score as a function of the ranked gene list.

Usage

plot_death_gsea_ranked(
  gsea_res,
  pathway,
  use_recommended = TRUE,
  color = "#2E8B57",
  base_size = 10,
  title = NULL,
  filename = NULL,
  ...
)

Arguments

gsea_res

Result from celldeath_gsea().

pathway

Character. Either an exact pathway ID present in the result, or a cell death type name (e.g. "Ferroptosis"), which is resolved to the recommended representative gene set when available (see get_representative_pathway).

use_recommended

Logical. Only takes effect when pathway is a cell death type with a curated recommendation: TRUE (default) plots the recommended representative gene set; FALSE plots ALL gene sets of this type present in the result.

color

Color of the running score line. Default: "#2E8B57".

base_size

Base font size. Default: 10.

title

Plot title. If NULL, uses the pathway name. Default: NULL.

filename

If provided, save plot to file (e.g., "gsea_ranked.png"). Default: NULL.

...

Additional arguments passed to enrichplot::gseaplot.

Value

A ggplot2 object.

Examples

data("demo_rank_apop", package = "CDEnrich")
data("representative_pathways", package = "CDEnrich")

apoptosis_id <- get_representative_pathway("Apoptosis")$Pathway

gsea_result <- celldeath_gsea(
  geneList = demo_rank_apop
)

plot_death_gsea_ranked(
  gsea_result,
  pathway = apoptosis_id
)

Visualization of Cell Death ssGSEA Scores (Mean Barplot)

Description

Generate a horizontal barplot of mean ssGSEA scores per group, with SEM (standard error of mean) error bars. Suitable for comparing overall pathway activity across groups when many pathways are involved.

Usage

plot_death_ssgsea_bar(
  ssgsea_res,
  show_category = 20,
  palette = c("#2E8B57", "#F39C12", "#E74C3C", "#8E44AD"),
  title = "Mean Cell Death Pathway ssGSEA Score",
  filename = NULL,
  return_data = FALSE
)

Arguments

ssgsea_res

A celldeath_ssgsea object returned by celldeath_ssgsea() (must have non-NULL group).

show_category

Number of top pathways to display, ordered by mean absolute score. The default is 20.

palette

Group colors. Default: c("#2E8B57", "#F39C12", "#E74C3C", "#8E44AD").

title

Plot title. Default: "Mean Cell Death Pathway ssGSEA Score".

filename

If provided, save plot to file (e.g., "barplot.png"). Default: NULL.

return_data

If TRUE, return the data frame used for plotting. Default: FALSE.

Value

A ggplot2 object (or data frame if return_data = TRUE).

Examples

data("demo_expr", package = "CDEnrich")
data("demo_group", package = "CDEnrich")
data("representative_genes", package = "CDEnrich")

ssgsea_result <- celldeath_ssgsea(
  expr = demo_expr,
  group = demo_group
)

plot_death_ssgsea_bar(
  ssgsea_result,
  show_category = 10
)

Visualization of Cell Death ssGSEA Scores (Grouped Boxplot)

Description

Generate boxplots comparing ssGSEA score distributions across groups. Best companion for celldeath_ssgsea_diff() results. Automatically adapt for two modes:

  1. Global mode: pathways on x-axis (faceted or dodged by group)

  2. Targeted mode: single-pathway group comparison layout

Usage

plot_death_ssgsea_boxplot(
  ssgsea_result,
  show_category = 10,
  palette = c("#2E8B57", "#F39C12", "#E74C3C", "#8E44AD"),
  add_points = TRUE,
  title = "Cell Death Pathway ssGSEA Score Comparison",
  filename = NULL,
  return_data = FALSE
)

Arguments

ssgsea_result

A celldeath_ssgsea object returned by celldeath_ssgsea() (must have non-NULL group).

show_category

Number of top pathways to display (ordered by mean absolute score). Default: 10.

palette

Colors for groups. Default: c("#2E8B57", "#F39C12", "#E74C3C", "#8E44AD").

add_points

Logical. Whether to overlay jittered sample points. Default: TRUE.

title

Plot title. Default: "Cell Death Pathway ssGSEA Score Comparison".

filename

If provided, save plot to file (e.g., "boxplot.png"). Default: NULL.

return_data

If TRUE, return the data frame used for plotting. Default: FALSE.

Value

A ggplot2 object (or data frame if return_data = TRUE).

Examples

data("demo_expr", package = "CDEnrich")
data("demo_group", package = "CDEnrich")
data("representative_genes", package = "CDEnrich")

ssgsea_result <- celldeath_ssgsea(
  expr = demo_expr,
  group = demo_group
)

plot_death_ssgsea_boxplot(
  ssgsea_result,
  show_category = 10
)

Visualization of Cell Death ssGSEA Scores (Heatmap)

Description

Generate a heatmap of ssGSEA scores (pathways x samples) with optional group annotation. This is the most common visualization for ssGSEA results in publications. Automatically adapt for two modes:

  1. Global mode: multiple pathways heatmap with row scaling

  2. Targeted mode: single-pathway heatmap without row scaling

Usage

plot_death_ssgsea_heatmap(
  ssgsea_result,
  show_category = 30,
  scale_rows = TRUE,
  cluster_cols = TRUE,
  palette = c("#2E8B57", "white", "#E74C3C"),
  group_palette = c("#2E8B57", "#F39C12", "#E74C3C", "#8E44AD"),
  title = "Cell Death Pathway ssGSEA Scores",
  filename = NULL,
  width = 10,
  height = 8
)

Arguments

ssgsea_result

A celldeath_ssgsea object returned by celldeath_ssgsea().

show_category

Number of top pathways to display, ordered by mean absolute score. The default is 30.

scale_rows

Logical. Whether to z-score scale each pathway across samples (recommended for multi-pathway mode). Default: TRUE.

cluster_cols

Logical. Whether to cluster samples. Default: TRUE. Ignored automatically if only one pathway is present.

palette

Color palette for score values (low to high). Default: c("#2E8B57", "white", "#E74C3C").

group_palette

Named or unnamed colors for group annotation. Default: c("#2E8B57", "#F39C12", "#E74C3C", "#8E44AD").

title

Plot title. Default: "Cell Death Pathway ssGSEA Scores".

filename

If provided, save plot to file (e.g., "heatmap.png"). Default: NULL.

width

Plot width in inches when saving. Default: 10.

height

Plot height in inches when saving. Default: 8.

Value

Invisibly returns the pheatmap object.

Examples

data("demo_expr", package = "CDEnrich")
data("demo_group", package = "CDEnrich")
data("representative_genes", package = "CDEnrich")

ssgsea_result <- celldeath_ssgsea(
  expr = demo_expr,
  group = demo_group
)

plot_death_ssgsea_heatmap(
  ssgsea_result,
  show_category = 10
)

Volcano Plot for Cell Death Enrichment Results

Description

Generate a volcano-style plot for single-group enrichment analysis (ORA or GSEA), showing effect size (GeneRatio for ORA, NES for GSEA) versus significance (-log10 p.adjust). Support both global multi-pathway mode and targeted single-pathway mode.

Usage

plot_death_volcano(
  enrich_res,
  label_top = 5,
  color_point = "lightblue",
  color_signif = "darkred",
  point_size = 2,
  alpha = 0.8,
  label_size = 3.5,
  x_lab = NULL,
  y_lab = expression(-log[10]("Adjusted P-value")),
  title = NULL,
  filename = NULL,
  ...
)

Arguments

enrich_res

An enrichResult (ORA) or gseaResult (GSEA) object.

label_top

Number of top significant pathways to label (sorted by p.adjust). Default: 5.

color_point

Color of non-significant points. Default: "#D3D3D3".

color_signif

Color of significant points (p.adjust < 0.05). Default: "#D62728".

point_size

Size of points. Default: 2.

alpha

Transparency of points. Default: 0.8.

label_size

Size of pathway labels. Default: 3.5.

x_lab

X-axis label. If NULL, auto-detected ("Gene Ratio" for ORA, "NES" for GSEA). Default: NULL.

y_lab

Y-axis label. Default: "-log10(Adjusted P-value)".

title

Plot title. If NULL, auto-generated. Default: NULL.

filename

If provided, save plot to file (e.g., "volcano.png"). Default: NULL.

...

Additional arguments passed to ggrepel::geom_text_repel (e.g., max.overlaps, force).

Value

A ggplot2 object.

Examples

data("demo_deg", package = "CDEnrich")
data("demo_all_genes", package = "CDEnrich")
data("representative_genes", package = "CDEnrich")

ora_result <- celldeath_enrich(
  deg = demo_deg,
  universe = demo_all_genes
)

plot_death_volcano(
  ora_result,
  label_top = 5
)

Print Method for celldeath_ssgsea Objects

Description

Print Method for celldeath_ssgsea Objects

Usage

## S3 method for class 'celldeath_ssgsea'
print(x, ...)

Arguments

x

A celldeath_ssgsea object.

...

Additional arguments (ignored).

Value

Invisibly returns x.


Representative Gene Sets for Cell Death Types

Description

The recommended representative gene set for each of the 13 cell death types with curated recommendations. These are merged into the result of load_cell_death_genes and are used as the default gene set in targeted analysis modes.

Usage

data(representative_genes)

Format

A named list of character vectors; names are pathway names (e.g. Ferroptosis_FerrDb V2(36305834)) and each element is a vector of gene symbols.

Source

Curated from the seminal publication of each cell death type; see representative_pathways for the curation metadata.


Representative Pathway Recommendation Metadata

Description

Curated recommendation table recording, for each cell death type with multiple PMID-based gene sets, which gene set is the recommended representative. Used by get_representative_pathway.

Usage

data(representative_pathways)

Format

A data frame with one row per recommended cell death type and the following columns:

Type

Cell death type name, e.g. Ferroptosis.

PMID

PubMed ID of the source publication.

IF

Journal impact factor of the source publication.

Cite

Citation count of the source publication.

Pathway

Name of the recommended representative gene set, e.g. Ferroptosis_FerrDb V2(36305834).

Source

Where the gene set was obtained from in the publication, e.g. Supplementary-table1.

Description

Free-text description of how the gene set was curated.

Notes

Additional curation notes (may be empty).

Source

Curated manually from the primary literature; see data-raw/representative_pathways.csv.