Skip to main content

Shared-private Variational Inference with Product of Experts and Supervision

Project description

spVIPES

Shared-private Variational Inference with Product of Experts and Supervision

Python PyPI Documentation


About

spVIPES enables robust integration of multi-group single-cell datasets through a principled shared-private latent space decomposition. The method leverages a Product of Experts (PoE) framework to learn both shared biological signals common across datasets and private representations capturing group-specific variations.

Integration Strategies

spVIPES provides three complementary approaches for dataset alignment:

Method Description Best Use Case
Label-based PoE Uses cell type annotations for direct supervision High-quality cell type labels available
OT Paired PoE Direct cell-to-cell correspondences via optimal transport Known cellular correspondences (e.g., time series)
OT Cluster-based PoE Automated cluster matching with transport plans Similar cell populations, no direct correspondences

Note: The method automatically selects the most appropriate strategy based on available annotations and transport information.

Installation

Requirements

  • Python 3.9+
  • PyTorch (GPU support strongly recommended)

Quick Install

Install the latest stable release from PyPI:

pip install spVIPES

For the development version:

pip install git+https://github.com/nrclaudio/spVIPES.git@main

GPU Setup (Recommended)

For optimal performance, ensure CUDA-compatible PyTorch is installed:

# Check GPU availability
nvidia-smi

# Install PyTorch with CUDA support (example for CUDA 11.3)
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113

# Verify GPU detection
python -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}')"

See PyTorch installation guide for version-specific instructions.

Quick Start

Basic Workflow

import spVIPES
import scanpy as sc

# Load your multi-group dataset
adata = sc.read_h5ad("data.h5ad")

# Configure integration strategy
spVIPES.model.setup_anndata(
    adata,
    groups_key="dataset",
    label_key="cell_type",  # Optional: for supervised integration
)

# Initialize and train model
model = spVIPES.model(adata)
model.train(max_epochs=200)

# Extract integrated representations
latent = model.get_latent_representation()
adata.obsm["X_spVIPES"] = latent

Integration Strategies

📋 Label-based Integration

Use when high-quality cell type annotations are available:

spVIPES.model.setup_anndata(
    adata,
    groups_key="dataset",
    label_key="cell_type",
    batch_key="batch",  # Optional batch correction
)
🔄 Optimal Transport: Paired Cells

For datasets with known cell-to-cell correspondences:

# Assumes transport plan stored in adata.uns["transport_plan"]
spVIPES.model.setup_anndata(
    adata,
    groups_key="dataset",
    transport_plan_key="transport_plan",
    match_clusters=False,
)
🧩 Optimal Transport: Cluster Matching

For automatic cluster-based alignment:

spVIPES.model.setup_anndata(
    adata,
    groups_key="dataset",
    transport_plan_key="transport_plan",
    match_clusters=True,  # Enables automated cluster matching
)

Advanced Configuration

# Custom model parameters
model = spVIPES.model(
    adata,
    n_dimensions_shared=25,  # Shared latent dimensions
    n_dimensions_private=10,  # Private latent dimensions
    n_hidden=128,  # Hidden layer size
    dropout_rate=0.1,  # Regularization
)

# Training with custom settings
model.train(
    max_epochs=300, batch_size=512, early_stopping=True, check_val_every_n_epoch=10
)

Documentation & Tutorials

📚 Getting Started

Support & Community

💬 Get Help

Citation

If you use spVIPES in your research, please cite:

@article{spVIPES2023,
  title={Integrative learning of disentangled representations},
  author={C. Novella-Rausell, D.J.M Peters and A. Mahfouz},
  journal={bioRxiv},
  year={2023},
  doi={10.1101/2023.11.07.565957},
  url={https://www.biorxiv.org/content/10.1101/2023.11.07.565957v1}
}

Paper: bioRxiv preprint


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

spvipes-0.3.0.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

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

spvipes-0.3.0-py3-none-any.whl (48.0 kB view details)

Uploaded Python 3

File details

Details for the file spvipes-0.3.0.tar.gz.

File metadata

  • Download URL: spvipes-0.3.0.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for spvipes-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2978529b3f38082b5508130eaa26bf984bbc0b565733166c83dab6d777e92556
MD5 06e8955beecf343f22ea2d4e4c85ff1b
BLAKE2b-256 df9099cb2589352986cfe7ca4d78f723f8724633a1d24f3ce67d01278fb01e21

See more details on using hashes here.

File details

Details for the file spvipes-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: spvipes-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 48.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for spvipes-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27f66ac6480074954d32b7f2518e4aad6be686e185b0aef9d9bf14d491f4ad9e
MD5 53c50951842d82401bf4716a2aa0915d
BLAKE2b-256 64681964c5abe2eea2ad4610e29d101fead5fdfd3382f69206b55e952130d1dc

See more details on using hashes here.

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