Sovereign 8s.is mirror of standardgalactic/SpaMosaic
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-09-15 15:41:58 +08:00
demo Initial commit with updated code 2025-08-13 16:41:23 +08:00
docs Update Fig_1.jpg in docs 2025-09-15 15:41:58 +08:00
spamosaic Update doc 2025-08-13 19:18:06 +08:00
.gitignore Initial commit with updated code 2025-08-13 16:41:23 +08:00
environment.yml Initial commit with updated code 2025-08-13 16:41:23 +08:00
LICENSE Initial commit with updated code 2025-08-13 16:41:23 +08:00
MANIFEST.in Initial commit with updated code 2025-08-13 16:41:23 +08:00
pyproject.toml Update readthedoc 2025-08-13 17:24:20 +08:00
README.md Update README.md 2025-09-14 15:04:43 +08:00
readthedocs.yml Update readthedoc 2025-08-13 17:19:12 +08:00
setup.py Initial commit with updated code 2025-08-13 16:41:23 +08:00

SpaMosaic: Mosaic Integration of Spatial Multi-Omics

Overview

With the advent of spatial multi-omics technologies, it is now possible to integrate datasets with partially overlapping modalities to construct higher-dimensional views of the source tissue. SpaMosaic is a spatial multi-omics integration tool that uses contrastive learning and graph neural networks to build a modality-agnostic, batch-corrected latent space, enabling downstream analyses such as spatial domain identification and imputation of missing omics.

Installation

1. Create and activate a conda environment

git clone https://github.com/JinmiaoChenLab/SpaMosaic.git
cd SpaMosaic
conda env create -f environment.yml
conda activate spamosaic-env

2. Install core dependencies

Choose the PyTorch and PyTorch Geometric build that matches your local CUDA toolkit or driver.
For other versions (including CPU-only builds), please refer to the documentation.

Example: PyTorch 2.0.0 with CUDA 11.7

# PyTorch
pip install torch==2.0.0+cu117 --index-url https://download.pytorch.org/whl/cu117

# PyTorch Geometric (matching Torch 2.0.0 and CUDA version)
pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric \
  -f https://data.pyg.org/whl/torch-2.0.0+cu117.html

pip install harmony-pytorch --no-deps

# Install SpaMosaic
pip install spamosaic

(Optional) Development (dev) version

The dev version differs from the stable release in:

  • Sparse message passing. Message passing uses torch_sparse.SparseTensor for the adjacency, making training on large graphs more memory-efficient.
  • Decoupled training. Graph message passing is separated from the training loop for cleaner modularity.

See the dev branch for installation and usage.

Tutorials

We provide detailed tutorials on applying SpaMosaic to various integration and imputation tasks.
Please refer to the documentation: https://spamosaic.readthedocs.io/en/latest/

Reproducibility

To reproduce the results of SpaMosaic and the compared methods, please use the code on the SpaMosaic-reproduce branch.