Skip to contents

Smooth spot-level SE abundances across k-nearest-neighbor spots

Usage

SmoothSEAbundances(
  se_mat,
  spot_coords,
  k = 7,
  X = "X",
  Y = "Y",
  include.self = TRUE,
  min.neighbors = 3
)

Arguments

se_mat

spot x SE matrix (rownames = spot IDs), values indicating SE abundance/level in each Visium spot.

spot_coords

data.frame/matrix of spot coordinates (rownames = spot IDs, must overlap with `rownames(se_mat)`), columns given by `X`, `Y`.

k

number of nearest-neighbor spots to average over. Default 7, matching a Visium hex grid (1 self + 6 immediate neighbors) when `include.self = TRUE`.

X, Y

column names in `spot_coords` for x/y coordinates.

include.self

if TRUE (default), each spot's own value is included as one of its k neighbors (so k=7 = self + 6 hex neighbors). If FALSE, only the k nearest *other* spots are averaged.

min.neighbors

minimum number of neighbor spots required to keep a spot in the output.

Value

A data frame with the first two columns containing spatial coordinates of Visium spots, followed by columns containing SE abundances.