Spatial transcriptomics
Analyze Visium-class spatial datasets — cluster tissue domains, identify spatially variable genes, and explore gene expression in tissue coordinate space.
Research question
What spatial domains exist in this tissue section, which genes vary across space, and where are genes of interest expressed relative to tissue architecture?
Who this is for
- Spatial biology labs working with Visium or similar spot-based platforms
- Tumor microenvironment researchers mapping expression to tissue regions
- Neuroscience groups analyzing spatially resolved brain sections
Data requirements
| Data | Required | Purpose |
|---|---|---|
.h5ad with spatial coordinates | Yes | Spots in obsm['spatial'] |
| Gene expression per spot | Yes | Domain clustering and overlays |
| H&E image pyramid | No | Planned — not yet wired into UI |
Local development fixture: data/test_visium_brain.h5ad (~1155 spots).
Workflow
Upload spatial .h5ad → Spatial domains → Explore spot viewer → DE by domain → Enrichment
Step 1 — Upload spatial dataset
Create a study with Spatial modality (or upload a spatial .h5ad into an existing study). Confirm coordinates exist in obsm['spatial'] and barcodes align with obs.
Step 2 — Spatial domain clustering
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 in the engine
Domain labels appear in obs after the run completes.
Step 3 — Explore spatial viewer
Open Explore → Spatial to render spots in coordinate space:
- Color by domain or cluster assignment
- Select genes for expression overlay
- Pan and zoom across the tissue section
H&E histology image pyramids and spot deconvolution are planned extensions.
Step 4 — Differential expression and enrichment
Run standard DE and enrichment steps using domain labels or saved contrasts as grouping variables. Compare domains of interest or condition labels when present in metadata.
Step 5 — Figures and snapshots
Add spatial domain plots and gene overlay panels to the figure canvas. Create a snapshot on the Runs page to preserve the spatial analysis parameter set.
Expected outputs
- Spatial domain assignments per spot
- Spatially variable gene rankings
- Interactive spot viewer with domain and gene coloring
- DE and enrichment results stratified by domain
- Exportable spatial plots for publications
Integration with other areas
- Pathology provides whole-slide imaging and tissue segmentation for morphology-guided spatial context
- Oncology adds TME-specific interpretation and clinical endpoint integration on top of spatial compbio pipelines
Compbio owns spatial omics ingestion and analysis; adjacent areas add domain-specific overlays without duplicating the spatial engine.
Smoke test
conda run -n biochem python scripts/smoke_test_spatial.py
Generates the Visium fixture if missing, runs spatial analysis, validates result APIs, and creates a snapshot.