A user-friendly command-line application for spatial transcriptomics powered by SpatialData and Snakemake.
spatialsnake is a command-line application for automated spatial transcriptomics analysis. Implemented in Python on top of the scverse ecosystem, it uses SpatialData to convert datasets from multiple spatial transcriptomics platforms into a unified zarr-based object format. This design supports a consistent workflow spanning data ingestion, preprocessing, clustering, annotation, and downstream analysis through a command-line interface with workflow-based parameter control.
Project at a Glance
| Item | Summary |
|---|---|
| Official Documentation | spatialsnake Documentation |
| Tutorial Article | Core Analysis Tutorial |
| Workflow Modes | single_analysis, compare_analysis |
| Utility Entry Points | useful_tool, produce-file, install-packages |
| Main Analysis Options | integrate, preprocess, clustering, reclustering, annotation_help, annotation, advance_analysis, compare_stage |
| Supported Input Types | visium, visium_segment, visium_HD, xenium, Merfish, stereoseq |
Core Functions
- Standardize raw spatial transcriptomics data into a unified object during
Ingesting. - Run
preprocessfor quality control, filtering, normalization, and dimensionality reduction preparation. - Perform
clusteringand visualization, followed byannotation_helpandannotation. - Carry out
reclusteringandreannotationfor clusters of interest. - Execute
advance_analysisfor downstream analyses andcompare_stagefor cross-sample comparison. - Use auxiliary utilities for
splitting,merge, andtransform.
Available Platforms
Sequencing-based
visium: 10x Genomics spatial transcriptomics datavisium_HD: high-resolution 10x Genomics spatial transcriptomics datavisium_segment: cell segmentation outputs from 10x Genomics Space Rangerstereoseq: BGI Stereo-seq spatial transcriptomics data, including different bin sizes,cellbin, and adjustedcellbindata types
Imaging-based
xenium: image-based 10x Genomics Xenium spatial transcriptomics dataMerfish: Vizgen MERFISH spatial transcriptomics data
Basic Installation
The commands below describe version 0.0.6. PyPI installation requires that release to be published; the Bioconda option requires its corresponding channel update. Until then, use the available PyPI release or the source option. All routes require Linux and a fresh Conda environment.
Option 1. PyPI (recommended)
conda create -n spatialsnake_env --override-channels -c conda-forge -c bioconda \
python=3.12.11 snakemake-minimal=9.8.1 r-base=4.4.0 -y
conda activate spatialsnake_env
conda install --override-channels -c conda-forge -c bioconda \
r-optparse r-tidyverse r-future r-jsonlite r-rcolorbrewer r-patchwork \
r-cowplot r-pheatmap r-seurat r-remotes r-biocmanager r-presto r-nmf \
r-circlize r-ggpubr -y
conda install --override-channels -c conda-forge -c bioconda \
bioconductor-annotationdbi bioconductor-complexheatmap \
bioconductor-clusterprofiler bioconductor-edger \
bioconductor-org.hs.eg.db bioconductor-org.mm.eg.db \
bioconductor-rhdf5 bioconductor-biocneighbors -y
python -m pip install spatialsnake
spatialsnake --version
# Choose one PyTorch build (do not run both commands)
python -m pip install --index-url https://download.pytorch.org/whl/cu128 "torch==2.8.0" # NVIDIA GPU
# python -m pip install --index-url https://download.pytorch.org/whl/cpu "torch==2.8.0" # CPU-only
python -m pip install "spatialsnake[extended]"
spatialsnake install-packages
python -m pip check
Option 2. Bioconda
conda create -n spatialsnake_env --override-channels -c conda-forge -c bioconda \
spatialsnake=0.0.6 python=3.12.11 r-base=4.4.3 snakemake-minimal=9.8.1 -y
conda activate spatialsnake_env
spatialsnake install-packages
Optional advanced analyses:
# Automatically choose cu128 when an NVIDIA GPU is available, otherwise CPU
spatialsnake install-packages --extended --torch-backend=auto
# Or force one build instead:
# spatialsnake install-packages --extended --torch-backend=cpu
# spatialsnake install-packages --extended --torch-backend=cu128
See package details and release files on Bioconda.
Option 3. Source
conda create -n spatialsnake_env --override-channels -c conda-forge -c bioconda \
python=3.12.11 r-base=4.4.3 snakemake-minimal=9.8.1 -y
conda activate spatialsnake_env
Install both Conda/R dependency commands from Option 1 in this environment, then continue:
git clone https://github.com/l-zh007/spatialsnake.git
cd spatialsnake
python -m pip install .
spatialsnake --version
Optional advanced analyses:
python -m pip install --index-url https://download.pytorch.org/whl/cu128 "torch==2.8.0"
python -m pip install ".[extended]"
spatialsnake install-packages
For PyPI, the Conda/R layer plus pip install spatialsnake covers integration,
preprocessing, clustering/reclustering, annotation help,
manual annotation, enrichment and common utilities. The optional extras add
the selected CPU or cu128 PyTorch build, cell2location, scvi-tools, CellCharter, Squidpy,
CellPhoneDB, LIANA, pySCENIC and napari-spatialdata; install-packages then
adds BANKSY, RCTD and CellChat support.
For Bioconda, install-packages provides the same base functional scope.
install-packages --extended includes that complete base stage and adds the
advanced Python/R modules listed above. --torch-backend=auto chooses the
smaller CPU build when no accessible NVIDIA GPU is detected. Runtime
device=auto selects CUDA when available or CPU otherwise. GitHub-hosted R
packages require an active network connection; rerun
the same installer command after an interrupted download.
Working Directory
Prepare the working directory before running the main workflow:
project_root/
├── data/
├── sample.txt
├── results/
└── <analysis_option>.yaml
mkdir -p project_root/data project_root/results
touch project_root/sample.txt
sample.txt is the required sample information table for every module in the main workflow. In the working directory, data/ stores raw input data, results/ stores analysis outputs generated by the workflow, and <analysis_option>.yaml is an optional configuration file.
Minimal Usage
The command-line interface provides the following documented entry points:
spatialsnake <command> <INPUT> <TYPE> [--option=<analysis_option>] [options]
spatialsnake useful_tool [--option=<ways>] <INPUT> [options]
spatialsnake produce-file [--option=<analysis_option>]
spatialsnake install-packages [--extended] [--torch-backend=<auto|cpu|cu128>] [--dry-run]
spatialsnake (-h | --help)
spatialsnake --version
Main workflow selection:
<command>: choosesingle_analysisorcompare_analysis<TYPE>: choose fromvisium,visium_segment,visium_HD,xenium,Merfish, andstereoseq--option=<analysis_option>: choose fromintegrate,preprocess,clustering,reclustering,annotation_help,annotation,advance_analysis, andcompare_stage
Configuration files can be generated with:
spatialsnake produce-file --option=<analysis_option>
The generated YAML template can then be applied with --configfile. Parameters provided directly on the command line take priority over parameters defined in the YAML file.
Further Reading
- Read the full official documentation.
- Start from the example-based core analysis tutorial.
- If you encounter problems or would like to suggest extensions, please open an issue on GitHub.
Reference
Köster, J., Mölder, F., Jablonski, K. P., Letcher, B., Hall, M. B., Tomkins-Tinch, C. H., Sochat, V., Forster, J., Lee, S., Twardziok, S. O., Kanitz, A., Wilm, A., Holtgrewe, M., Rahmann, S., and Nahnsen, S. Sustainable data analysis with Snakemake. F1000Research, 10:33, 2021. https://doi.org/10.12688/f1000research.29032.2
Metadata
Release files for spatialsnake 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spatialsnake-0.0.6.tar.gz | 270.9 kB | Without provenance | Details for spatialsnake-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spatialsnake-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for spatialsnake-0.0.6-py3-none-any.whl |
Total release size: 582.3 kB
Release files / spatialsnake-0.0.6.tar.gz
| Download URL | spatialsnake-0.0.6.tar.gz |
|---|---|
| Size | 270.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2245072123073cccd6e42b18a5a38bb498cc065f0cc90cba036f690fc72aa81c
|
|
BLAKE2b-256 checksum How to use checksums |
f279ec566fedca4f232d8f6a111686daaeea4df9fffb52fbe14ba30a30d44812
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / spatialsnake-0.0.6-py3-none-any.whl
| Download URL | spatialsnake-0.0.6-py3-none-any.whl |
|---|---|
| Size | 311.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
536f6e5f72eb3102e291046a47f29b11e737778e7adcf2232983c1daaba21f58
|
|
BLAKE2b-256 checksum How to use checksums |
9f5bb258aa7c32e47898bf3df13e846fb4b4b0c972dc087bac8f6d2be94489b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for spatialsnake 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.