Skip to contents

For each gene, generates one PDF with one row per spatial image, and four columns: UMAP colored by clusters, UMAP colored by gene expression, spatial plot colored by clusters, and spatial plot colored by gene expression. A single pair of legends (categorical + continuous) is attached to the right.

Usage

PlotMasterMaps(
  seurat_object,
  features,
  imgalpha = 1,
  alpha = 1,
  group.by = "seurat_clusters",
  images_to_plot = NULL,
  remove_outliers = FALSE,
  outlier_prob = 0.01,
  size_override = NULL,
  calcptsizesc = 100,
  colors = NULL,
  gene_colors = c("#053061", "#2166AC", "#D1E5F0", "#FDDBC7", "#F4A582", "#D6604D",
    "#B2182B", "#67001F"),
  legend.side = "right",
  legend.direction = "vertical",
  output_dir = NULL,
  object_name = "",
  subset_name = "",
  file_name = NULL,
  width = NULL,
  height = NULL,
  timestamp = FALSE,
  cluster_col = NULL,
  cluster_colors = NULL
)

GenerateMasterGeneMaps(
  seurat_object,
  features,
  imgalpha = 1,
  alpha = 1,
  group.by = "seurat_clusters",
  images_to_plot = NULL,
  remove_outliers = FALSE,
  outlier_prob = 0.01,
  size_override = NULL,
  calcptsizesc = 100,
  colors = NULL,
  gene_colors = c("#053061", "#2166AC", "#D1E5F0", "#FDDBC7", "#F4A582", "#D6604D",
    "#B2182B", "#67001F"),
  legend.side = "right",
  legend.direction = "vertical",
  output_dir = NULL,
  object_name = "",
  subset_name = "",
  file_name = NULL,
  width = NULL,
  height = NULL,
  timestamp = FALSE,
  cluster_col = NULL,
  cluster_colors = NULL
)

Arguments

seurat_object

A Seurat object with both "umap" reduction and spatial images.

features

Character vector of gene names.

imgalpha

Numeric. Tissue image transparency. Default 1.

alpha

Numeric. Spot transparency. Default 1.

group.by

Character (or vector). Metadata column(s) for cluster coloring. Default "seurat_clusters". When a vector is supplied, the function recurses and produces one PDF set per variable.

images_to_plot

Character vector or NULL. Images to include.

remove_outliers

Logical. Default FALSE.

outlier_prob

Numeric. Default 0.01.

size_override

Scalar or named numeric list. A plain number applies to all images; a named list applies per image.

calcptsizesc

Numeric. Scaling constant for automatic point-size calculation; larger values yield larger spots. Radius-aware, so the same value works across Visium and Visium HD. Default 100.

colors

Named character vector. Colors for group.by levels. NULL auto-resolves from PrepObject or Nour_pal.

gene_colors

Character vector. Gradient for gene expression.

legend.side

Character. Where to place the paired legends: "right" (default, stacked vertically) or "bottom" (side by side).

legend.direction

Character. Internal layout of the categorical cluster legend: "vertical" (default) or "horizontal".

output_dir

Character or NULL. Output directory for PDFs. When NULL the plot is printed to the active device and returned invisibly. Walk-up from PrepObject applies when omitted entirely.

object_name

Character. Label for PDF filenames. Default "".

subset_name

Character. Optional second label appended to PDF filenames after object_name. Default "".

file_name

Character or NULL. Base name (no extension) for the saved PDF. NULL (default) auto-deduces from object_name, subset_name, the gene, and group.by.

width, height

Numeric or NULL. Override the auto-calculated PDF dimensions in inches. NULL (default) auto-sizes to fit the row grid and legend.

timestamp

Logical. When TRUE, append a _YYYYMMDD-HHMMSS stamp to the saved file name so repeated runs are versioned instead of overwriting the previous PDF. Default FALSE.

cluster_col

Deprecated alias for group.by.

cluster_colors

Deprecated alias for colors.

Value

Invisibly returns the last assembled plot when output_dir = NULL; otherwise writes PDFs and returns NULL invisibly.

Details

Accepts a vector for group.by: one PDF set is produced per variable.

Functions

  • GenerateMasterGeneMaps(): Long-form alias.