Skip to contents

Plots for metabolism pathway scoring

Usage

MetabolismPlot(
  srt = NULL,
  res = NULL,
  group.by = NULL,
  assay_name = "METABOLISM",
  ...
)

Arguments

srt

A Seurat object containing the results of RunMetabolism.

res

GSVA results generated by RunGSVA function. If provided, 'srt' and 'group.by' are ignored.

group.by

A character vector specifying the grouping variable used in RunMetabolism.

assay_name

The name of the assay or tools slot containing metabolism results. Default is "METABOLISM".

...

Additional arguments passed to GSVAPlot.

Examples

data(pancreas_sub)
pancreas_sub <- standard_scop(pancreas_sub)
#>  [2026-04-26 01:50:17] Start standard processing workflow...
#>  [2026-04-26 01:50:18] Checking a list of <Seurat>...
#> ! [2026-04-26 01:50:18] Data 1/1 of the `srt_list` is "unknown"
#>  [2026-04-26 01:50:18] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-04-26 01:50:20] Perform `Seurat::FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-04-26 01:50:21] Use the separate HVF from `srt_list`
#>  [2026-04-26 01:50:21] Number of available HVF: 2000
#>  [2026-04-26 01:50:21] Finished check
#>  [2026-04-26 01:50:21] Perform `Seurat::ScaleData()`
#>  [2026-04-26 01:50:22] Perform pca linear dimension reduction
#>  [2026-04-26 01:50:22] Use stored estimated dimensions 1:20 for Standardpca
#>  [2026-04-26 01:50:23] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-04-26 01:50:23] Reorder clusters...
#>  [2026-04-26 01:50:23] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-04-26 01:50:23] Perform umap nonlinear dimension reduction
#>  [2026-04-26 01:50:23] Perform umap nonlinear dimension reduction using Standardpca (1:20)
#>  [2026-04-26 01:50:28] Perform umap nonlinear dimension reduction using Standardpca (1:20)
#>  [2026-04-26 01:50:32] Standard processing workflow completed
pancreas_sub <- RunMetabolism(
  pancreas_sub,
  db = c("KEGG", "REACTOME"),
  group.by = "CellType",
  species = "Mus_musculus",
  method = "AUCell"
)
#>  [2026-04-26 01:50:32] Start metabolism pathway scoring
#>  [2026-04-26 01:50:33] Data type is raw counts
#>  [2026-04-26 01:50:33] Averaging expression by "CellType" ...
#>  [2026-04-26 01:50:33] Aggregated expression: 15998 genes x 5 groups
#>  [2026-04-26 01:50:33] Using raw scMetabolism gene sets directly; `PrepareDB()` / BioMart-based ID rebuilding is skipped
#>  [2026-04-26 01:50:33] Total metabolism gene sets to score: 127
#>  [2026-04-26 01:50:58] Metabolism scores stored in tools slot "Metabolism_CellType_AUCell"

ht1 <- MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  plot_type = "heatmap",
  topTerm = 10,
  width = 1,
  height = 2
)
#> Warning: Data is of class matrix. Coercing to dgCMatrix.

ht1$plot


ht2 <- MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  plot_type = "heatmap",
  n_split = 3,
  topTerm = 100,
  use_raster = TRUE,
  width = 1,
  height = 2
)
#> Warning: Data is of class matrix. Coercing to dgCMatrix.

ht2$plot


MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  db = "GO_BP",
  plot_type = "comparison",
  topTerm = 5
)


MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  db = "GO_BP",
  group_use = "Ductal",
  plot_type = "bar",
  topTerm = 5
)


MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  group_use = "Ductal",
  db = "GO_BP",
  plot_type = "network",
  topTerm = 3
)
#>  [2026-04-26 01:51:04] shadowtext installed successfully


MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  group_use = "Ductal",
  db = "GO_BP",
  plot_type = "enrichmap"
)


MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  group_use = "Ductal",
  plot_type = "wordcloud",
  word_type = "feature"
)


pancreas_sub <- RunMetabolism(
  pancreas_sub,
  assay_name = "METABOLISM",
  db = c("KEGG", "REACTOME"),
  species = "Mus_musculus"
)
#>  [2026-04-26 01:51:09] Start metabolism pathway scoring
#>  [2026-04-26 01:51:09] Data type is raw counts
#>  [2026-04-26 01:51:09] Using raw scMetabolism gene sets directly; `PrepareDB()` / BioMart-based ID rebuilding is skipped
#>  [2026-04-26 01:51:10] Total metabolism gene sets to score: 127
#>  [2026-04-26 01:51:14] Metabolism scores stored in tools slot "Metabolism_AUCell"
#>  [2026-04-26 01:51:14] Metabolism scores also stored in assay "METABOLISM"

FeatureDimPlot(
  pancreas_sub,
  assay = "METABOLISM",
  features = rownames(pancreas_sub[["METABOLISM"]])[1:2],
  reduction = "umap"
)


FeatureStatPlot(
  pancreas_sub,
  stat.by = rownames(pancreas_sub[["METABOLISM"]])[1:2],
  group.by = "CellType",
  assay = "METABOLISM"
)
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.


ht <- GroupHeatmap(
  pancreas_sub,
  exp_legend_title = "Z-score",
  features = rownames(pancreas_sub[["METABOLISM"]])[1:10],
  group.by = "CellType",
  assay = "METABOLISM",
  width = 1,
  height = 2
)
#> ! [2026-04-26 01:51:15] The values in the "counts" layer are non-integer. Set the library size to "1"