SpaDOT
Software for the manuscript "Optimal Transport Modeling Uncovers Spatial Domain Dynamics in Spatiotemporal Transcriptomics". First trial in wrapping a code pipeline using GitHub Copilot, inspired by Robert Langefeld from the Xiang Zhou Lab.
SpaDOT is an open-source computational method for identifying spatial domains and inferring their temporal dynamics across time points for spatiotemporal transcriptomics studies. Detailed documentation and tutorials are available at: https://marvinquiet.github.io/SpaDOT/.
Examples
Install this GitHub checkout (python -m pip install -e .) before running
the notebooks so they use the preprocessing and training code shown here.
The Chicken Heart,
Axolotl Telencephalon, and
Mouse Embryo notebooks follow five steps:
load the raw data, run SpaDOT preprocess, run SpaDOT train, run
SpaDOT analyze, and view the results. They use these gene counts:
| Dataset | Spots by timepoint | Genes requested by timepoint |
|---|---|---|
| Chicken Heart | 747 / 1,966 / 1,916 / 1,967 | 500 / 500 / 1,000 / 1,000 |
| Axolotl Telencephalon | 1,477 / 2,929 / 4,410 | 500 / 500 / 1,000 |
| Mouse Embryo | 2,397 / 2,312 / 3,546 | 3,000 / 3,000 / 3,000 |
Use one gene count per timepoint with SpaDOT preprocess --n_features, for
example --n_features 500,500,1000. The notebooks let SpaDOT derive the
genes from each user's input and display the results generated by that run.
Different inputs may select different genes and produce different results.
When obs["annotation"] is available, SpaDOT analyze colors each predicted
domain by its most overlapping annotation for visual comparison. It also
plots the transition score used by _analyze_utils.py: the minimum of the
row- and column-conditional probabilities from the transition H5AD matrix.
The same analyzed score is shown as a numbered matrix. Original H5AD values
remain available in the transition tables and raw-mass CSVs for audit.
The analysis writes a separate ID-to-name mapping.
Corresponding regions are placed along a rising
diagonal where possible.
Annotation matching changes only the display; it does not change training,
clustering, or transport values.
The included SpaDOT/config.yaml illustrates a training run from epoch 1
through 99 with a 30-epoch SVGP KL cycle and seed 2026. Adjust these values
in a copied configuration for other studies. epoch_stop_exclusive is the
first epoch that does not run; the saved model and latent.h5ad come from
the last executed epoch. The trainer uses Python/NumPy OT and does not require
libot.so or R. For reproducible GPU runs, set
CUBLAS_WORKSPACE_CONFIG=:4096:8, PYTHONHASHSEED=2026, and numerical thread
limits to 1 before starting Python.
Table of Contents
System Requirements
Hardware requirements
It is recommended to run SpaDOT on a GPU to achieve faster execution times.
Dependencies
SpaDOT requires the following:
- python (version 3.9 recommended)
- torch (v2.5.0)
- anndata (v0.9.1)
- scanpy (v1.9.8)
- numpy
- pandas
- wot
cuda toolkitandnvidia cudnnwhen using GPU resources, more information can be found here- torch_geometric, this package is dependent on torch version and cuda version.
Note: If using GPU resources, you might also need to install the CUDA Toolkit and NVIDIA cuDNN libraries. Detailed setup instructions can be found here. Please make sure to install a compatible version for PyTorch.
R is not required at runtime. SpaDOT preprocess --n_features performs
feature selection in Python.
Installation
For a collaborator using uv, clone this repository and create a Python 3.9 environment in the checkout:
git clone https://github.com/marvinquiet/SpaDOT.git
cd SpaDOT
uv venv --python 3.9
uv pip install -e .
./.venv/bin/SpaDOT --help
The environment stays in .venv and is not committed. On Windows, use
.venv\Scripts\SpaDOT.exe --help for the last command. The three notebooks
in examples/ use this same checkout and environment.
The most convenient way is to install with pip.
pip install SpaDOT
To upgrade to a newer release use the --upgrade flag.
pip install --upgrade SpaDOT
For more information, a detailed documentation on installation is provided here.
License
This project is covered under the MIT license.
Citing Our Work
Metadata
Release files for SpaDOT 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spadot-1.0.4.tar.gz | 55.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spadot-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 109.9 kB
Release files / spadot-1.0.4.tar.gz
| Download URL | spadot-1.0.4.tar.gz |
|---|---|
| Size | 55.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
438787893d5de152fc53384203de49b6b48b4e2ac01928db62d821fadd4fa99c
|
|
BLAKE2b-256 checksum How to use checksums |
7cc40e01e01983c96bf81a741309ad8ac7f25ad759e37d6107ee98a2efef5583
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.21
|
Release files / spadot-1.0.4-py3-none-any.whl
| Download URL | spadot-1.0.4-py3-none-any.whl |
|---|---|
| Size | 54.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1dbe596aa4997086c9892e3ea983553e2f1e1906ad6398436862f709636feb36
|
|
BLAKE2b-256 checksum How to use checksums |
49a87cc515bdfba29192440f2f50e1a296e2429dcabaafa33a500d47cff80478
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.21
|