RunBanksy() computes a BANKSY matrix that augments each cell’s expression with the average expression of its spatial neighbors. The resulting matrix enables clustering that captures both cell type identity and spatial tissue domains.
Syntax
Parameters
Seurat
required
A Seurat object with spatial coordinate metadata.
numeric
required
Spatial weight parameter.
0 uses only cell-intrinsic expression (equivalent to standard clustering). 1 uses only neighborhood expression. Values around 0.2 typically give good cell-type results; 0.8 is better for tissue domain segmentation.character
default:"RNA"
Assay in the Seurat object to use.
character
default:"data"
Slot within the assay to use.
logical
default:"FALSE"
Whether to use the Azimuthal Gabor Filter (AGF) for higher-order neighborhood features.
character
default:"NULL"
Column name in cell metadata containing the spatial x-coordinate.
character
default:"NULL"
Column name in cell metadata containing the spatial y-coordinate.
character
default:"NULL"
Column name in cell metadata containing the spatial z-coordinate (3D data only).
integer
default:"2"
Number of spatial dimensions to use (2 or 3).
character
default:"variable"
Features to compute. One of
"all", "variable", or a character vector of feature names.character
default:"NULL"
Column name of a grouping variable in metadata. Used to compute neighbors within groups.
logical
default:"TRUE"
Whether to scale expression separately by group.
numeric
default:"15"
Number of neighbors for the kNN spatial graph (used with kNN-based
spatial_mode).numeric
default:"2"
Exponent of radius for
kNN_rn spatial mode.numeric
default:"1.5"
Standard deviation of the Gaussian kernel for
rNN_gauss mode.numeric
default:"0.05"
Determines the radius used in
rNN_gauss mode.numeric
default:"10"
Number of neighbors for radial nearest neighbor modes.
character
default:"kNN_median"
Kernel for spatial neighborhood computation. Options:
kNN_median— k-nearest neighbors with median-scaled Gaussian kernelkNN_r— k-nearest neighbors with 1/r kernelkNN_rn— k-nearest neighbors with 1/r^n kernelkNN_rank— k-nearest neighbors with rank Gaussian kernelkNN_unif— k-nearest neighbors with uniform kernelrNN_gauss— radial nearest neighbors with Gaussian kernel
character
default:"BANKSY"
Name for the new BANKSY assay stored in the Seurat object.
numeric
default:"NULL"
Highest azimuthal harmonic for AGF computation. Advanced usage.
logical
default:"TRUE"
Print progress messages.
Returns
A Seurat object with a new assay (default nameBANKSY) containing the BANKSY-augmented expression matrix. Downstream analysis (PCA, UMAP, clustering) should be run on this assay.