Performs enrichment analysis (GSEA-based) for metabolic pathways across different cell groups to identify significantly enriched pathways. Uses fast gene set enrichment analysis (fgsea package) to rank pathways by their association with specific clusters, conditions, or cell states. Generates summary plots and enrichment visualizations for biological interpretation.
Performs enrichment analysis (GSEA-based) for metabolic pathways across different cell groups to identify significantly enriched pathways. Uses fast gene set enrichment analysis (fgsea package) to rank pathways by their association with specific clusters, conditions, or cell states. Generates summary plots and enrichment visualizations for biological interpretation.
MetabolicFeatures is part of the ScrnaMetabolicLandscape group. Enable it by enabling the group:
[ScrnaMetabolicLandscape]
cache = true
MetabolicFeatures receives input automatically from MetabolicInput (or MetabolicExprImputation if imputation enabled):
[ScrnaMetabolicLandscape.in]
srtobj = ["SeuratClustering"] # Input from upstream clustering process
All configuration is done at the ScrnaMetabolicLandscape group level:
[ScrnaMetabolicLandscape.envs]
# Core configuration (inherited by all metabolic processes)
gmtfile = "KEGG_2021_Human" # Metabolic pathways database
group_by = "seurat_clusters" # Column to group cells (e.g., "cluster")
subset_by = "treatment" # Optional: Subset by metadata column
ncores = 1 # Number of cores for parallelization
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
# Gene ranking method for GSEA
prerank_method = "signal_to_noise" # Options: signal_to_noise, abs_signal_to_noise, t_test, ratio_of_classes, diff_of_classes, log2_ratio_of_classes
ncores = 1 # Cores for parallel fgsea execution
# Comparison groups (optional - defaults to all vs all)
comparisons = [] # e.g., ["1", "2"] or ["1:2", "1:3"]
# fgsea parameters
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.fgsea_args]
minSize = 15 # Minimum pathway size
maxSize = 500 # Maximum pathway size
nproc = 1 # fgsea internal parallelization
# Plots configuration
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.plots]
"Summary Plot" = {
plot_type = "summary", # Options: summary, gsea, dot
top_term = 10, # Number of top pathways to show
devpars = { res = 100 } # Plot resolution
}
"Enrichment Plots" = {
plot_type = "gsea", # GSEA enrichment plot
top_term = 10,
devpars = { res = 100 }
}
# Multiple analysis cases (advanced)
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.cases]
"Treatment" = {
subset_by = "treatment",
group_by = "seurat_clusters",
prerank_method = "signal_to_noise",
comparisons = []
}
| Method | Code | Description | Use Case |
|--------|------|-------------|----------|
| Signal to Noise | signal_to_noise or s2n | (mean1 - mean2) / (sd1 + sd2) | Default; balanced approach |
| Absolute S2N | abs_signal_to_noise or abs_s2n | abs(signal_to_noise) | Magnitude-focused ranking |
| T-test | t_test | (mean1 - mean2) / SE | Statistical significance focus |
| Ratio of Classes | ratio_of_classes | mean1 / mean2 | Fold change (natural scale) |
| Diff of Classes | diff_of_classes | mean1 - mean2 | Absolute difference |
| Log2 Ratio | log2_ratio_of_classes | log2(mean1 / mean2) | Fold change (log scale, recommended for log-normalized data) |
Signal to Noise (Default): Best for most analyses
T-test: When statistical significance is priority
Log2 Ratio: For log-normalized data (Seurat default)
Ratio/Diff of Classes: For natural scale data
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.fgsea_args]
minSize = 15 # Minimum genes in pathway (filter small pathways)
maxSize = 500 # Maximum genes in pathway (filter very broad pathways)
nproc = 1 # Internal fgsea parallelization (set to ncores for speedup)
eps = 1e-50 # Epsilon for p-value calculation (lower = more precise)
MetabolicFeatures uses the fgsea R package for fast GSEA:
fgsea documentation: https://rdrr.io/bioc/fgsea/man/fgsea.html
# Empty comparisons = all groups vs all groups
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
comparisons = [] # Each group compared to all other groups
If group_by = "seurat_clusters" has clusters 1, 2, 3:
# Only analyze specific groups
comparisons = ["1", "2"] # Only clusters 1 and 2 vs rest
Results:
# Explicit pairwise comparisons
comparisons = ["1:2", "1:3", "2:3"]
Results:
The gmtfile parameter accepts:
"KEGG_2021_Human", "Reactome_Pathways_2024", "BioCarta_2016", "MSigDB_Hallmark_2020"/skills/processes/metabolicinput.md for detailed database options[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.in]
srtobj = ["SeuratClustering"]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "log2_ratio_of_classes" # Fold change for log-normalized data
ncores = 4
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.fgsea_args]
minSize = 10 # Allow smaller pathways
maxSize = 300 # Restrict to core pathways
nproc = 4 # Parallel fgsea
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "Reactome_Pathways_2024"
group_by = "treatment"
ncores = 8
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "t_test"
comparisons = ["control:treated", "control:resistant"]
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.fgsea_args]
minSize = 15
maxSize = 500
nproc = 8
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "signal_to_noise"
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.plots]
"Top Enriched Pathways" = {
plot_type = "summary",
top_term = 20,
devpars = { width = 1600, height = 1200, res = 300 }
}
"GSEA Enrichment Curves" = {
plot_type = "gsea",
top_term = 10,
devpars = { width = 1400, height = 1000, res = 300 }
}
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
ncores = 8
# Case 1: Cluster-based enrichment
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.cases.Clusters]
group_by = "seurat_clusters"
prerank_method = "signal_to_noise"
comparisons = []
plots = {
"Cluster Enrichment" = { plot_type = "summary", top_term = 15, devpars = { res = 150 } }
}
# Case 2: Treatment response
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.cases.Treatment]
subset_by = "response"
group_by = "treatment"
prerank_method = "log2_ratio_of_classes"
comparisons = ["responder:nonresponder"]
plots = {
"Response Enrichment" = { plot_type = "gsea", top_term = 10, devpars = { res = 150 } }
}
Identify enriched pathways per cluster:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "signal_to_noise"
Compare metabolic enrichment between conditions:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "Reactome_Pathways_2024"
group_by = "treatment"
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "log2_ratio_of_classes"
comparisons = ["control:treated"]
Analyze only glycolysis and OXPHOS:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "/data/pathways/glycolysis_oxphos.gmt"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "signal_to_noise"
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.fgsea_args]
minSize = 5 # Allow smaller custom pathways
Compare enrichment within T cell subsets only:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
subset_by = "celltype" # Metadata column to subset by
group_by = "activation_state"
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "t_test"
# Will analyze only cells where celltype == "T cell"
Large dataset with many comparisons:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
ncores = 16
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "signal_to_noise"
ncores = 16
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.fgsea_args]
nproc = 1 # Parallelize at comparison level, not within fgsea
MetabolicInput (part of ScrnaMetabolicLandscape group)MetabolicExprImputation (if imputation enabled with noimpute = false)CombinedInput → requires SeuratClustering or similar clustering processMetabolicPathwayActivity and MetabolicPathwayHeterogeneity (same group)group_by (e.g., cluster assignments)subset_by for subset analysisMetabolicFeatures generates the following outputs in the outdir directory (default: {{in.sobjfile | stem}}.pathwayfeatures):
gmtfile must be a valid enrichit database name OR accessible GMT filegroup_by column must exist in Seurat object metadatasubset_by specified, column must exist and NA values will be removedprerank_method must be one of: signal_to_noise, s2n, abs_signal_to_noise, abs_s2n, t_test, ratio_of_classes, diff_of_classes, log2_ratio_of_classesncores must be positive integercomparisons must be valid group names from group_by columnminSize < maxSizeminSize >= 1Cause: Weak biological signal or stringent filtering Solution:
# Relax pathway size filters
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.fgsea_args]
minSize = 5
maxSize = 1000
# Try different ranking method
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "log2_ratio_of_classes"
Cause: Many comparisons or insufficient parallelization Solution:
# Increase parallelization
[ScrnaMetabolicLandscape.envs]
ncores = 8
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
ncores = 8
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.fgsea_args]
nproc = 8 # Parallelize fgsea internally
# Or reduce comparison scope
comparisons = ["1:2", "1:3"] # Only specific comparisons
Cause: GMT file gene names don't match Seurat object Solution:
name\tdescription\tgene1\tgene2\tgene3Cause: Insufficient cells in comparison groups Solution:
# Check group sizes first
# Ensure each group has >30 cells for reliable statistics
# Or remove small groups
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
comparisons = ["1", "2"] # Exclude small cluster 3
Cause: top_term too high or too many significant pathways
Solution:
# Reduce number of pathways shown
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.plots]
"Summary Plot" = {
plot_type = "summary",
top_term = 5, # Show only top 5 pathways
devpars = { width = 1200, height = 600, res = 150 }
}
Cause: Wrong ranking method for data type Solution:
# For log-normalized Seurat data (default), use:
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
prerank_method = "log2_ratio_of_classes"
# For raw/natural scale data, use:
prerank_method = "ratio_of_classes"
Cause: Too many pathways or parallel processes Solution:
# Reduce parallelization
[ScrnaMetabolicLandscape.MetabolicFeatures.envs]
ncores = 2
[ScrnaMetabolicLandscape.MetabolicFeatures.envs.fgsea_args]
nproc = 1
# Or filter pathways more aggressively
minSize = 20
maxSize = 300
fgsea algorithm:
GSEA methodology:
/skills/processes/metabolicinput.md/skills/processes/scrnametaboliclandscape.md - Full metabolic analysis group/skills/processes/metabolicinput.md - Input preparation and GMT databases/skills/processes/metabolicpathwayactivity.md - Pathway activity scoring (AUCell-based)/skills/processes/metabolicpathwayheterogeneity.md - Heterogeneity analysisnpx skills add pwwang/代谢特征下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Category:science-education