Skip to main content

Cell DISentangled Experts for Covariate counTerfactuals (CellDISECT). Causal generative model designed to disentangle known covariate variations from unknown ones at test time while simultaneously learning to make counterfactual predictions.

Project description

celldisect-logo

PyPI version Documentation Status License Stars Downloads bioRxiv

ℹ️ 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:

📝 Citation

If you use CellDISECT in your research, please cite our paper:

Megas, S., Amani, A., Rose, A., Dufva, O., Shamsaie, K., Asadollahzadeh, H., Polanski, K., Haniffa, M., Teichmann, S. A., & Lotfollahi, M. (2025). Integrating multi-covariate disentanglement with counterfactual analysis on synthetic data enables cell type discovery and counterfactual predictions. bioRxiv. https://doi.org/10.1101/2025.06.03.657578

@article{Megas2025CellDISECT,
    title={Integrating multi-covariate disentanglement with counterfactual analysis on synthetic data enables cell type discovery and counterfactual predictions},
    author={Megas, Stathis and Amani, Arian and Rose, Antony and Dufva, Olli and Shamsaie, Kian and Asadollahzadeh, Hesam and Polanski, Krzysztof and Haniffa, Muzlifah and Teichmann, Sarah Amalia and Lotfollahi, Mohammad},
    journal={bioRxiv},
    year={2025},
    doi={10.1101/2025.06.03.657578},
    elocation-id={2025.06.03.657578},
    publisher={Cold Spring Harbor Laboratory},
    URL={https://www.biorxiv.org/content/10.1101/2025.06.03.657578v1}
}

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

celldisect-0.1.4.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

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

celldisect-0.1.4-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file celldisect-0.1.4.tar.gz.

File metadata

  • Download URL: celldisect-0.1.4.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.3 Darwin/24.5.0

File hashes

Hashes for celldisect-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4f87c3e1beca7043c21aa0a23a75ef4ff5ef1e4dc129509a89c48a2cd5a6aa16
MD5 8d6f4ae974c3893532128db05dcb4fed
BLAKE2b-256 2e07be572c6ef488b2f43a5d4ea9626b50df6fb4b079d5cc279ebc4b686934da

See more details on using hashes here.

File details

Details for the file celldisect-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: celldisect-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.3 Darwin/24.5.0

File hashes

Hashes for celldisect-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 acd4d255694b364fc79a1a82e4405043ae2ce16f9eb37716bb53ffe2ea54ade6
MD5 05b85da07fde982bfe7c9ffa8011962b
BLAKE2b-256 4bd08a5fb18f30220c9109b45c6f8e96a5207ad5514c76b456f9ddbe165dd899

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