Spatial smoothing of gene expression using KNN with kernel weighting

spatial_smooth_expression(
  expression_matrix,
  coordinates,
  k = 10,
  kernel = "linear",
  sigma = NULL,
  include_self = TRUE,
  verbose = TRUE
)

Arguments

expression_matrix

Gene x Cell matrix of expression values

coordinates

Data frame with columns 'x' and 'y' for cell coordinates

k

Number of nearest neighbors (default: 10)

kernel

Kernel function: "gaussian", "uniform", or "linear" (default: "gaussian")

sigma

Bandwidth parameter for Gaussian kernel (default: auto-computed)

include_self

Whether to include the cell itself in smoothing (default: TRUE)

verbose

Show progress bar or not.

Value

Smoothed gene x cell expression matrix