| name | metabolicpathwayheterogeneity |
| description | Analyzes metabolic pathway heterogeneity within cell populations by calculating normalized enrichment scores (NES) for each pathway across different groups. Quantifies metabolic diversity and identifies pathways with variable activity patterns. Uses principal component analysis and GSEA to assess pathway heterogeneity, revealing subpopulation-specific metabolic states and transitions. |
MetabolicPathwayHeterogeneity Process Configuration
Purpose
Analyzes metabolic pathway heterogeneity within cell populations by calculating normalized enrichment scores (NES) for each pathway across different groups. Quantifies metabolic diversity and identifies pathways with variable activity patterns. Uses principal component analysis and GSEA to assess pathway heterogeneity, revealing subpopulation-specific metabolic states and transitions.
When to Use
- Assess metabolic diversity: When you need to quantify metabolic heterogeneity within clusters or conditions
- Identify variable pathways: To find which metabolic pathways show high vs low heterogeneity across groups
- Compare metabolic variability: To compare heterogeneity between treatments, timepoints, or cell types
- After pathway activity analysis: Complements MetabolicPathwayActivity by adding heterogeneity dimension
- Final metabolic analysis step: Typically the last process in the ScrnaMetabolicLandscape workflow
- Subpopulation discovery: When metabolic variability suggests hidden substructure
Configuration Structure
Process Enablement
MetabolicPathwayHeterogeneity is part of the ScrnaMetabolicLandscape group. Enable it by enabling the group:
[ScrnaMetabolicLandscape]
cache = true
Input Specification
MetabolicPathwayHeterogeneity receives input automatically from MetabolicInput (or MetabolicExprImputation if imputation enabled):
[ScrnaMetabolicLandscape.in]
srtobj = ["SeuratClustering"]
Environment Variables
All configuration is done at the ScrnaMetabolicLandscape group level:
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
subset_by = "treatment"
ncores = 1
MetabolicPathwayHeterogeneity-Specific Configuration
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.8
pathway_pval_cutoff = 0.01
ncores = 1
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.fgsea_args]
scoreType = "std"
nproc = 1
minSize = 15
maxSize = 500
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.plots]
"Pathway Heterogeneity" = {
plot_type = "dot",
devpars = { res = 100 }
}
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.cases]
"Treatment" = {
subset_by = "treatment",
group_by = "seurat_clusters",
select_pcs = 0.8,
pathway_pval_cutoff = 0.01
}
Heterogeneity Analysis Method
Algorithm Overview
- PCA on pathway scores: Principal component analysis on pathway activity scores per group
- PC selection: Select top PCs explaining variance (controlled by
select_pcs)
- GSEA on PCs: Run fgsea for each PC to identify pathways correlating with variance
- NES calculation: Normalized Enrichment Score quantifies pathway-PC association
- Heterogeneity metric: Pathways with high |NES| show high heterogeneity across groups
PC Selection (select_pcs)
| Value | Interpretation | Use Case |
|---|
| 0.8 (default) | Use PCs explaining 80% variance | Balanced approach |
| 0.5 | Use PCs explaining 50% variance | Focus on major variation sources |
| 0.95 | Use PCs explaining 95% variance | Comprehensive analysis (slower) |
| 5 (integer) | Use exactly 5 PCs | Manual control |
| 10 | Use exactly 10 PCs | Fine-grained heterogeneity |
Recommendation: Start with 0.8 (default), increase to 0.9-0.95 if you suspect hidden heterogeneity.
Pathway P-value Cutoff
pathway_pval_cutoff = 0.01
- Purpose: Filter to significantly enriched pathways before heterogeneity analysis
- Lower values (0.001): Strict, only highly significant pathways
- Higher values (0.05): Permissive, include more pathways
- Default (0.01): Good balance for most analyses
FGSEA Score Type
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.fgsea_args]
scoreType = "std"
| Score Type | Description | Use Case |
|---|
| std | Standard GSEA (both directions) | Default; detects heterogeneity in both high/low activity |
| pos | Only positive enrichment | Focus on pathways with increased activity variation |
| neg | Only negative enrichment | Focus on pathways with decreased activity variation |
GMT File Sources
The gmtfile parameter accepts:
- Built-in databases:
"KEGG_2021_Human", "Reactome_Pathways_2024", "BioCarta_2016", "MSigDB_Hallmark_2020"
- Custom files: Local paths or URLs to GMT format files
- See
/skills/processes/metabolicinput.md for detailed database options
Configuration Examples
Minimal Configuration (Default Settings)
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.in]
srtobj = ["SeuratClustering"]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
Comprehensive Heterogeneity Analysis
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
ncores = 8
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.95
pathway_pval_cutoff = 0.01
ncores = 8
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.fgsea_args]
scoreType = "std"
nproc = 8
minSize = 10
maxSize = 500
Treatment Comparison Heterogeneity
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "Reactome_Pathways_2024"
group_by = "seurat_clusters"
subset_by = "treatment"
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.8
pathway_pval_cutoff = 0.05
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.plots]
"Treatment Heterogeneity" = {
plot_type = "dot",
devpars = { width = 1200, height = 800, res = 150 }
}
High-Resolution Publication Plots
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 10
pathway_pval_cutoff = 0.01
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.plots]
"Pathway Heterogeneity" = {
plot_type = "dot",
devpars = { width = 1600, height = 1200, res = 300 }
}
Multiple Analysis Cases
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
ncores = 8
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.cases.Clusters]
group_by = "seurat_clusters"
select_pcs = 0.8
pathway_pval_cutoff = 0.01
plots = {
"Cluster Heterogeneity" = { plot_type = "dot", devpars = { res = 150 } }
}
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.cases.Treatment]
subset_by = "treatment"
group_by = "seurat_clusters"
select_pcs = 0.9
pathway_pval_cutoff = 0.01
plots = {
"Treatment Heterogeneity" = { plot_type = "dot", devpars = { res = 150 } }
}
Conservative Analysis (Major Variance Only)
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.5
pathway_pval_cutoff = 0.001
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.fgsea_args]
scoreType = "std"
minSize = 20
maxSize = 300
Common Patterns
Pattern 1: Standard Heterogeneity Analysis
Assess metabolic variability across clusters:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.8
pathway_pval_cutoff = 0.01
Pattern 2: Treatment Response Variability
Compare heterogeneity between responders and non-responders:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "Reactome_Pathways_2024"
subset_by = "response"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.85
pathway_pval_cutoff = 0.01
Pattern 3: Timepoint Progression
Analyze heterogeneity changes over time:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
subset_by = "timepoint"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.9
pathway_pval_cutoff = 0.01
Pattern 4: Energy Metabolism Focus
Analyze heterogeneity in glycolysis and OXPHOS:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "/data/pathways/energy_metabolism.gmt"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.8
pathway_pval_cutoff = 0.05
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.fgsea_args]
minSize = 5
Pattern 5: High-Throughput Parallel Execution
Large dataset with many groups:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
ncores = 16
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.8
ncores = 16
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.fgsea_args]
nproc = 1
Dependencies
Upstream Processes
- Required:
MetabolicInput (part of ScrnaMetabolicLandscape group)
- Optional:
MetabolicExprImputation (if imputation enabled with noimpute = false)
- Root:
CombinedInput → requires SeuratClustering or similar clustering process
Downstream Processes
- Parallel: Runs alongside
MetabolicPathwayActivity and MetabolicFeatures (same group)
- Typically final: Usually the last metabolic analysis step
- Optional: Can feed into visualization or reporting processes
Data Requirements
- Seurat object with normalized expression data
- Metadata column specified in
group_by (e.g., cluster assignments)
- Optional metadata column in
subset_by for subset analysis
- GMT file with metabolic pathway gene sets matching Seurat object gene names
- Multiple groups required (>2) for meaningful heterogeneity analysis
Output Format
Output Files
MetabolicPathwayHeterogeneity generates the following outputs in the outdir directory (default: {{in.sobjfile | stem}}.pathwayhetero):
- Heterogeneity scores: TSV files with NES per pathway and PC
- Columns: pathway, PC1_NES, PC1_pval, PC2_NES, PC2_pval, ...
- Dot plots: Visualization of pathway heterogeneity across groups and subsets
- PCA results: PC variance explained, loadings
- Pathway rankings: Pathways ranked by heterogeneity magnitude
Result Interpretation
- High |NES|: Pathway shows high heterogeneity (variable activity across groups)
- Low |NES|: Pathway shows low heterogeneity (uniform activity across groups)
- Positive NES: Pathway correlated with PC (increases along PC axis)
- Negative NES: Pathway anti-correlated with PC (decreases along PC axis)
- P-value: Statistical significance of pathway-PC association
Biological Interpretation
- High heterogeneity pathways: Indicate metabolic subpopulations or transitions
- Low heterogeneity pathways: Indicate core/constitutive metabolism
- Group-specific patterns: Suggest differential metabolic regulation
- PC loadings: Reveal metabolic axes of variation
Validation Rules
Input Validation
gmtfile must be a valid enrichit database name OR accessible GMT file
- Gene names in GMT file must match Seurat object (case-sensitive)
group_by column must exist in Seurat object metadata
- If
subset_by specified, column must exist and NA values will be removed
Parameter Validation
select_pcs: If 0 < value <= 1, interpreted as fraction; if > 1, interpreted as number
pathway_pval_cutoff: Must be between 0 and 1 (typically 0.001-0.1)
ncores: Must be positive integer
- At least 2 groups required in
group_by for heterogeneity analysis
FGSEA Validation
scoreType must be one of: "std", "pos", "neg"
minSize < maxSize
minSize >= 1
- At least one pathway must meet size and significance criteria
Troubleshooting
Issue: All heterogeneity scores are zero or very low
Cause: Groups have similar metabolic profiles or insufficient variance
Solution:
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.95
pathway_pval_cutoff = 0.05
Issue: Process too slow
Cause: High select_pcs or insufficient parallelization
Solution:
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 0.7
ncores = 8
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.fgsea_args]
nproc = 8
Issue: No significant pathways after filtering
Cause: pathway_pval_cutoff too strict or weak biological signal
Solution:
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
pathway_pval_cutoff = 0.05
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.fgsea_args]
minSize = 10
maxSize = 800
Issue: Memory errors during PCA
Cause: Too many pathways or groups
Solution:
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
select_pcs = 5
pathway_pval_cutoff = 0.001
ncores = 2
Issue: Results don't make biological sense
Cause: Inappropriate PC selection or wrong grouping variable
Solution:
select_pcs = 0.8
select_pcs = 10
group_by = "refined_clusters"
subset_by = "cell_type"
Issue: Dot plot unreadable (too many pathways)
Cause: Too many significant pathways
Solution:
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs]
pathway_pval_cutoff = 0.001
[ScrnaMetabolicLandscape.envs]
gmtfile = "/data/pathways/core_metabolism.gmt"
[ScrnaMetabolicLandscape.MetabolicPathwayHeterogeneity.envs.plots]
"Pathway Heterogeneity" = {
plot_type = "dot",
devpars = { width = 2000, height = 1500, res = 150 }
}
Issue: Gene name mismatch errors
Cause: GMT file gene names don't match Seurat object
Solution:
- Check gene format: Human (UPPERCASE), Mouse (TitleCase)
- Verify GMT file format:
name\tdescription\tgene1\tgene2\tgene3
- Ensure gene IDs match (e.g., both ENSEMBL or both symbols)
Issue: Insufficient groups for heterogeneity analysis
Cause: Only 1-2 groups in group_by column
Solution:
[ScrnaMetabolicLandscape.envs]
group_by = "seurat_clusters"
subset_by = "treatment"
Issue: PCA explains very little variance
Cause: Pathways have little variation across groups
Solution:
- Verify upstream pathway activity analysis completed successfully
- Check if groups are truly metabolically distinct
- Try different pathway database (e.g., KEGG → Reactome)
- Consider different
group_by variable
External References
Original Paper
Metabolic landscape methodology:
Analytical Methods
PCA (Principal Component Analysis):
GSEA (Gene Set Enrichment Analysis):
fgsea (Fast GSEA):
Tool Documentation
GMT Databases
Related Skills
- ScrnaMetabolicLandscape:
/skills/processes/scrnametaboliclandscape.md - Full metabolic analysis group
- MetabolicInput:
/skills/processes/metabolicinput.md - Input preparation and GMT databases
- MetabolicPathwayActivity:
/skills/processes/metabolicpathwayactivity.md - Pathway activity scoring (AUCell-based)
- MetabolicFeatures:
/skills/processes/metabolicfeatures.md - Pathway enrichment analysis (FGSEA-based)
Decision Tree for Heterogeneity Analysis
Start: MetabolicPathwayHeterogeneity
│
├─ Do groups show obvious metabolic differences?
│ ├─ YES → Use default settings (select_pcs = 0.8)
│ └─ NO → Increase PC capture (select_pcs = 0.95)
│
├─ How many groups in analysis?
│ ├─ 2-5 groups → Use select_pcs = 0.8 (major variance)
│ ├─ 6-10 groups → Use select_pcs = 0.85 (balanced)
│ └─ >10 groups → Use select_pcs = 0.9 (comprehensive)
│
├─ Exploratory vs confirmatory analysis?
│ ├─ Exploratory → pathway_pval_cutoff = 0.05 (permissive)
│ └─ Confirmatory → pathway_pval_cutoff = 0.01 (default)
│
└─ Computational resources available?
├─ Limited → select_pcs = 0.7, ncores = 2
├─ Moderate → select_pcs = 0.8, ncores = 4
└─ Abundant → select_pcs = 0.95, ncores = 16
Interpretation Guide
High Heterogeneity Pathways (|NES| > 2)
- Biological significance: Indicates metabolic subpopulations or transitional states
- Follow-up: Investigate which groups drive heterogeneity (check PC loadings)
- Examples: Glycolysis (Warburg effect heterogeneity), fatty acid oxidation (metabolic flexibility)
Low Heterogeneity Pathways (|NES| < 1)
- Biological significance: Core/constitutive metabolism shared across groups
- Follow-up: May serve as normalizing factors or housekeeping metabolism
- Examples: Basic nucleotide metabolism, core TCA cycle
PC Interpretation
- PC1: Usually captures major metabolic axis (e.g., proliferative vs quiescent)
- PC2-3: Secondary axes (e.g., treatment response, differentiation state)
- Higher PCs: Fine-grained variation or technical noise
Comparing Cases
When using multiple cases (e.g., treatment vs control):
- Similar heterogeneity: Pathway variability intrinsic to cell populations
- Differential heterogeneity: Treatment-induced metabolic plasticity or restriction