Get Started
GPU-accelerated spatial omics analysis framework
Overview
spatial-gpu is a GPU-accelerated spatial omics analysis framework that serves as a drop-in replacement for Squidpy, delivering 10–100x speedup on common spatial transcriptomics workflows.
The package provides a comprehensive Python reimplementation of the SpaCET cell type deconvolution algorithm and the SecAct secreted protein activity inference pipeline, plus spatial graph construction, neighborhood enrichment, co-occurrence analysis, and cell segmentation integration.
Key features:
- Two-stage hierarchical cell type deconvolution (SpaCET algorithm)
- Secreted protein activity inference via ridge regression (SecAct)
- Signaling pattern discovery, velocity visualization, and spatial CCC
- Gene set scoring (Hallmark, CancerCellState, TLS)
- Spatial autocorrelation (Moran’s I) and ligand-receptor analysis
- Multi-backend CPU/GPU switching (NumPy / CuPy / RAPIDS)
- Memory-efficient chunked processing for 100M+ cell datasets
- Readers for Visium, Xenium, CosMx, and MERSCOPE platforms
Installation
Install the latest release from PyPI:
pip install spatialgpu
For development (editable install with dev dependencies):
git clone https://github.com/psychemistz/spatial-gpu.git cd spatial-gpu pip install -e ".[dev]"
GPU acceleration requires a CUDA toolkit. Install the appropriate CuPy backend for your CUDA version:
# CUDA 12 pip install cupy-cuda12x # CUDA 11 pip install cupy-cuda11x
Quick Start
Below is a minimal example that loads 10X Visium data, runs cell type deconvolution, and visualizes the results.
import spatialgpu.deconvolution as spacet # 1. Load 10X Visium data from Space Ranger output adata = spacet.create_spacet_object_10x("path/to/spaceranger/outs") # 2. Run two-stage hierarchical deconvolution adata = spacet.deconvolution(adata, cancer_type="BRCA") # 3. Visualize cell type fractions spacet.visualize_spatial_feature( adata, spatial_type="CellFraction", spatial_features=["Malignant", "Macrophage"], ) # 4. Infer secreted protein activity adata = spacet.secact_inference(adata) # 5. Visualize signaling velocity spacet.visualize_secact_velocity(adata, gene="SPP1")
Tutorials
Explore the full set of tutorials for detailed, end-to-end workflows:
- Visium Breast Cancer — Full deconvolution + cell-cell interaction workflow
- Old ST PDAC — Deconvolution with matched scRNA-seq reference
- Hi-Res ST CRC — High-resolution spatial transcriptomics deconvolution
- Gene Set Score — Gene set scoring (Hallmark, CancerCellState, TLS)
- Spatial Correlation — Moran’s I spatial autocorrelation analysis
- Signaling Patterns — SecAct activity + signaling patterns + velocity
- Cell-Cell Communication — Single-cell resolution spatial CCC
- Bulk Benchmark — Pseudobulk deconvolution evaluation + MuSiC/CIBERSORTx export
For the full API listing, see the Reference page.