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

Grouping variable used in RunMetabolism.

assay_name

Assay or tools slot containing metabolism results.

...

Additional arguments passed to GSVAPlot.

verbose

Whether to print messages.

Examples

data(pancreas_sub)
pancreas_sub <- RunStandardWorkflow(pancreas_sub)
#>  [2026-08-30 04:35:06] Start standard processing workflow...
#>  [2026-08-30 04:35:06] Checking a list of <Seurat>...
#> ! [2026-08-30 04:35:06] Data 1/1 of the `srt_list` is "unknown"
#> Warning: Data 1/1 of the `srt_list` is "unknown"
#>  [2026-08-30 04:35:06] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-08-30 04:35:06] Perform `FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-08-30 04:35:06] Use the separate HVF from `srt_list`
#>  [2026-08-30 04:35:06] Number of available HVF: 2000
#>  [2026-08-30 04:35:06] Finished check
#>  [2026-08-30 04:35:06] Perform `ScaleData()`
#>  [2026-08-30 04:35:06] Perform pca linear dimension reduction
#>  [2026-08-30 04:35:07] Use stored estimated dimensions 1:23 for Standardpca
#>  [2026-08-30 04:35:07] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-08-30 04:35:07] Reorder clusters...
#>  [2026-08-30 04:35:07] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-08-30 04:35:07] Perform umap nonlinear dimension reduction
#>  [2026-08-30 04:35:14] 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-08-30 04:35:14] Start metabolism pathway scoring
#>  [2026-08-30 04:35:15] Data type is raw counts
#>  [2026-08-30 04:35:15] Averaging expression by "CellType" ...
#>  [2026-08-30 04:35:15] Aggregated expression: 15998 genes x 5 groups
#>  [2026-08-30 04:35:15] Using raw scMetabolism gene sets with species conversion to "Mus_musculus"
#>  [2026-08-30 04:35:15] Converting 3297 human gene symbols to "Mus_musculus" via biomaRt ...
#> ! [2026-08-30 04:35:15] `GeneConvert()` failed: "variable names are limited to 10000 bytes". Falling back to direct symbol matching.
#> Warning: `GeneConvert()` failed: "variable names are limited to 10000 bytes". Falling back to direct symbol matching.
#>  [2026-08-30 04:35:15] Total metabolism gene sets to score: 127
#>  [2026-08-30 04:35:15] 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
)
#> 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-08-30 04:35:18] 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-08-30 04:35:22] Start metabolism pathway scoring
#>  [2026-08-30 04:35:22] Data type is raw counts
#>  [2026-08-30 04:35:23] Using raw scMetabolism gene sets with species conversion to "Mus_musculus"
#>  [2026-08-30 04:35:23] Converting 3297 human gene symbols to "Mus_musculus" via biomaRt ...
#> ! [2026-08-30 04:35:23] `GeneConvert()` failed: "variable names are limited to 10000 bytes". Falling back to direct symbol matching.
#> Warning: `GeneConvert()` failed: "variable names are limited to 10000 bytes". Falling back to direct symbol matching.
#>  [2026-08-30 04:35:23] Total metabolism gene sets to score: 127
#>  [2026-08-30 04:35:23] Metabolism scores stored in tools slot "Metabolism_AUCell"
#>  [2026-08-30 04:35:23] 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-08-30 04:35:24] The values in the "counts" layer are non-integer. Set the library size to "1"
#> Warning: The values in the "counts" layer are non-integer. Set the library size to "1"