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.
Overview
BANKSY is a spatial omics algorithm that incorporates neighborhood information for clustering spatial transcriptomics data. By augmenting each cell’s expression profile with a summary of its spatial neighborhood, BANKSY can:- Improve cell-type assignment in noisy data
- Distinguish subtly different cell types stratified by microenvironment
- Identify spatial domains sharing the same microenvironment
RunBanksy() function in SeuratWrappers brings BANKSY directly into the Seurat workflow.
Citation: Vipul Singhal, Nigel Chou, Joseph Lee, Yifei Yue, Jinyue Liu, Wan Kee Chock, Li Lin, Yun-Ching Chang, Erica Mei Ling Teo, Jonathan Aow, Hwee Kuan Lee, Kok Hao Chen & Shyam Prabhakar. BANKSY unifies cell typing and tissue domain segmentation for scalable spatial omics data analysis. Nature Genetics, 2024. doi: 10.1038/s41588-024-01664-3
Installation
Install the Banksy package from GitHub before usingRunBanksy():
The lambda parameter
The amount of neighborhood information incorporated is controlled by lambda in [0, 1]:
- Low lambda (e.g., 0.2) — BANKSY operates in cell-typing mode, emphasizing intrinsic gene expression
- High lambda (e.g., 0.8) — BANKSY finds spatial domains, emphasizing microenvironment similarity
Parameters
A Seurat object with gene expression data. If spatial coordinates are stored natively (e.g., from
Load10X_Spatial()), they are extracted automatically. Otherwise, provide coordinates via dimx/dimy.Spatial weight parameter between 0 and 1. Controls the balance between own expression and neighborhood context. Low values favor cell-type clustering; high values favor spatial domain segmentation.
Assay in the Seurat object to use as input.
Slot within the assay to pull expression data from (e.g.,
'data', 'counts').Whether to use the Azimuthal Gene Function (AGF), a higher-order neighborhood summary.
Column name of the x spatial coordinate in the object metadata. Required when spatial coordinates are not stored natively in the Seurat object.
Column name of the y spatial coordinate in the object metadata.
Column name of the z spatial coordinate in the object metadata (for 3D data).
Number of spatial dimensions to extract when using Seurat’s native spatial framework.
Features to include in the BANKSY matrix. Options:
'variable' (uses VariableFeatures()), 'all' (all features), or a character vector of specific feature names.Column name of a grouping variable in metadata (e.g.,
'orig.ident'). Required for multi-sample analysis. Tells BANKSY to stagger spatial coordinates by group so that cells from different samples do not overlap during neighborhood computation.Whether to perform within-group scaling. Useful when analyzing multiple samples with minor technical differences.
Number of nearest neighbors to use when computing the spatial neighborhood.
Kernel for 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
Exponent of radius for the
kNN_rn spatial mode.Standard deviation of the Gaussian kernel for
rNN_gauss spatial mode.Determines the radius used in
rNN_gauss spatial mode.Number of neighbors to use in radial nearest-neighbor (
rNN) modes.Name for the new BANKSY assay added to the Seurat object.
Advanced usage. Highest azimuthal harmonic to compute.
Workflow: Seurat spatial framework
Use this approach when your Seurat object already contains spatial coordinates (e.g., loaded viaLoad10X_Spatial() or from SeuratData).
Run BANKSY
BANKSY and populates scale.data with the scaled BANKSY matrix.Do not call
ScaleData() on the BANKSY assay after RunBanksy(). RunBanksy() already populates scale.data with the lambda-weighted scaled matrix. Calling ScaleData() again negates the effect of lambda.Workflow: Explicit spatial coordinates
Use this approach when spatial coordinates are stored as metadata columns rather than in a native Seurat spatial slot.Multi-sample analysis
When analyzing multiple spatial datasets jointly (without strong batch effects), provide thegroup argument to prevent cells from different samples from being treated as spatial neighbors.
group causes RunBanksy() to stagger the spatial coordinates by sample before computing neighborhoods. The staggered coordinates are stored in the metadata as staggered_sdimx and staggered_sdimy for inspection.