Spatial-Analyser is a high-performance, interactive web application built for the rapid analysis and visualization of single-cell and spatial transcriptomics data.
By bridging the gap between the scverse (Scanpy/Squidpy) backend and the Vitessce high-fidelity visualization framework, this tool allows researchers to move seamlessly from raw .h5ad files to interactive "brushing and linking" discovery—all within a local, offline-capable Streamlit environment.
- Interactive Brushing & Linking: Seamlessly select clusters in UMAP/Latent space and instantly see their physical distribution in Tissue space.
- Integrated scverse Pipeline: Run standard preprocessing (Normalization, Log1p, PCA, Neighbors, UMAP, and Leiden clustering) directly through the UI.
- Spatial Autocorrelation: Calculate and visualize spatial variable genes using Squidpy (Moran's I).
- Advanced WebGL Rendering: Support for large datasets (100k+ cells) using Vitessce's GPU-accelerated viewer.
- Local & Offline: Designed to run on your local machine using your system's resources, ensuring data privacy and offline accessibility.
- Language: Python 3.11 (Recommended)
- Analysis:
scanpy,squidpy,anndata - Frontend:
streamlit - Visualization:
vitessce,plotly - Environment:
mamba/miniforge
Due to the complex C-dependencies in bioinformatics libraries and recent breaking changes in pandas 3.0 and zarr 3.0, please follow these steps precisely to ensure a stable build.
We recommend using Miniforge (which includes mamba) for faster and more reliable dependency resolution.
# Create a dedicated Python 3.11 environment
mamba create -n spatial_sc python=3.11 -y
mamba activate spatial_scWe install the heavy-lifting libraries via mamba to ensure pre-compiled binary compatibility.
mamba install "zarr<3.0.0" "pandas<3.0.0" "squidpy<1.8.0" "python-igraph" "leidenalg" scanpy anndata plotly -c conda-forge -y
pip install streamlit vitessce
- Clone the Repository:
git clone https://github.com/Anjaney10/spatial_analyser.git
cd spatial_analyser- Launch the App:
streamlit run app.py- Analyze Your Data:
- Upload: Drag and drop your
.h5adfile into the sidebar. - Process: Click "Run Pipeline" to compute embeddings and clusters.
- Explore: Toggle between Plotly and Vitessce viewers to interrogate your tissue samples.
- Upload: Drag and drop your
Do not use Python 3.12. Several core dependencies (like numba and vitessce) currently rely on modules (e.g., distutils, pkgutil.ImpImporter) that were removed in 3.12. Stick to 3.11.
The app uses a "manual export" bridge to handle Vitessce visualizations. If you see Zarr-related import errors, ensure you have forced the Zarr 2.x downgrade:
mamba install "zarr<3.0.0"
Single-cell data is RAM-intensive. The app uses @st.cache_resource to keep data in memory. If the app crashes on a laptop with <16GB RAM when using large datasets, try subsetting your data before uploading.
- WebAssembly Deployment: Porting the logic to
stlitefor zero-install browser execution. - Multi-modal Support: Adding support for H&E image overlays in the spatial view.
- Differential Expression: Integrated UI for volcano plots and marker gene identification.
Distributed under the MIT License. See LICENSE for more information.
Note: This tool is a Proof of Concept (PoC) intended for research purposes. It is designed to demonstrate the power of interactive spatial transcriptomics and is not a substitute for a full production bioinformatics platform.