Skip to contents

Plots for metabolism pathway scoring

Usage

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

Arguments

object

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

Grouping variable used in RunMetabolism.

assay_name

Assay or tools slot containing metabolism results.

...

Additional arguments passed to GSVAPlot.

verbose

Whether to print messages.

srt

Deprecated alias for object; supply exactly one of the two. It will be removed in scop 1.0.0.

Examples

data(pancreas_sub)
pancreas_sub <- RunStandardWorkflow(pancreas_sub)
#> ℹ [2026-10-11 23:01:17] Start standard processing workflow...
#> ℹ [2026-10-11 23:01:17] Checking a list of <Seurat>...
#> ! [2026-10-11 23:01:17] Data 1/1 of the `srt_list` is "unknown"
#> ℹ [2026-10-11 23:01:17] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#> ℹ [2026-10-11 23:01:17] Perform `FindVariableFeatures()` on 1/1 of `srt_list`...
#> ℹ [2026-10-11 23:01:17] Use the separate HVF from `srt_list`
#> ℹ [2026-10-11 23:01:17] Number of available HVF: 2000
#> ℹ [2026-10-11 23:01:17] Finished check
#> ℹ [2026-10-11 23:01:17] Perform `ScaleData()`
#> ℹ [2026-10-11 23:01:17] Perform pca linear dimension reduction
#> ℹ [2026-10-11 23:01:18] Use stored estimated dimensions 1:23 for Standardpca
#> ℹ [2026-10-11 23:01:18] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#> ℹ [2026-10-11 23:01:18] Reorder clusters...
#> ℹ [2026-10-11 23:01:18] Skip `log1p()` because `layer = data` is not "counts"
#> ℹ [2026-10-11 23:01:18] Perform umap nonlinear dimension reduction
#> ✔ [2026-10-11 23:01:24] Standard processing workflow completed
pancreas_sub <- RunMetabolism(
  pancreas_sub,
  db = c("KEGG", "REACTOME"),
  group.by = "CellType",
  species = "Mus_musculus",
  method = "AUCell",
  use_preparedb = FALSE
)
#> ℹ [2026-10-11 23:01:24] Start metabolism pathway scoring
#> ℹ [2026-10-11 23:01:25] Data type is raw counts
#> ℹ [2026-10-11 23:01:25] Averaging expression by "CellType" ...
#> ℹ [2026-10-11 23:01:25] Aggregated expression: 15998 genes x 5 groups
#> ℹ [2026-10-11 23:01:25] Using raw scMetabolism gene sets with species conversion to "Mus_musculus"
#> ℹ [2026-10-11 23:01:25] Converting 3297 human gene symbols to "Mus_musculus" via biomaRt ...
#> ! [2026-10-11 23:01:25] `GeneConvert()` failed: "variable names are limited to 10000 bytes". Falling back to direct symbol matching.
#> ℹ [2026-10-11 23:01:25] Total metabolism gene sets to score: 127
#> ✔ [2026-10-11 23:01:25] Metabolism scores stored in tools slot "Metabolism_CellType_AUCell"

ht1 <- MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  plot_type = "heatmap",
  topTerm = 10,
  show_row_names = TRUE,
  width = 1,
  height = 2
)
ht1$plot


ht2 <- MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  plot_type = "heatmap",
  n_split = 3,
  topTerm = 100,
  use_raster = TRUE,
  width = 1,
  height = 2
)
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-10-11 23:01:28] 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",
  use_preparedb = FALSE
)
#> ℹ [2026-10-11 23:01:33] Start metabolism pathway scoring
#> ℹ [2026-10-11 23:01:33] Data type is raw counts
#> ℹ [2026-10-11 23:01:33] Using raw scMetabolism gene sets with species conversion to "Mus_musculus"
#> ℹ [2026-10-11 23:01:33] Converting 3297 human gene symbols to "Mus_musculus" via biomaRt ...
#> ! [2026-10-11 23:01:33] `GeneConvert()` failed: "variable names are limited to 10000 bytes". Falling back to direct symbol matching.
#> ℹ [2026-10-11 23:01:33] Total metabolism gene sets to score: 127
#> ✔ [2026-10-11 23:01:34] Metabolism scores stored in tools slot "Metabolism_AUCell"
#> ℹ [2026-10-11 23:01:34] 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"
)


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-10-11 23:01:35] The values in the "counts" layer are non-integer. Set the library size to "1"