Skip to contents

This is for plotting annotated SM data from a SpaMTP Seurat Object that does not contain an image(i.e. H&E image). This function inputs the metabolite name such as 'Glutamine' rather then a specific m/z value. For m/z values please use ImageMZPlot().This function inherits off Seurat::ImageFeaturePlot().

Usage

ImageMZAnnotationPlot(
  object,
  metabolites,
  plusminus = NULL,
  fov = NULL,
  boundaries = NULL,
  cols = if (isTRUE(x = blend)) {
     c("lightgrey", "#ff0000", "#00ff00")
 } else {
   
     c("lightgrey", "firebrick1")
 },
  size = 0.5,
  min.cutoff = NA,
  max.cutoff = NA,
  split.by = NULL,
  molecules = NULL,
  mols.size = 0.1,
  mols.cols = NULL,
  nmols = 1000,
  alpha = 1,
  border.color = "white",
  border.size = NULL,
  dark.background = TRUE,
  blend = FALSE,
  blend.threshold = 0.5,
  crop = FALSE,
  cells = NULL,
  scale = c("feature", "all", "none"),
  overlap = FALSE,
  axes = FALSE,
  combine = TRUE,
  coord.fixed = TRUE,
  assay = "Spatial",
  slot = "data",
  column.name = "all_IsomerNames",
  plot.exact = TRUE,
  plot.pixel = FALSE,
  verbose = TRUE
)

Arguments

object

Seurat Spatial Metabolomic Object to Visualise.

metabolites

Vector of metabolite names to plot (e.g. c("Glucose", "Glutamine")). The Seurat Object provided must contain annotations in the respective assay metadata.

plusminus

Numeric value defining the range/threshold either side of the target peak/peaks to be binned together for plotting (default = NULL).

fov

Character string of name of FOV to plot (default = NULL).

boundaries

A vector of segmentation boundaries per image to plot (default = NULL).

cols

Vector of character strings defining colours used for plotting (default = c("lightgrey", "firebrick1")).

size

Numeric value defining the point size for cells/spots when plotting (default = 0.5).

min.cutoff

Vector of numeric value describing the minimum cutoff values for each m/z feature (default = NA).

max.cutoff

Vector of numeric value describing the maximum cutoff values for each m/z feature (default = NA).

split.by

Character string defining a factor in the Seurat Object metadata to split the feature plot by (default = NULL).

molecules

Vector of character strings describing molecules to plot (default = NULL).

mols.size

Numeric value for the point size of molecules to plot (default = 0.1).

mols.cols

A vector of colours for the molecules to plot (default = NULL).

nmols

Integer of the max number of each molecule specified in 'molecules' to be plot (default = 1000).

alpha

Numeric value between 0 and 1 defining the spot alpha (default = 1).

border.color

Character string specifying the colour of each spot/cell border (default = white).

border.size

Numeric value for the thickness of the cell segmentation border (default = NULL).

dark.background

Boolean value indicating if the plot background is coloured black (default = FALSE).

blend

Boolean value indicating whether to scale and blend expression values to visualize coexpression of two features (default = FALSE).

blend.threshold

Numeric value defining the color cutoff from weak signal to strong signal; ranges from 0 to 1 (default = 0.5).

crop

Boolean value of whether to crop the plots to area with cells only (default = FALSE).

cells

Vector of character strings defining a group of cells to plot (default = NUll; plots all cells).

scale

Set color scaling across multiple plots; c("features", "all", "none").

overlap

Overlay boundaries from a single image to create a single plot (default = FALSE).

axes

Boolean defining if to keep axes and panel background (default = FALSE).

combine

Boolean value stating if to combine plots into a single patchworked ggplot object (default = TRUE).

coord.fixed

Boolean value of it to plot cartesian coordinates with fixed aspect ratio (default = TURE).

assay

Character string indicating which Seurat object assay to pull data form (default = "Spatial").

slot

Character string indicating the assay slot to use to pull expression values form (default = "counts").

column.name

Character string defining the column name where the annotations are stored in the slot meta.data (default = "all_IsomerNames").

plot.exact

Boolean value describing if to only plot exact matches to the metabolite search terms, else will plot all metabolites which contain serach word in name (default = TRUE).

plot.pixel

Boolean indicating if the plot should display pixel square shapes, if false will plot with spots (deafult = FALSE).

verbose

Boolean indicating whether to show the message. If TRUE the message will be show, else the message will be suppressed (default = TRUE).

Value

A ggplot showing the Spatial representation of expression data of specified metabolites.

Examples

# ImageMZPlot(SeuratObj, mzs = c("Glucose", "Glutamine"))
# ImageMZPlot(SeuratObj, mzs = c("Glucose", "Glutamine"), plusminus = 0.05)