runSDEA: Run spatial differential expression analysis

runSDEAR Documentation

Run spatial differential expression analysis

Description

This function conducts differential expression analysis (DEA) where data points are grouped based on their distance to a SpatialAnnotation.

Usage

runSDEA(
  object,
  interval,
  id = idSA(object),
  naming = "sdea_{id}",
  method_de = "wilcox",
  base = 2,
  overwrite = FALSE,
  ...
)

Arguments

object

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

interval

Distance measure. The width of the spatial intervals in which the data points are grouped starting from the boundary of the spatial annotation till the edge of the tissue is reached.

id

Character value specifying the ID of the spatial annotation of interest. If there is only one spatial annotation in the object, the function will default to using it. However, if there are multiple annotations, this argument must be explicitly specified to identify the target annotation.

naming

A glue::glue() instruction on how to create the name of the grouping variable.Providing a simple string without glue syntax works, too.

method_de

Character value. Denotes the method to according to which the de-analysis is performed. Given to argument test.use of the Seurat::FindAllMarkers()-function. Run SPATA::dea_methods to obtain all valid input options.

overwrite

Logical value. Must be TRUE to allow overwriting.

...

Used to absorb deprecated arguments or functions.

Details

This function bases on the concept of runDEA() where gene expression is compared across different groups within a grouping variable. However, in contrast to runDEA() where the grouping variable is denoted via across, the function runSDEA() creates a grouping variable in which data points are grouped based on their distance to a SpatialAnnotation. This approach aims to identify genes that are upregulated within certain distance intervals to the spatial annotation of interest. The spatial interval is defined via the argument interval. E.g. if ⁠interval = 500um⁠ data points are grouped in 500um intervals starting from the boundaries of the spatial annotation until the edge of the tissue is reached. The names of the groups correspond to the distance itself: 500um, 1000um, 1500um, etc. If ⁠interval = 0.5mm⁠, which is equivalent to 500um, the grouping will be the same but the group names correspond to 0.5mm, 1mm, 1.5mm, etc. Data points that lie within the boundaries of the spatial annotation are assigned to group core.

The grouping variable created this way is stored in the feature data.frame as any other grouping variable and the DEA results are stored in slot @dea as all other DEA results.

Value

The updated input object, containing the added, removed or computed results.

Distance measures

The vignette on distance measures in SPATA2 has been replaced. Click here to read it.

See Also

createGroupAnnotations(), createImageAnnotations(), createNumericAnnotations() to create spatial annotations.

The function getCoordsDfSA() relates data points to a spatial annotation. This information is used by runSDEA() to create the spatial grouping.

plotDeaDotplot() to visualize results.


theMILOlab/SPATA2 documentation built on Feb. 8, 2025, 11:41 p.m.