Generates a scatterplot to visualize the relationship between gene expression and the distance of data points to a spatial reference. Set line_alpha > 0 to visualize the inferred expression pattern used for spatial gradient screening.

plotExprVsDistSA(
  object,
  variables,
  ids = idSA(object),
  distance = "dte",
  resolution = recSgsRes(object),
  core = FALSE,
  pt_alpha = 0.1,
  pt_color = "black",
  pt_clrp = NULL,
  pt_size = 1.5,
  line_alpha = 0,
  line_color = "forestgreen",
  line_size = 1.75,
  border_linealpha = 1,
  border_linecolor = "black",
  border_linesize = 1,
  border_linetype = "solid",
  ee_linealpha = 0,
  ee_linecolor = "black",
  ee_lineend = "point",
  ee_linesize = 1,
  ee_linetype = "solid",
  se_fill = ggplot2::alpha("lightgrey", 0.5),
  unit = getDefaultUnit(object),
  ggpLayers = NULL,
  ncol = NULL,
  nrow = NULL,
  ...
)

plotExprVsDistST(
  object,
  variables,
  id = idST(object),
  resolution = recSgsRes(object),
  width = NULL,
  pt_alpha = 0.5,
  pt_color = "black",
  pt_clrp = NULL,
  pt_size = 1.5,
  line_alpha = 0.9,
  line_color = "forestgreen",
  line_size = 1,
  unit = getDefaultUnit(object),
  ggpLayers = NULL,
  ncol = NULL,
  nrow = NULL,
  ...
)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

variables

Character vector. All numeric variables hat are supposed to be plotted.

ids

Character vector. Specifies the IDs of the spatial annotations of interest.

distance

A numeric vector of distances to the annotation's edge.

resolution

Distance measure. The resolution with which the expression gradient is inferred. Defaults are platform specific. See more in detail section of recSgsRes().

pt_alpha

Numeric value. Specifies the degree of transparency of all points.

pt_clrp

The color palette to be used if the specified variable displayed by color is categorical/discrete. Run validColorPalettes() to see valid input.

pt_size

Numeric value. Specifies the size of all points.

line_alpha

Numeric. Affects alpha of main lines of the plot.

line_color

Character. Affects color of the main lines of the plot.

line_size

Numeric. Affects size of the main lines of the plot.

se_fill

The fill color for the smoothing line's standard error area (default: "lightgrey").

unit

Character value. Specifies the desired unit in which distance measures or area measures are provided. Run validUnitsOfLength() or validUnitsOfArea() for valid input options.

ggpLayers

List of ggproto-objects that are added to each plot. Skim ggpLayer*()-functions for more options.

nrow, ncol

Numeric values or NULL. Used to arrange multiple plots.

...

Used to absorb deprecated arguments or functions.

id

Character value. The ID of the spatial trajectory.

Value

A ggplot.

Examples


library(SPATA2)
library(tidyverse)

data("example_data")

object <- example_data$object_UKF275T_diet

object <- normalizeCounts(object, activate = TRUE)

object <-
 createNumericAnnotations(
   object = object,
   variable = "HM_HYPOXIA",
   threshold = "kmeans_high",
   id = "hypoxia_ann",
   inner_borders = FALSE,
   force1 = TRUE
   )

 plotExprVsDistSA(object, variables = c("HM_HYPOXIA", "METRN"), ids = "hypoxia_ann", core = T)