Skip to content

Lotfollahi-lab/CellDISECT

Repository files navigation

celldisect-logo

PyPI version Documentation Status License Stars Downloads

ℹ️ Beta Version Available: A beta version with compatibility for Google Colab and newer versions of torch and scvi-tools is available on the beta-colab branch. Install it with pip install celldisect==0.2.0b1.

🧬 Overview

CellDISECT (Cell DISentangled Experts for Covariate counTerfactuals) is a powerful causal generative model that enhances single-cell analysis by:

  • 🔍 Disentangling Variations: Separates covariate variations at test time
  • 🧪 Counterfactual Predictions: Learns to make accurate counterfactual predictions
  • 🎯 Flexible Fairness: Achieves flexible fairness through expert models for each latent space
  • 🔬 Enhanced Discovery: Captures both covariate-specific information and novel biological insights

📚 Documentation

Visit our comprehensive documentation for:

  • Detailed API reference
  • Step-by-step tutorials
  • Best practices and examples
  • Advanced usage guides

🚀 Quick Start

Prerequisites

We recommend using Anaconda/Miniconda. Create and activate a new environment:

conda create -n CellDISECT python=3.9
conda activate CellDISECT

Installation

  1. Install PyTorch (tested with pytorch 2.1.2 and cuda 12):
conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=12.1 -c pytorch -c nvidia
  1. Install CellDISECT:
# Via pip (stable version)
pip install celldisect

# Or via GitHub (latest development version)
pip install git+https://github.com/Lotfollahi-lab/CellDISECT

Optional Dependencies

Click to expand optional installations

RAPIDS/rapids-singlecell:

pip install \
    --extra-index-url=https://pypi.nvidia.com \
    cudf-cu12==24.4.* dask-cudf-cu12==24.4.* cuml-cu12==24.4.* \
    cugraph-cu12==24.4.* cuspatial-cu12==24.4.* cuproj-cu12==24.4.* \
    cuxfilter-cu12==24.4.* cucim-cu12==24.4.* pylibraft-cu12==24.4.* \
    raft-dask-cu12==24.4.* cuvs-cu12==24.4.*

pip install rapids-singlecell

CUDA-enabled JAX:

pip install -U "jax[cuda12_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

📖 Tutorials & Examples

Basic Tutorials

Tutorial Description Links
Basic Training Learn how to train CellDISECT and make counterfactual predictions using the Kang dataset Open In Colab Documentation

Advanced Applications

Tutorial Description Links
Latent Space Analysis Explore combinations of CellDISECT latent spaces for erythroid subset inference Documentation
Double Counterfactual Advanced tutorial recreating Scenario 2 counterfactual on the Eraslan dataset Documentation

🤝 Contributing

We welcome contributions! Please see our contributing guidelines for details on how to:

  • Report issues
  • Submit bug fixes
  • Propose new features
  • Submit pull requests

📜 License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

📫 Contact

For questions and support: