Skip to main content

Gaussian Process Spatial Alignment (GPSA)

The gpsa-engelhardt package implements Gaussian Process Spatial Alignment, a probabilistic model for aligning spatial genomics data into a shared coordinate system using deep Gaussian processes.

Install name: gpsa-engelhardt
Import name: gpsa

Paper: Alignment of spatial genomics and histology data using deep Gaussian processes
➤️ https://www.biorxiv.org/content/10.1101/2022.01.10.475692v1

View the Code on GitHub


🚀 Installation

pip install gpsa-engelhardt
# Usage
import gpsa
from gpsa.models import GPSA, VariationalGPSA

Requires Python 3.10+ and PyTorch.


🔬 Overview

gpsa provides two primary classes:

  • GPSA — core generative model for probabilistic spatial alignment
  • VariationalGPSA — variational approximation for scalable inference

Use GPSA to jointly model multiple spatial genomics datasets and correct spatial misalignments across experiments or modalities.


🧪 Example (Test the published PyPI package)

A minimal, runnable example is provided in examples/grid_example.py. It simulates a small synthetic dataset and runs GPSA alignment.

# Make a new virtual environment (Python 3.11 shown; 3.10 also works)
python3.11 -m venv gpsa_test_venv

# Activate the virtual environment
source gpsa_test_venv/bin/activate

# (optional) Upgrade pip
pip install --upgrade pip

# Clone the repository (for the example script)
git clone https://github.com/engelhardtgpsa/spatial-alignment.git
cd spatial-alignment

# Install GPSA from PyPI (pin to a specific version if desired)
pip install gpsa-engelhardt==0.6.15

# Run the example
python examples/grid_example.py

# Deactivate the virtual environment when done
deactivate

📊 Visualization

Example output showing the alignment of two misaligned spatial views:

Synthetic Data Example

The aligned coordinates converge during training:

Alignment Animation

Note that GUI backends (e.g., matplotlib with tkinter) may require extra setup on some systems.


🐞 Bug Reports

Please open issues at:
https://github.com/engelhardtgpsa/spatial-alignment/issues


📔 Citation

If you use GPSA in your work, please cite:

Jones, A. C., et al. Alignment of spatial genomics and histology data using deep Gaussian processes. bioRxiv (2022).
https://www.biorxiv.org/content/10.1101/2022.01.10.475692v1


📜 License

Apache-2.0

Metadata

Release files for gpsa-engelhardt 0.6.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gpsa-engelhardt 0.6.15
File Size Uploaded
gpsa_engelhardt-0.6.15.tar.gz 16.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gpsa-engelhardt 0.6.15
File Interpreter ABI Platform
gpsa_engelhardt-0.6.15-py3-none-any.whl Python 3 none any Details

Total release size: 32.1 kB

Release files / gpsa_engelhardt-0.6.15.tar.gz

Download URL gpsa_engelhardt-0.6.15.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
caa9edfe13fdfb770fd914d7fd2b85b8d2b3e659f351cd7823ec8f14cfb62d5e
BLAKE2b-256 checksum
How to use checksums
1dc9ff3f52cc4146ff1694fa82c6812fe2d3cd04418096258e33247e980eecad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Release files / gpsa_engelhardt-0.6.15-py3-none-any.whl

Download URL gpsa_engelhardt-0.6.15-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d16919d1bcc5fa12ee16545b81d5ded7a0c3bd43604506889a57f6e7b628835e
BLAKE2b-256 checksum
How to use checksums
940915e30a3c5e03696066044ae4284b20a07f6a0e6b726d2d70cf1b0730d8b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.6.15 This release

2 release files

0.6.14

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page