Approximate Bayesian inference of spatial cellular gene expression conditioned on sample covariates.
- Uses generalized linear model to denoise gene expression, disentangling effects of cell type, sample covariate, and local spatial autcorrelation
- Quantifies cohort-level differential expression across sample covariates and/or cell types
- Efficient inference via integrated nested Laplace approximation (INLA) scales to tens of millions of spots/cells
- Compatible with Visium HD, Visium v1/v2, and original STv1
- Enables deconvolution of multi-cellular data (Visium v1/v2, STv1) via per-spot cellular composition estimates
git clone https://github.com/nygctech/abcSplotch.git
cd abcSplotchThe preprocessing and downstream analysis tools are distributed as a Python package and are intended to run inside a Conda/Mamba environment.
We strongly recommend using mamba (or micromamba) with the conda-forge channel.
mamba env create -f environment.ymlActivate the environment:
conda activate abcsplotchInstall the repository in editable mode:
pip install -e . --no-depsThis will:
- install the
abcSplotchPython package - create command-line executables from the package entry points
- keep the installation linked to the local repository for development
The --no-deps flag prevents pip from attempting to reinstall scientific dependencies already managed by Conda/Mamba.
splotch_prepare_count_files --help
splotch_generate_input_files --helpor
python -c "import splotch"The Bayesian inference backend relies on a containerized R-INLA environment distributed via Docker/Apptainer.
We recommend using the provided Apptainer image directly on HPC systems.
From the containers/ directory:
cd containers
docker build -t abcsplotch-rinla:latest .apptainer build \
abcsplotch-rinla_latest.sif \
docker-daemon://abcsplotch-rinla:latestThis produces a portable, immutable Apptainer image suitable for HPC execution.
For debugging or interactive development:
apptainer build \
--sandbox abcsplotch-rinla.sandbox \
abcsplotch-rinla_latest.sifNote that sandbox containers are mutable and therefore less reproducible than .sif images.
Example:
apptainer exec \
abcsplotch-rinla_latest.sif \
Rscript /opt/abcSplotch/scripts/run_model.R \
input.rdat \
output_dirThe Python command-line tools can also be configured to launch the containerized backend automatically.
Many HPC environments prohibit Docker execution directly on compute nodes. The recommended workflow is therefore:
- Build Docker image locally or on a build node (must have x86 architecture)
- Convert to Apptainer
.sif - Transfer
.sifto the cluster - Execute with
apptainer exec
The .sif image is self-contained and reproducible across systems supporting Apptainer/Singularity.
