Vol. 01 · No. 1 · Beta Edition

Pathway Enrichment & Cell-Cell Interaction Tutorial

Biological pathway enrichment against local MSigDB gene sets (GO & Reactome) and cell-cell interaction analysis using CellPhoneDB on PBMC 3k data — with a map of when to reach for GSEA / ORA, functional activity scoring, or LIANA instead.

Intermediate·Pathway & Cell Interaction

What you'll learn

  • Test per-cluster marker genes against locally installed MSigDB gene sets and identify enriched GO Biological Process and Reactome pathway terms.
  • Use the fan-out pattern: connect three different Pathway Visualization nodes (GO Barplot, Reactome Barplot, GO Dotplot) to a single Pathway Enrichment node without re-computation.
  • Run CellPhoneDB to identify statistically significant ligand-receptor interactions between cell-type pairs and visualize them as a heatmap, dotplot, and chord diagram.

Prerequisites

  • • Oreumics installed (install guide).
  • • PBMC tutorial completed — this tutorial assumes you have a clustered AnnData with DEG Analysis results in uns["rank_genes_groups"].
  • • Before the Pathway Enrichment step: install the GO_Biological_Process and Reactome MSigDB collections once from the node's resource card or the Resource Center. Enrichment is then computed on your machine — gene lists are never uploaded and no internet connection is needed during the run.
  • • Before the CellPhoneDB step: install the CellPhoneDB database once from the Resource Center (v5 recommended). The app bundles the CellPhoneDB code but not its database, and it will not download one mid-run — the node stops with a “resource not ready” message until it is installed.
  • • Sample data: sampledata/scrna/pbmc3k_raw.h5ad — pre-bundled. The three templates on this page ship as Pathway Enrichment Analysis, GO & Reactome Pathway Visualization and Cell-Cell Interaction (CellPhoneDB).

Dataset

Sample file (pre-packaged)

sampledata/scrna/pbmc3k_raw.h5ad— 2,700 cells × 32,738 genes · integer counts · already included in Oreumics

What it is

Peripheral blood mononuclear cells (PBMCs) from a healthy human donor — the same dataset used in the PBMC scRNA-seq tutorial, with human HGNC gene symbols (which is what both the human MSigDB collections and CellPhoneDB expect). You first cluster cells through the standard preprocessing pipeline, then run pathway enrichment on the marker genes per cluster, or a ligand-receptor permutation test between clusters.

A one-time Resource Center install for Pathway Enrichment and CellPhoneDB

Pathway Enrichment runs offline against the MSigDB gene-set collections you install once (GO Biological Process and Reactome for these templates); until they are installed the node stops with a message naming the missing library. CellPhoneDB (Template 3) likewise runs offline, but only after its interaction database has been installed once from the Resource Center — pinned by version and checksum, reused by every later run.

Which pathway node do I need?

• Pathway Enrichment (this tutorial) — per-cluster over-representation of the DEG Analysis markers against MSigDB collections (GO / Reactome / WikiPathways / Hallmark …), computed locally with gseapy. One result per cluster, drawn by Pathway Visualization.

• GSEA / ORA — gseapy on one gene list: preranked GSEA over all genes or ORA over the significant ones. Built for bulk de_results, but it also accepts single-cell rank_genes_groups (pick the group with its cluster parameter). See the Bulk tutorial.

• PROGENy Activity / Hallmark Activity / CollecTRI TF Activity — a different question: infer pathway (14 signalling pathways), program (50 MSigDB Hallmarks) or transcription-factor activity from the expression matrix itself with decoupler, no DEG list involved. Sample-level pseudobulk (sample_key) is the recommended mode; priors are installed once from the Resource Center. Functional Activity reference.

• CellPhoneDB vs. LIANA — both score ligand-receptor interactions between cell groups. CellPhoneDB runs the classic permutation test on its curated human database (mouse not supported — convert to HGNC symbols first). LIANA runs several methods (CellPhoneDB, NATMI, Connectome, logFC …) and aggregates them into one consensus ranking (magnitude_rank / specificity_rank), with an Organism switch for mouse (the OmniPath snapshot translated with HCOP orthologs). See the LIANA alternative at the end of Template 3.

Template 1

Pathway Enrichment Analysis

Run the standard scRNA-seq preprocessing pipeline through clustering and marker ranking, then test marker genes against local MSigDB collections to identify enriched GO and Reactome pathways per cluster. After clustering, the natural next question is: what biological processes are active in each cluster?

Pipeline (scroll →)

Load H5AD
→
Quality Control
→
Normalize
→
Log1p
→
Highly Variable Genes
→
PCA
↳
Neighbors
→
Clustering
→
DEG Analysis
→
Pathway Enrichment
→
Pathway Visualization
Load H5ADInput / Output

Load the PBMC 3k counts. No other settings are needed — the file already has gene symbols and cell barcodes.

file_pathsampledata/scrna/pbmc3k_raw.h5ad

What you'll see

2,700 cells × 32,738 genes loaded.

Quality ControlPreprocessing

Filter out low-quality cells (empty droplets, dying cells) and lowly-detected genes. mode: filter removes cells permanently.

modefilter
min_genes200remove empty droplets
max_pct_mito20remove dying cells
mito_prefixMT-
filter_min_cellstrue
min_cells3remove genes seen in <3 cells

What you'll see

~2,638 cells and ~13,714 genes remain after filtering.

NormalizePreprocessing

Scale every cell so that the total count equals target_sum (CP10K), removing library-size differences. save_counts keeps the raw integer counts in layers["counts"].

target_sum10000
save_countstrue
Log1pPreprocessing

Apply log(x + 1) transformation. Compresses the dynamic range and makes the data more normally distributed — important for statistical tests downstream.

basenullnatural log (default)
Highly Variable GenesPreprocessing

Select the 2,000 most variable genes across cells. These genes capture the most biological variability and are used for PCA. All downstream dimensionality reduction uses only these genes. This template has no Scale node, so DEG Analysis reads the log-normalized X directly (there is no adata.raw).

n_top_genes2000
flavorseurat

What you'll see

2,000 genes flagged as highly_variable: True in adata.var.

PCAAnalysis

Compute the top 30 principal components using only the HVGs. Captures the major axes of transcriptional variation.

n_comps30
use_highly_variabletrue
NeighborsAnalysis

Build a k-nearest-neighbor graph in PCA space. This graph is shared by UMAP layout and Leiden clustering.

n_neighbors15
n_pcs30default 15
use_repX_pca
ClusteringAnalysis

Run Leiden community detection on the kNN graph. Resolution 0.8 produces 8–10 clusters on PBMC 3k, suitable for resolving major immune cell types. Cluster labels are stored in obs.leiden.

methodleiden
resolution0.8
key_addedleiden

What you'll see

8–10 clusters labeled 0–7 or 0–9. Expect distinct T cell, B cell, NK, and monocyte clusters.

DEG AnalysisAnalysis

Rank differentially expressed genes for each cluster vs. all other cells using the Wilcoxon rank-sum test (formerly "Find Markers"). Leave n_genes empty so all genes are ranked and stored in uns["rank_genes_groups"] — Pathway Enrichment applies its own p-value and log-fold-change cutoffs to pick the marker set per cluster.

groupbyleiden
methodwilcoxon
referencerest
n_genesnullall genes ranked

What you'll see

Ranked genes per cluster. Key markers: CD3D/CD3E (T cells), MS4A1/CD79A (B cells), NKG7/GNLY (NK), LYZ/CST3 (monocytes).

Pathway EnrichmentPathway

For each cluster, take the markers passing pval_threshold and lfc_threshold (at least min_de_genes of them), test them locally with gseapy against the installed gene-set collections, and keep the n_top_terms best terms per gene-set library. Results are stored in uns["pathway_enrichment"]. gene_sets is a comma-separated list of library names (GO_Biological_Process, GO_Molecular_Function, GO_Cellular_Component, Reactome, WikiPathways, MSigDB_Hallmark, MSigDB_Oncogenic, ImmuneSigDB, TF_Targets_GTRD).

rank_keyrank_genes_groups
gene_setsGO_Biological_Process,Reactomecomma-separated, no spaces
organismHuman
pval_threshold0.05
lfc_threshold1.0
n_top_terms10
min_de_genes3

What you'll see

uns["pathway_enrichment"] contains enriched terms per cluster per gene set. T cell clusters show T cell activation and adaptive immune terms; monocyte clusters show innate immune and inflammatory terms.

Tip

Install each library named in gene_sets once from the node’s resource card first. Organism is Human or Mouse; MSigDB_Oncogenic and ImmuneSigDB are human only. KEGG and BioCarta are not offered. Older workflows that name dated library versions from earlier releases are mapped to the matching collection with a warning.

Pathway VisualizationVisualization

Render a horizontal bar chart of the top enriched GO terms per cluster, colored by adjusted p-value. This is the quickest way to survey the biological identity of each cluster.

plot_typebarplot
gene_setGO_Biological_Process
n_top_terms5top 5 terms per cluster
figsize_w14
figsize_h12

What you'll see

Bar chart per cluster. T cell clusters: "T cell activation", "adaptive immune response". Monocyte clusters: "innate immune response", "myeloid cell differentiation". B cell clusters: "B cell receptor signaling". Bar length reflects -log10 adjusted p-value.

Template 2

GO & Reactome Pathway Visualization

The fan-out pattern connects multiple visualization nodes to the same upstream result node. After Pathway Enrichment completes, connect three separate Pathway Visualization nodes — one per chart — all reading from the same enrichment data. No re-computation is required, and each figure gets its own Visualization Workspace.

Fan-out from Pathway Enrichment

Pathway Enrichment
→
GO Barplot
Reactome Barplot
GO Dotplot

In the canvas: drag three Pathway Visualization nodes onto the board and connect each one from the output handle of the single Pathway Enrichment node.

GO BarplotVisualization

Top GO Biological Process terms per cluster as horizontal bars. Best for a quick biological summary of each cluster.

plot_typebarplot
gene_setGO_Biological_Process
n_top_terms8
figsize_w14
figsize_h10
Reactome BarplotVisualization

Top Reactome pathway enrichment per cluster as horizontal bars. Monocyte clusters typically show neutrophil degranulation, interferon signaling and antigen presentation pathways; T cell clusters show TCR signaling and interleukin signaling.

plot_typebarplot
gene_setReactome
n_top_terms8
figsize_w14
figsize_h10
GO DotplotVisualization

A dotplot where dot size encodes the number of overlapping genes and color encodes adjusted p-value. This lets you compare both significance and gene coverage across clusters simultaneously.

plot_typedotplot
gene_setGO_Biological_Process
n_top_terms5
figsize_w16
figsize_h10

What you'll see

All three plots appear on their node cards at once. Comparing GO and Reactome results for the same cluster helps confirm biological identity — concordance between a GO "T cell activation" term and a Reactome "TCR signaling" pathway is strong evidence.

Template 3

Cell-Cell Interaction (CellPhoneDB)

CellPhoneDB identifies statistically significant ligand-receptor interactions between pairs of cell types by testing co-expression of interaction partners across cluster pairs with a permutation test (cell-type labels shuffled 1,000 times). Run the preprocessing pipeline and extend with CellPhoneDB followed by three CellPhoneDB Plot nodes in a fan-out pattern.

Pipeline (scroll →)

Load H5AD
→
Quality Control
→
Normalize
→
Log1p
→
Highly Variable Genes
→
PCA
↳
Neighbors
→
Clustering
→
CellPhoneDB

Fan-out from CellPhoneDB (CellPhoneDB Plot nodes)

CellPhoneDB
→
Interaction Heatmap
Interaction Dotplot
Chord Diagram

Key Requirements — database and gene symbols

CellPhoneDB needs (1) its interaction database, installed once from the Resource Center (v5 recommended for its improved scoring) — the node's cpdb_file_path is filled in from that install; (2) human HGNC gene symbols in var_names — mouse data is not supported, convert to human orthologs first; and (3) a cell-type or cluster label column in obs (celltype_key). Cluster numbers work, but annotated names (Edit Clusters, Auto Annotation, CellTypist) make the plots readable.

NormalizePreprocessing

Normalize to CP10K. The shipped template switches save_counts on so the raw integer counts stay available in layers["counts"] alongside the log-normalized matrix CellPhoneDB scores on.

target_sum10000
save_countstrue
ClusteringAnalysis

Run Leiden clustering. CellPhoneDB will use these cluster labels as cell type annotations. Use the same resolution as Template 1 for consistent cluster identities.

methodleiden
resolution0.8
key_addedleiden
CellPhoneDBCellPhoneDB

Run the CellPhoneDB statistical analysis in-app (mode: run) to identify significant ligand-receptor interactions between all cluster pairs. cpdb_file_path points at the database .zip installed via the Resource Center (auto-filled); iterations sets the permutations, threshold the minimum fraction of expressing cells, pvalue the cutoff the plots use. mode: load is for reading an existing CellPhoneDB CLI output folder (means.txt / pvalues.txt) via output_dir instead of computing.

moderunor load = read existing CLI output
celltype_keyleidenor any obs column with cell type labels
cpdb_file_path<auto-filled from Resource Center>
analysis_methodstatistical
iterations1000
threshold0.1
pvalue0.05

What you'll see

uns["cpdb_results"] stores the means and pvalues tables. Each row is a ligand-receptor pair; each column is a cluster-pair combination (e.g., "0|1"). If no interaction is significant the node explains the likely cause (non-human symbols, wrong normalization).

Tip

If you have manually annotated cell types (e.g., obs["cell_type"] = "CD4 T cells"), set celltype_key to that column for more interpretable interaction labels.

Interaction HeatmapVisualization

CellPhoneDB Plot, plot_type heatmap: a matrix where each cell represents the number of significant interactions between two clusters. High values (dark color) indicate pairs with many active ligand-receptor interactions. symmetrical averages the two directions.

plot_typeheatmap
celltype_keyleiden
figsize_w10
figsize_h8

What you'll see

Heatmap of interaction counts per cluster pair. In PBMC data, myeloid–lymphoid pairs (monocytes with T cells) commonly carry the most interactions — chemokine, MHC-II and co-stimulatory pairs.

Interaction DotplotVisualization

Rows are ligand-receptor pairs; columns are cluster-pair combinations. Dot size encodes significance and color encodes mean expression of the ligand-receptor pair. cell_type1 / cell_type2 are LABEL VALUES (e.g. "T cell"), not obs column names; "." matches all.

plot_typedotplot
celltype_keyleiden
cell_type1."." matches all cluster types
cell_type2.
figsize_w14
figsize_h10

What you'll see

Interactions such as MIF–(CD74+CD44), CXCL/CXCR chemokine pairs and CD80/CD86–CD28 co-stimulation are commonly reported in PBMC data; use the dotplot to see which cluster pairs carry them.

Chord DiagramVisualization

A chord diagram where arcs represent cell types and ribbons represent significant interactions. Ribbon width is proportional to the number of significant interactions. link_direction: 1 draws directed arcs (ligand → receptor), making it easy to see which cell type is the sender vs. the receiver; interaction highlights chosen L-R pairs.

plot_typechord
celltype_keyleiden
cell_type1.
cell_type2.
link_direction1directed arcs: ligand → receptor
figsize_w12
figsize_h12

What you'll see

Thick ribbons between the monocyte and T cell arcs visually confirm strong cross-talk; thinner ribbons between B cells and T cells reflect co-stimulatory interactions.

Alternative: LIANA consensus

Swap the CellPhoneDB node for LIANA (celltype_key: leiden, organism: Human, expr_prop 0.1, n_perms 1000) and its LIANA Plot (dotplot of the top_n interactions ordered by magnitude_rank or specificity_rank, filterable by source_labels / target_labels). LIANA needs log1p-normalised expression in X and its licence-filtered OmniPath ligand-receptor snapshot from the Resource Center; set organism to Mouse for mouse data, which uses the same snapshot translated with HCOP one-to-one orthologs.

Expected Results

  • • After QC: ~2,638 cells; 8–10 Leiden clusters at resolution 0.8
  • • GO — T cell clusters: T cell activation, adaptive immune response, lymphocyte proliferation
  • • GO — Monocyte clusters: innate immune response, myeloid leukocyte activation, response to lipopolysaccharide
  • • Reactome — T cell clusters: TCR signaling, interleukin signaling, generation of second messenger molecules
  • • Reactome — Monocyte clusters: neutrophil degranulation, interferon signaling, antigen processing and cross-presentation
  • • CellPhoneDB heatmap: highest interaction counts between monocyte and T cell clusters
  • • Typical interactions: MIF–(CD74+CD44), chemokine CXCL/CXCR pairs, CD80/CD86–CD28 co-stimulation — exact pairs depend on the clustering

Going Further

  • Run enrichment on bulk DEG output instead — the Bulk RNA-seq tutorial Template 2 covers the GSEA / ORA node on the airway DESeq2 results.
  • Score pathway and TF activity per sample or cell with PROGENy Activity, Hallmark Activity and CollecTRI TF Activity — complementary to marker-list enrichment because a pathway can be active without every member being a DEG.
  • For methylation data, use the dedicated Methyl GOmeth node which corrects for CpG density bias — see the Methylation tutorial.
  • To connect spatial proximity with signaling, use the spatial Ligand-Receptor node (squidpy ligrec, permutation test between clusters) or Spatial Ligand-Receptor (per-spot bivariate co-localization) on Visium data — see Phase 4 of the Visium tutorial.

Glossary

MSigDB
The Molecular Signatures Database from the Broad Institute and UC San Diego (CC BY 4.0) — curated gene-set collections including GO, Reactome, WikiPathways and the Hallmarks, for human and mouse. Oreumics installs each collection once through the Resource Center and runs enrichment locally with gseapy.
ORA vs. GSEA vs. activity
ORA tests a cut-off gene list for over-representation; GSEA walks the whole ranked list; activity inference (PROGENy / Hallmark / CollecTRI) fits a prior to the expression matrix and needs no gene list at all.
GO Biological Process
The Gene Ontology "biological process" namespace — a controlled vocabulary of cellular activities (immune response, cell division, etc.) annotated to genes.
Reactome
An open (CC0), peer-reviewed pathway knowledgebase — curated reactions and pathways (TCR signaling, interferon signaling, etc.) annotated to gene members. KEGG is not offered because its terms restrict commercial use; Reactome and WikiPathways cover the same ground.
CellPhoneDB
A curated human ligand-receptor database (~2,000–3,000 pairs including heterodimers) plus a permutation test between cell types. Outputs a means matrix and pvalues matrix per cluster pair. Database installed via the Resource Center.
LIANA
A framework that runs several ligand-receptor scoring methods and aggregates them (rank_aggregate) into magnitude_rank and specificity_rank — less method-specific bias than any single tool.
Fan-out pattern
Connecting multiple downstream visualization nodes to one upstream analysis node so each viz reads the same cached result without recomputing.