Skip to contents

Plots for metabolism pathway scoring

Usage

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

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.

verbose

Whether to print the message. Default is TRUE.

Examples

data(pancreas_sub)
pancreas_sub <- standard_scop(pancreas_sub)
#>  [2026-07-02 09:17:07] Start standard processing workflow...
#>  [2026-07-02 09:17:08] Checking a list of <Seurat>...
#> ! [2026-07-02 09:17:08] Data 1/1 of the `srt_list` is "unknown"
#>  [2026-07-02 09:17:08] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-07-02 09:17:08] Perform `FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-07-02 09:17:08] Use the separate HVF from `srt_list`
#>  [2026-07-02 09:17:08] Number of available HVF: 2000
#>  [2026-07-02 09:17:08] Finished check
#>  [2026-07-02 09:17:08] Perform `ScaleData()`
#>  [2026-07-02 09:17:08] Perform pca linear dimension reduction
#>  [2026-07-02 09:17:09] Use stored estimated dimensions 1:23 for Standardpca
#>  [2026-07-02 09:17:09] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-07-02 09:17:09] Reorder clusters...
#>  [2026-07-02 09:17:09] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-07-02 09:17:09] Perform umap nonlinear dimension reduction
#>  [2026-07-02 09:17:15] Standard processing workflow completed
pancreas_sub <- RunMetabolism(
  pancreas_sub,
  db = c("KEGG", "REACTOME"),
  group.by = "CellType",
  species = "Mus_musculus",
  method = "AUCell"
)
#>  [2026-07-02 09:17:15] Start metabolism pathway scoring
#>  [2026-07-02 09:17:15] Data type is raw counts
#>  [2026-07-02 09:17:15] Averaging expression by "CellType" ...
#>  [2026-07-02 09:17:15] Aggregated expression: 15998 genes x 5 groups
#>  [2026-07-02 09:17:15] Using `PrepareDB()` for species-aware gene set construction
#>  [2026-07-02 09:17:16]   KEGG pathway refs: 85, Reactome pathway names: 82
#>  [2026-07-02 09:17:16] Species: "Mus_musculus"
#>  [2026-07-02 09:17:16] Preparing KEGG database
#>  [2026-07-02 09:17:17] <simpleError in utils::download.file(url = url, destfile = destfile, method = method,     quiet = quiet, ...): cannot open URL 'https://rest.kegg.jp/list/organism'>
#> ! [2026-07-02 09:17:17] Failed to download using auto, from <https://rest.kegg.jp/list/organism>
#>  [2026-07-02 09:17:19] <simpleError in utils::download.file(url = url, destfile = destfile, method = method,     quiet = quiet, ...): 'wget' call had nonzero exit status>
#> ! [2026-07-02 09:17:19] Failed to download using wget, from <https://rest.kegg.jp/list/organism>
#>  [2026-07-02 09:17:22] <simpleError in utils::download.file(url = url, destfile = destfile, method = method,     quiet = quiet, ...): cannot open URL 'https://rest.kegg.jp/list/organism'>
#> ! [2026-07-02 09:17:22] Failed to download using libcurl, from <https://rest.kegg.jp/list/organism>
#> Error in `[.data.frame`(orgs, , 3): undefined columns selected

ht1 <- MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  plot_type = "heatmap",
  topTerm = 10,
  show_row_names = TRUE,
  width = 1,
  height = 2
)
#> Error in MetabolismPlot(pancreas_sub, group.by = "CellType", plot_type = "heatmap",     topTerm = 10, show_row_names = TRUE, width = 1, height = 2): Metabolism results not found. Please run RunMetabolism first
ht1$plot
#> Error: object 'ht1' not found

ht2 <- MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  plot_type = "heatmap",
  n_split = 3,
  topTerm = 100,
  use_raster = TRUE,
  width = 1,
  height = 2
)
#> Error in MetabolismPlot(pancreas_sub, group.by = "CellType", plot_type = "heatmap",     n_split = 3, topTerm = 100, use_raster = TRUE, width = 1,     height = 2): Metabolism results not found. Please run RunMetabolism first
ht2$plot
#> Error: object 'ht2' not found

MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  db = "GO_BP",
  plot_type = "comparison",
  topTerm = 5
)
#> Error in MetabolismPlot(pancreas_sub, group.by = "CellType", db = "GO_BP",     plot_type = "comparison", topTerm = 5): Metabolism results not found. Please run RunMetabolism first

MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  db = "GO_BP",
  group_use = "Ductal",
  plot_type = "bar",
  topTerm = 5
)
#> Error in MetabolismPlot(pancreas_sub, group.by = "CellType", db = "GO_BP",     group_use = "Ductal", plot_type = "bar", topTerm = 5): Metabolism results not found. Please run RunMetabolism first

MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  group_use = "Ductal",
  db = "GO_BP",
  plot_type = "network",
  topTerm = 3
)
#> Error in MetabolismPlot(pancreas_sub, group.by = "CellType", group_use = "Ductal",     db = "GO_BP", plot_type = "network", topTerm = 3): Metabolism results not found. Please run RunMetabolism first

MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  group_use = "Ductal",
  db = "GO_BP",
  plot_type = "enrichmap"
)
#> Error in MetabolismPlot(pancreas_sub, group.by = "CellType", group_use = "Ductal",     db = "GO_BP", plot_type = "enrichmap"): Metabolism results not found. Please run RunMetabolism first

MetabolismPlot(
  pancreas_sub,
  group.by = "CellType",
  group_use = "Ductal",
  plot_type = "wordcloud",
  word_type = "feature"
)
#> Error in MetabolismPlot(pancreas_sub, group.by = "CellType", group_use = "Ductal",     plot_type = "wordcloud", word_type = "feature"): Metabolism results not found. Please run RunMetabolism first

pancreas_sub <- RunMetabolism(
  pancreas_sub,
  assay_name = "METABOLISM",
  db = c("KEGG", "REACTOME"),
  species = "Mus_musculus"
)
#>  [2026-07-02 09:17:24] Start metabolism pathway scoring
#>  [2026-07-02 09:17:24] Data type is raw counts
#>  [2026-07-02 09:17:24] Using `PrepareDB()` for species-aware gene set construction
#>  [2026-07-02 09:17:24]   KEGG pathway refs: 85, Reactome pathway names: 82
#>  [2026-07-02 09:17:24] Species: "Mus_musculus"
#>  [2026-07-02 09:17:24] Preparing KEGG database
#>  [2026-07-02 09:17:25] <simpleError in utils::download.file(url = url, destfile = destfile, method = method,     quiet = quiet, ...): cannot open URL 'https://rest.kegg.jp/list/organism'>
#> ! [2026-07-02 09:17:25] Failed to download using auto, from <https://rest.kegg.jp/list/organism>
#>  [2026-07-02 09:17:27] <simpleError in utils::download.file(url = url, destfile = destfile, method = method,     quiet = quiet, ...): 'wget' call had nonzero exit status>
#> ! [2026-07-02 09:17:27] Failed to download using wget, from <https://rest.kegg.jp/list/organism>
#>  [2026-07-02 09:17:30] <simpleError in utils::download.file(url = url, destfile = destfile, method = method,     quiet = quiet, ...): cannot open URL 'https://rest.kegg.jp/list/organism'>
#> ! [2026-07-02 09:17:30] Failed to download using libcurl, from <https://rest.kegg.jp/list/organism>
#> Error in `[.data.frame`(orgs, , 3): undefined columns selected

FeatureDimPlot(
  pancreas_sub,
  assay = "METABOLISM",
  features = rownames(pancreas_sub[["METABOLISM"]])[1:2],
  reduction = "umap"
)
#> Error in pancreas_sub[["METABOLISM"]]: ‘METABOLISM’ not found in this Seurat object
#>  

FeatureStatPlot(
  pancreas_sub,
  stat.by = rownames(pancreas_sub[["METABOLISM"]])[1:2],
  group.by = "CellType",
  assay = "METABOLISM"
)
#> Error in GetAssayData5(srt, assay = assay, layer = layer): "METABOLISM" is not an assay present in the given object. Available
#> assays are: "RNA", "spliced", and "unspliced"

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
)
#> Error in pancreas_sub[["METABOLISM"]]: ‘METABOLISM’ not found in this Seurat object
#>