Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/satijalab/seurat-wrappers/llms.txt

Use this file to discover all available pages before exploring further.

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

RunBanksy(
  object,
  lambda,
  assay = "RNA",
  slot = "data",
  use_agf = FALSE,
  dimx = NULL,
  dimy = NULL,
  dimz = NULL,
  ndim = 2,
  features = "variable",
  group = NULL,
  split.scale = TRUE,
  k_geom = 15,
  n = 2,
  sigma = 1.5,
  alpha = 0.05,
  k_spatial = 10,
  spatial_mode = "kNN_median",
  assay_name = "BANKSY",
  M = NULL,
  verbose = TRUE
)

Parameters

object
Seurat
required
A Seurat object with spatial coordinate metadata.
lambda
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.
assay
character
default:"RNA"
Assay in the Seurat object to use.
slot
character
default:"data"
Slot within the assay to use.
use_agf
logical
default:"FALSE"
Whether to use the Azimuthal Gabor Filter (AGF) for higher-order neighborhood features.
dimx
character
default:"NULL"
Column name in cell metadata containing the spatial x-coordinate.
dimy
character
default:"NULL"
Column name in cell metadata containing the spatial y-coordinate.
dimz
character
default:"NULL"
Column name in cell metadata containing the spatial z-coordinate (3D data only).
ndim
integer
default:"2"
Number of spatial dimensions to use (2 or 3).
features
character
default:"variable"
Features to compute. One of "all", "variable", or a character vector of feature names.
group
character
default:"NULL"
Column name of a grouping variable in metadata. Used to compute neighbors within groups.
split.scale
logical
default:"TRUE"
Whether to scale expression separately by group.
k_geom
numeric
default:"15"
Number of neighbors for the kNN spatial graph (used with kNN-based spatial_mode).
n
numeric
default:"2"
Exponent of radius for kNN_rn spatial mode.
sigma
numeric
default:"1.5"
Standard deviation of the Gaussian kernel for rNN_gauss mode.
alpha
numeric
default:"0.05"
Determines the radius used in rNN_gauss mode.
k_spatial
numeric
default:"10"
Number of neighbors for radial nearest neighbor modes.
spatial_mode
character
default:"kNN_median"
Kernel for spatial neighborhood computation. Options:
  • kNN_median — k-nearest neighbors with median-scaled Gaussian kernel
  • kNN_r — k-nearest neighbors with 1/r kernel
  • kNN_rn — k-nearest neighbors with 1/r^n kernel
  • kNN_rank — k-nearest neighbors with rank Gaussian kernel
  • kNN_unif — k-nearest neighbors with uniform kernel
  • rNN_gauss — radial nearest neighbors with Gaussian kernel
assay_name
character
default:"BANKSY"
Name for the new BANKSY assay stored in the Seurat object.
M
numeric
default:"NULL"
Highest azimuthal harmonic for AGF computation. Advanced usage.
verbose
logical
default:"TRUE"
Print progress messages.

Returns

A Seurat object with a new assay (default name BANKSY) containing the BANKSY-augmented expression matrix. Downstream analysis (PCA, UMAP, clustering) should be run on this assay.

Examples

library(SeuratWrappers)

# Run BANKSY with spatial coordinates in metadata
object <- RunBanksy(
  object = seurat_obj,
  lambda = 0.2,
  assay = "RNA",
  slot = "data",
  dimx = "x",
  dimy = "y",
  features = "variable",
  spatial_mode = "kNN_median",
  k_geom = 15
)

# Downstream clustering on BANKSY assay
DefaultAssay(object) <- "BANKSY"
object <- ScaleData(object)
object <- RunPCA(object)
object <- FindNeighbors(object)
object <- FindClusters(object, resolution = 0.5)

See Also

Build docs developers (and LLMs) love