
Plots the spatial expression profile of a feature set corresponding to specified pathways
Source:R/PathwayVisualisation.R
PlotPathwaysSpatially.RdThis function has been adapted from fgsea package. For more detail about function inputs please visit their documentation.
Usage
PlotPathwaysSpatially(
pathways,
object,
images,
title = NULL,
image.alpha = 1,
assay = SeuratObject::DefaultAssay(object),
slot = "scale.data",
colors = c("darkblue", "lightgrey", "darkred"),
guide = "colourbar",
crop = TRUE,
min.cutoff = NA,
max.cutoff = NA,
ncol = NULL,
pt.size.factor = 1.6,
alpha = c(1, 1),
image.scale = "lowres",
shape = 21,
stroke = NA,
interactive = FALSE,
information = NULL,
image.labels = NULL,
database = NULL,
database_version = "latest",
database_source = c("auto", "bundled", "local"),
database_local_dir = NULL
)Arguments
- pathways
Character vector of pathway names to plot. These pathways must be those stored in the
chempathwayobject. To check callunique(chempathway$pathwayName).- object
SpaMTP Seurat object containing the spatial data and coordinates for plotting.
- images
Character vector specifying which images to use for plotting from the SpaMTP Seurat Object.
- title
Optional title for the plot. If set to
NULLthe title will be the pathway name (default = NULL).- image.alpha
Numeric value between 0 and 1 controlling the transparency of the underlying image (default = 1).
- assay
Character string defining the name of assay to use for data extraction. This
assayshould contain RAMP_IDs as feature names (default =SeuratObject::DefaultAssay(object)).- slot
Character string defining the name of slot to extract data from (default = "scale.data").
- colors
Vector of colors for the gradient (default = c("darkblue", "lightgrey", "darkred")).
- guide
Character string stating the type of legend to display (default = "colourbar").
- crop
Boolean logical indicating whether to crop images (default = TRUE).
- min.cutoff
Numeric value defining the minimum cutoff value for color scale. If
NAthis value will be determined based on the minimum value of the dataset (default = NA).- max.cutoff
Numeric value defining the maximum cutoff value for color scale. If
NAthis value will be determined based on the maximum value of the dataset (default = NA).- ncol
Numeric value defining Number of columns for arranging plots. Note this is useful if multiple images have been supplied/containing within the one SpaMTP Seurat Object (default = NULL).
- pt.size.factor
Numeric value defining the spot point size for plotting (default = 1.6).
- alpha
Numeric vector controlling the transparency of points (default = c(1,1).
- image.scale
Character string defining the image resolution to use. This can be either "hires" or "lowres" (default = "lowres").
- shape
Integer value defining the shape of points. If shape = 21, circles will be plotted (default = 21).
- stroke
Numeric value stating the stroke width for points (default = NA).
- interactive
Boolean logical indicating whether to create interactive plots. NOTE: this functionality is implemented through
Seurat::SpatialFeaturePlot(default = FALSE).- information
An optional data.frame or matrix of extra information to be displayed on hover. NOTE: this functionality is implemented through
Seurat::SpatialFeaturePlot(default = NULL).- image.labels
Character vector specifying optional labels for multiple images (default = NULL).
- database
Optional named list of database resources, normally created by
LoadSpaMTPDatabase().- database_version
Database snapshot version used for pathway lookup.
- database_source
Database source; see
LoadSpaMTPDatabase().- database_local_dir
Optional local RDS resource directory.
Details
Pathways without matching features in the selected assay slot, or without finite z-scores, produce a warning and a labelled placeholder panel. Their positions in the returned list are preserved. Unknown pathway names produce an error.
Examples
utils::str(formals(PlotPathwaysSpatially))
#> Dotted pair list of 25
#> $ pathways : symbol
#> $ object : symbol
#> $ images : symbol
#> $ title : NULL
#> $ image.alpha : num 1
#> $ assay : language SeuratObject::DefaultAssay(object)
#> $ slot : chr "scale.data"
#> $ colors : language c("darkblue", "lightgrey", "darkred")
#> $ guide : chr "colourbar"
#> $ crop : logi TRUE
#> $ min.cutoff : logi NA
#> $ max.cutoff : logi NA
#> $ ncol : NULL
#> $ pt.size.factor : num 1.6
#> $ alpha : language c(1, 1)
#> $ image.scale : chr "lowres"
#> $ shape : num 21
#> $ stroke : logi NA
#> $ interactive : logi FALSE
#> $ information : NULL
#> $ image.labels : NULL
#> $ database : NULL
#> $ database_version : chr "latest"
#> $ database_source : language c("auto", "bundled", "local")
#> $ database_local_dir: NULL
#PlotPathwaysSpatially(c("Glycolysis", "Acylcarnitine 3-Butenylcarnitine", "ABC transporters"), spamtp_obj)