multiGenePlots: Plot Spatial Patterns of Multiple Genes

multiGenePlotsR Documentation

Plot Spatial Patterns of Multiple Genes

Description

Plot Spatial Patterns of Multiple Genes

Usage

multiGenePlots(x, ...)

## S4 method for signature 'matrix'
multiGenePlots(
  x,
  coordinates,
  genes_plot,
  viridis_option = "D",
  ncol = 2,
  point_size = 1,
  dark_theme = TRUE
)

## S4 method for signature 'SpatialExperiment'
multiGenePlots(
  x,
  assay_type = "counts",
  genes_plot,
  viridis_option = "D",
  ncol = 2,
  point_size = 1,
  dark_theme = TRUE
)

Arguments

x

A numeric matrix of stabilized counts (e.g. resulting from stabilize()) where genes are rows and cells are columns.

Alternatively, a SpatialExperiment object.

...

For the generic, arguments to pass to specific methods.

coordinates

A data.frame with sample coordinates. Each row is a sample, the columns with coordinates should be named 'x' and 'y'.

For the SpatialExperiment method, coordinates are taken from spatialCoords(x).

genes_plot

character vector specifying which genes are to be plotted.

viridis_option

This function uses the viridis palette to color cells for gene expression. Four options are available: "magma" (or "A"), "inferno" (or "B"), "plasma" (or "C"), "viridis" (or "D", the default option) and "cividis" (or "E").

ncol

Number of columns to arrange the plots.

point_size

Point size of each plot.

dark_theme

Whether dark background should be used; this is helpful to highlight cells with high expression when using the viridis palette.

assay_type

A character string specifying the assay from x to use as input. Defaults to "counts".

Value

This function draws a plot for each specified genes

Author(s)

Davide Corso, Milan Malfait, Lambda Moses

References

Svensson, V., Teichmann, S. & Stegle, O. SpatialDE: identification of spatially variable genes. Nat Methods 15, 343–346 (2018). https://doi.org/10.1038/nmeth.4636

SpatialDE 1.1.3: the version of the Python package used under the hood.

See Also

The individual steps performed by this function: stabilize(), spatialDE().

For further analysis of the DE results: model_search() and spatial_patterns().

Examples

## Mock up a SpatialExperiment object wit 400 cells and 3 genes
set.seed(42)
spe <- mockSVG(size = 20, tot_genes = 3, de_genes = 1, return_SPE = TRUE)

## Run spatialDE
results <- spatialDE(spe)

ordered_spe_results <- results[order(results$qval), ]
head(ordered_spe_results)

plots <- multiGenePlots(spe,
    assay_type = "counts",
    ordered_spe_results$g,
    point_size = 4,
    viridis_option = "D"
)


sales-lab/spatialDE documentation built on Feb. 12, 2024, 2:47 p.m.