spatial_enrichment: Determines whether the supplied genes show spatial enrichment...

View source: R/CrossExpression.R

spatial_enrichmentR Documentation

Determines whether the supplied genes show spatial enrichment in cross-expression. Spatial enrichment can be interpreted as delineating anatomical boundaries.

Description

Determines whether the supplied genes show spatial enrichment in cross-expression. Spatial enrichment can be interpreted as delineating anatomical boundaries.

Usage

spatial_enrichment(
  data,
  locations,
  gene1,
  gene2,
  neighbor = 1,
  max_pairs = 20000
)

Arguments

data

A cells by genes expression matrix.

locations

A cells by coordinates (x-y or higher dimensions) matrix.

gene1

Name of gene1.

gene2

Name of gene2.

neighbor

The n-th nearest neighbor.

max_pairs

Specify maximum number of cell pairs to consider. Lower number increases computational efficiency.

Value

Returns a p-value and distance distributions between cross-expressing cells and cross-expressing and random cells.

Examples

data("locations")
data("expression")
locations  = as.matrix(locations)
expression = as.matrix(expression)
expression = expression[,1:5]
results    = spatial_enrichment(data = expression, locations = locations,
                                gene1 = "Calb1", gene2 = "Rasgrf2", max_pairs = 100)


CrossExpression documentation built on Aug. 8, 2025, 7:25 p.m.