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-03-20 09:06:19] Start standard scop workflow...
#>  [2026-03-20 09:06:19] Checking a list of <Seurat>...
#> ! [2026-03-20 09:06:19] Data 1/1 of the `srt_list` is "unknown"
#>  [2026-03-20 09:06:19] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-03-20 09:06:21] Perform `Seurat::FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-03-20 09:06:22] Use the separate HVF from `srt_list`
#>  [2026-03-20 09:06:22] Number of available HVF: 2000
#>  [2026-03-20 09:06:22] Finished check
#>  [2026-03-20 09:06:22] Perform `Seurat::ScaleData()`
#>  [2026-03-20 09:06:23] Perform pca linear dimension reduction
#>  [2026-03-20 09:06:23] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-03-20 09:06:24] Reorder clusters...
#>  [2026-03-20 09:06:24] Perform umap nonlinear dimension reduction
#>  [2026-03-20 09:06:24] Perform umap nonlinear dimension reduction using Standardpca (1:50)
#>  [2026-03-20 09:06:28] Perform umap nonlinear dimension reduction using Standardpca (1:50)
#>  [2026-03-20 09:06:31] Run scop standard workflow completed
pancreas_sub <- RunMetabolism(
  pancreas_sub,
  db = c("KEGG", "REACTOME"),
  group.by = "CellType",
  species = "Mus_musculus",
  method = "AUCell"
)
#>  [2026-03-20 09:06:31] Start metabolism pathway scoring
#>  [2026-03-20 09:06:32] Data type is raw counts
#>  [2026-03-20 09:06:32] Averaging expression by "CellType" ...
#>  [2026-03-20 09:06:32] Aggregated expression: 15998 genes x 5 groups
#>  [2026-03-20 09:06:32] Species: "Mus_musculus"
#>  [2026-03-20 09:06:32] Preparing KEGG database
#>  [2026-03-20 09:06:46] Preparing Reactome database
#>  [2026-03-20 09:06:51] Convert ID types for the KEGG database
#>  [2026-03-20 09:06:51] Connect to the Ensembl archives...
#>  [2026-03-20 09:06:51] Using the 115 version of ensembl database...
#>  [2026-03-20 09:06:51] Downloading the ensembl database from https://sep2025.archive.ensembl.org...
#>  [2026-03-20 09:06:54] Searching the dataset mmusculus ...
#>  [2026-03-20 09:06:54] Connecting to the dataset mmusculus_gene_ensembl ...
#>  [2026-03-20 09:06:57] Converting the geneIDs...
#> ! [2026-03-20 09:07:00] <simpleError in .processResults(postRes, mart = mart, hostURLsep = sep, fullXmlQuery = fullXmlQuery,     quote = quote, numAttributes = length(attributes)): Query ERROR: caught BioMart::Exception::Database: Could not connect to mysql database ensembl_mart_115: DBI connect('database=ensembl_mart_115;host=127.0.0.1;port=5316','ensro',...) failed: Can't connect to MySQL server on '127.0.0.1' (111) at /nfs/public/ro/ensweb/live/mart/www_115/biomart-perl/lib/BioMart/Configuration/DBLocation.pm line 98.
#> !                       >
#> ! [2026-03-20 09:07:00] Get errors when retrieving information from the BioMart database
#> ! [2026-03-20 09:07:01] Retrying...
#>  [2026-03-20 09:07:03] 10581 genes mapped with "entrez_id"
#>  [2026-03-20 09:07:03] ==============================
#>                        10581 genes mapped
#>                        573 genes unmapped
#>                        ==============================
#>  [2026-03-20 09:07:07] Convert ID types for the Reactome database
#>  [2026-03-20 09:07:07] Connect to the Ensembl archives...
#>  [2026-03-20 09:07:07] Using the 115 version of ensembl database...
#>  [2026-03-20 09:07:07] Downloading the ensembl database from https://sep2025.archive.ensembl.org...
#>  [2026-03-20 09:07:08] Searching the dataset mmusculus ...
#>  [2026-03-20 09:07:08] Connecting to the dataset mmusculus_gene_ensembl ...
#>  [2026-03-20 09:07:11] Converting the geneIDs...
#>  [2026-03-20 09:07:54] 8776 genes mapped with "entrez_id"
#>  [2026-03-20 09:07:54] ==============================
#>                        8776 genes mapped
#>                        4 genes unmapped
#>                        ==============================
#>  [2026-03-20 09:07:57] Total metabolism gene sets to score: 109
#>  [2026-03-20 09:08:23] Metabolism scores stored in tools slot "Metabolism_CellType_AUCell"

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


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.


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-03-20 09:08:27] 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-03-20 09:08:31] Start metabolism pathway scoring
#>  [2026-03-20 09:08:32] Data type is raw counts
#>  [2026-03-20 09:08:32] Species: "Mus_musculus"
#>  [2026-03-20 09:08:32] Loading cached: KEGG version: Release 117.0+/03-20, Mar 26 nterm:366 created: 2026-03-20 09:07:07
#>  [2026-03-20 09:08:33] Loading cached: Reactome version: 1.95.0 nterm:1815 created: 2026-03-20 09:07:57
#>  [2026-03-20 09:08:33] Total metabolism gene sets to score: 109
#>  [2026-03-20 09:08:38] Metabolism scores stored in tools slot "Metabolism_AUCell"
#>  [2026-03-20 09:08:38] 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-03-20 09:08:39] The values in the "counts" layer are non-integer. Set the library size to "1"