Spatial
Spatial workflows operate on AnnData objects with coordinates in obsm['spatial'] — the layout used by Visium-class datasets.
Requirements
- Uploaded or converted
.h5adwith spatial coordinates - Typically one spot (or cell) per row in
obs - Gene expression matrix aligned to spot barcodes
The test fixture data/test_visium_brain.h5ad (~1155 spots) is included for local development.
Spatial domains step
Under Analyze → Find Structure → Spatial domains, the pipeline:
- Builds a spatial neighbor graph
- Clusters spots into tissue domains (Leiden on spatial + expression features)
- Identifies spatially variable genes (SVGs) in the engine
Explore spatial viewer
Explore → Spatial renders spots in coordinate space with:
- Domain or cluster coloring
- Gene expression overlay on selection
- Pan and zoom for tissue navigation
H&E histology image pyramids and spot deconvolution are not yet wired into the UI.
Enrichment and DE
Use standard DE and enrichment steps on spatial datasets when contrasts or domains define groups of interest. Domain labels appear in obs after a spatial run completes.
Smoke test
conda run -n Neuralocity python scripts/smoke_test_spatial.py
Generates the Visium fixture if missing, runs spatial analysis, validates result APIs, and creates a snapshot.
Planned extensions
- Tiled H&E image overlay
- Neighborhood and niche analysis
- Platform-specific ingest (Xenium, MERFISH, CosMX)
- Spatial deconvolution / reference mapping