Calculates pathway activity scores for metabolic pathways across different cell groups and subsets. This process quantifies the metabolic activity of each pathway per group, generating visualizations (heatmaps and violin plots) to compare metabolic states between clusters or conditions. Based on the methodology from Xiao et al.
Calculates pathway activity scores for metabolic pathways across different cell groups and subsets. This process quantifies the metabolic activity of each pathway per group, generating visualizations (heatmaps and violin plots) to compare metabolic states between clusters or conditions. Based on the methodology from Xiao et al. (2019) Nature Communications.
MetabolicPathwayActivity is part of the ScrnaMetabolicLandscape group. Enable it by enabling the group:
[ScrnaMetabolicLandscape]
cache = true
MetabolicPathwayActivity receives input automatically from MetabolicInput:
[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.MetabolicPathwayActivity.envs]
# Statistical analysis
ntimes = 5000 # Number of permutations for p-value estimation
# Plot customization (default plots)
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.plots]
"Pathway Activity (violin plot)" = {
plot_type = "violin", # Options: "heatmap", "violin", "merged_heatmap"
add_box = true, # Add box plot inside violin
devpars = { res = 100 } # Plot resolution
}
"Pathway Activity (heatmap)" = {
plot_type = "heatmap",
devpars = { res = 100 }
}
"All Subsets (merged)" = {
plot_type = "merged_heatmap", # All subsets in one plot
devpars = { res = 100 }
}
# Multiple analysis cases (advanced)
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.cases]
"Treatment" = {
subset_by = "treatment", # Analyze by treatment groups
group_by = "seurat_clusters",
plots = { "Treatment Activity" = { plot_type = "violin", add_box = true } }
}
"Response" = {
subset_by = "response", # Analyze by response groups
group_by = "seurat_clusters",
plots = { "Response Activity" = { plot_type = "heatmap" } }
}
MetabolicPathwayActivity uses AUCell-like scoring to calculate pathway activity:
ntimes permutations to estimate statistical significancentimes times to estimate null distributionThe 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.MetabolicPathwayActivity.envs]
ntimes = 10000 # More permutations for robust p-values
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.plots]
"Activity Violin" = {
plot_type = "violin",
add_box = true,
devpars = { width = 1200, height = 800, res = 150 }
}
"Activity Heatmap" = {
plot_type = "heatmap",
devpars = { width = 1400, height = 1000, res = 150 }
}
"Merged Heatmap" = {
plot_type = "merged_heatmap",
devpars = { width = 1600, height = 1200, res = 150 }
}
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
subset_by = "treatment" # Compare between treatment groups
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs]
ntimes = 5000
ncores = 4
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.plots]
"Treatment Violin" = { plot_type = "violin", add_box = true }
"Treatment Heatmap" = { plot_type = "heatmap" }
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
ncores = 8
# Case 1: Treatment analysis
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.cases.Treatment]
subset_by = "treatment"
group_by = "seurat_clusters"
ntimes = 5000
plots = {
"Treatment Activity" = { plot_type = "violin", add_box = true, devpars = { res = 150 } }
}
# Case 2: Response analysis
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.cases.Response]
subset_by = "response"
group_by = "seurat_clusters"
ntimes = 10000
plots = {
"Response Heatmap" = { plot_type = "heatmap", devpars = { res = 150 } }
}
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
# Use custom GMT focused on energy pathways
gmtfile = "/data/pathways/energy_metabolism.gmt"
group_by = "seurat_clusters"
ncores = 4
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs]
ntimes = 10000
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.plots]
"Energy Pathways" = { plot_type = "heatmap", devpars = { res = 150 } }
Standard analysis with KEGG pathways:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
Focus on specific energy pathways using custom GMT:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "/path/to/energy_pathways.gmt"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs]
ntimes = 5000
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.plots]
"Energy Activity" = { plot_type = "violin", add_box = true }
Compare metabolic activity across different conditions:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "Reactome_Pathways_2024"
group_by = "seurat_clusters"
subset_by = "condition" # e.g., "control", "treatment_A", "treatment_B"
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs]
ntimes = 10000
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.plots]
"Condition Comparison" = { plot_type = "heatmap" }
"Condition Distribution" = { plot_type = "violin", add_box = true }
"All Conditions" = { plot_type = "merged_heatmap" }
For large datasets requiring parallel processing:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
ncores = 16
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs]
ntimes = 2000 # Fewer permutations for speed
High-resolution plots for manuscripts:
[ScrnaMetabolicLandscape]
[ScrnaMetabolicLandscape.envs]
gmtfile = "KEGG_2021_Human"
group_by = "seurat_clusters"
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs]
ntimes = 10000
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.plots]
"Pathway Activity Heatmap" = {
plot_type = "heatmap",
devpars = { width = 1600, height = 1200, res = 300 }
}
"Pathway Activity Violin" = {
plot_type = "violin",
add_box = true,
devpars = { width = 1200, height = 800, res = 300 }
}
MetabolicInput (part of ScrnaMetabolicLandscape group)MetabolicExprImputation (if imputation enabled with noimpute = false)CombinedInput → requires SeuratClustering or similar clustering processMetabolicFeatures and MetabolicPathwayHeterogeneity (same group)group_by (e.g., cluster assignments)subset_by for subset analysisMetabolicPathwayActivity generates the following outputs in the outdir directory (default: {{in.sobjfile | stem}}.pathwayactivity):
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 removedntimes must be positive integer (recommended: 1000-10000)ncores must be positive integer (adjust based on available CPU)heatmap, violin, merged_heatmapCause: Gene name mismatch between GMT file and Seurat object Solution:
sobj@assays$RNA@features[1:10,] (R)name\tdescription\tgene1,gene2,gene3Cause: High ntimes or insufficient ncores
Solution:
# Reduce permutations for faster analysis
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs]
ntimes = 2000 # Default is 5000
# Increase cores for parallelization
[ScrnaMetabolicLandscape.envs]
ncores = 8 # Increase based on available CPU
Cause: Large dataset with high ncores
Solution:
# Reduce cores to limit parallel memory usage
[ScrnaMetabolicLandscape.envs]
ncores = 2 # Reduce from default 1 if memory issues
# Reduce permutations
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs]
ntimes = 1000
Cause: Groups have similar metabolic profiles or insufficient statistical power Solution:
ntimes for more robust p-value estimationgroup_by column captures meaningful biological differencessubset_byCause: NA values in subset_by column or mismatched categories
Solution:
# Clean metadata before analysis
[ScrnaMetabolicLandscape.envs]
mutaters = {treatment_clean = "if_else(is.na(treatment), 'unknown', treatment)"}
subset_by = "treatment_clean"
Cause: GMT file contains too many pathways for visualization Solution:
# Use smaller pathway database or custom GMT with selected pathways
gmtfile = "/path/to/core_metabolism.gmt" # Custom curated pathways
Cause: Too many groups or pathways Solution:
# Generate multiple plots with subsets
[ScrnaMetabolicLandscape.MetabolicPathwayActivity.envs.plots]
"Part 1" = {
plot_type = "violin",
add_box = true,
# Additional filtering options via plotthis
}
# Or use merged_heatmap for overview
"Overview" = { plot_type = "merged_heatmap" }
Xiao, Zhengtao, Ziwei Dai, and Jason W. Locasale. "Metabolic landscape of the tumor microenvironment at single cell resolution." Nature communications 10.1 (2019): 1-12. https://www.nature.com/articles/s41467-019-11738-0
AUCell: https://github.com/aertslab/AUCell - Area Under the Curve for gene set enrichment in single-cell data
/skills/processes/scrnametaboliclandscape.md - Full metabolic analysis group/skills/processes/metabolicinput.md - Input preparation and GMT databasesnpx skills add pwwang/代谢通路活性下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Category:science-education