Skip to main content

Spatial Transcriptomics Simulator

Project description

FEAST | From features to slice: parameter-cloud modeling of spatial transcriptomics for simulation and 3D interpolatory augmentation

License: MIT Python 3.8+

FEAST (Feature-space-based modeling of Spatial Transcriptomics) is a comprehensive computational framework for simulating and interpolating spatial transcriptomics (ST) data. By modeling gene expression through a "parameter cloud" - a latent manifold capturing mean, variance, and sparsity - FEAST generates high-fidelity synthetic ST slices with controllable biological and technical variations. This work has been submitted to top conference in computational biology RECOMB 2026, and will release preprint soon.

Key Features

  • High-Fidelity Simulation: Generate realistic ST data that preserves gene-level statistics, spatial patterns, and biological heterogeneity
  • Controllable Alterations: Systematically modify gene expression (mean, variance, sparsity) for robust benchmarking
  • Multiple ST Technologies: Support for Visium, MERFISH, Stereo-seq, Slide-seq, Xenium, and OpenST
  • Alignment Benchmarks: Create paired datasets with controlled geometric transformations (rotation, warping) for testing alignment algorithms
  • Deconvolution Ground Truth: Generate multi-resolution data with known cell-type compositions
  • 3D Interpolation: Reconstruct missing tissue slices using optimal transport in parameter space

Installation

From PyPI (Recommended)

pip install FEAST-py

Directly From Source

git clone https://github.com/maiziezhoulab/FEAST
cd FEAST
pip install -e .

Dependencies

  • Python >= 3.8
  • scanpy
  • anndata
  • numpy
  • scipy
  • pandas
  • scikit-learn
  • pyvinecopulib
  • POT (Python Optimal Transport)
  • tps (Thin Plate Spline)

Quick Start

Single Slice Simulation

from FEAST import simulator
import scanpy as sc

# Load your reference data
adata = sc.read_h5ad("your_spatial_data.h5ad")

# Simple simulation with default parameters
simulated_adata = simulator.simulate_single_slice(
    adata=adata,
    sigma=1.0,  # Spatial smoothness parameter
    verbose=True
)

# Simulation with expression alteration
from FEAST.modeling.marginal_alteration import AlterationConfig

alteration_config = AlterationConfig.mean_only(fold_change=2.0)
altered_adata = simulator.simulate_single_slice(
    adata=adata,
    alteration_config=alteration_config,
    sigma=1.0
)

Alignment Simulation

from FEAST.alignment.alignment_simulator import simulate_alignment_rotation

# Generate paired datasets with rotation for alignment benchmarking
original, rotated = simulate_alignment_rotation(
    adata=adata,
    rotation_angle=30.0,  # degrees
    data_type='imaging',  # or 'sequencing'
    sigma=0  # Perfect pattern preservation
)

Deconvolution Simulation

from FEAST.deconvolution.generate_deconvolution import create_deconvolution_benchmark_data

# Generate multi-resolution data with known cell-type compositions
deconv_adata = create_deconvolution_benchmark_data(
    adata=single_cell_adata,
    downsampling_factor=0.25,
    grid_type='hexagonal',
    cell_type_key='cell_type'
)

3D Slice Interpolation

from FEAST.interpolation.interpolation_pipeline import interpolate_slices

# Interpolate missing slices between consecutive sections
interpolated_slices = interpolate_slices(
    adata_list=[slice_k, slice_k_plus_1],
    n_interpolate=3,  # Number of intermediate slices
    alpha=0.01,
    verbose=True
)

Tutorials

Try FEAST with notebook! Comprehensive Jupyter notebooks are provided in the repository:

Architecture

FEAST/
├── FEAST_core/          # Core simulation engine
│   ├── simulator.py     # Main simulation logic (G-SRBA algorithm)
│   ├── parameter_cloud.py  # Parameter cloud modeling
│   └── APIs.py          # Unified FEAST API
├── alignment/           # Alignment simulation
│   ├── alignment_simulator.py
│   └── spatial_align_alter.py  # Rotation & warping transformations
├── deconvolution/       # Deconvolution simulation
│   ├── deconvolution_simulator.py
│   └── generate_deconvolution.py
├── interpolation/       # 3D interpolation
│   ├── interpolation_pipeline.py
│   ├── parameter_interpolation.py
│   └── coordinate_generation.py
└── modeling/            # Statistical models
    ├── StudentT_mixture_model.py
    ├── Beta_mixture_model.py
    └── marginal_alteration.py

Reproduction Scripts

The reproduction/ folder contains scripts to reproduce all benchmarking results from the paper. Each subdirectory corresponds to a specific analysis:

reproduction/
├── 1_Simulator_benchmark/     # Figure 2: Simulation fidelity evaluation
├── 2_Clustering_simulation/   # Figure 3: Clustering robustness testing
├── 3_Alignment_simulation/    # Figure 4: Alignment algorithm benchmarking
├── 4_Deconvolution_simulation/# Supp Fig: Deconvolution ground truth generation
└── 5_Interpolation_simulation/# Figure 5: 3D slice interpolation evaluation

Dataset Organization

All scripts expect datasets in a data/ directory with the following naming convention:

data/
├── DLPFC_{sample_id}.h5ad          # Human DLPFC sections
├── MERFISH_{slice_id}.h5ad         # Mouse brain MERFISH slices
├── OpenST_{slice_id}.h5ad          # Lymph node OpenST slices
├── Stereoseq_{sample_id}.h5ad      # Mouse embryo Stereo-seq slices
├── Slideseq_{sample_id}.h5ad       # Slide-seqV2 slices
└── Xenium_{sample_id}.h5ad         # Xenium tissue slices

Required Datasets

Dataset Technology Source Usage Files
DLPFC 10X Visium spatialLIBD Simulation, Clustering, Alignment DLPFC_151670.h5ad
DLPFC_151676.h5ad
DLPFC_151675.h5ad
MERFISH MERFISH Allen Brain Atlas Simulation, Deconvolution, Interpolation MERFISH_006.h5ad
MERFISH_007.h5ad
MERFISH_005-009.h5ad (5 files)
OpenST OpenST GEO: GSE251926 Simulation OpenST_005.h5ad
OpenST_006.h5ad
Stereo-seq Stereo-seq MOSTA Simulation Stereoseq_E14_5_E2S2.h5ad
Slide-seq Slide-seqV2 SODB Simulation Slideseq_001.h5ad
Xenium Xenium 10X Genomics Simulation Xenium_LymphNode.h5ad

Note: FEAST is actively maintained. If you have any question, please let me know!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feast_py-1.0.1.tar.gz (66.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

feast_py-1.0.1-py3-none-any.whl (72.8 kB view details)

Uploaded Python 3

File details

Details for the file feast_py-1.0.1.tar.gz.

File metadata

  • Download URL: feast_py-1.0.1.tar.gz
  • Upload date:
  • Size: 66.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for feast_py-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1ddd9d613b392c2e03fe10ce5b18fdacb97d4c0f5bc3442aef9434d9186bccd0
MD5 a26f1341f58b931ca4babe22c77a3769
BLAKE2b-256 fc6cee9e321153f78d21e4b7acb62b682c6fed63fdbaaa2e7c9a53b3436dac6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for feast_py-1.0.1.tar.gz:

Publisher: publish.yml on maiziezhoulab/FEAST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file feast_py-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: feast_py-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 72.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for feast_py-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f244f74df0158b916aeb841d9c1f20e11c2ac6bf4f1e1562b1f782f77467534
MD5 138d947af5ddd2fba3b2ffd676e06542
BLAKE2b-256 db291fe84f4cdcbb35f3bd1dd598b8069d9dc14fedd9b1261d1be2ac60d33fdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for feast_py-1.0.1-py3-none-any.whl:

Publisher: publish.yml on maiziezhoulab/FEAST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page