RepositoryJupyter NotebookDEGermany
theislab

theislab/chemCPA

Code for "Predicting Cellular Responses to Novel Drug Perturbations at a Single-Cell Resolution", NeurIPS 2022.

164stars
36forks
6issues
2views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: disentanglement

#1 Repository of the week

1
TINIX TRENDING·Topic: perturbation

#1 Repository of the week

2
TINIX TRENDING·Topic: transfer-learning

#2 Repository of the week

Predicting Cellular Responses to Novel Drug Perturbations at a Single-Cell Resolution

Code accompanying the NeurIPS 2022 paper (PDF).

architecture of CCPA

Our talk on chemCPA at the M2D2 reading club is available here. A previous version of this work was a spotlight paper at ICLR MLDD 2022. Code for this previous version can be found under the v1.0 git tag.

Codebase overview

  • chemCPA/: contains the code for the model, the data, and the training loop.
  • embeddings: There is one folder for each molecular embedding model we benchmarked. Each contains an environment.yml with dependencies. We generated the embeddings using the provided notebooks and saved them to disk, to load them during the main training loop.
  • experiments: Each folder contains a README.md with the experiment description, a .yaml file with the seml configuration, and a notebook to analyze the results.
  • notebooks: Example analysis notebooks.
  • preprocessing: Notebooks for processing the data. For each dataset there is one notebook that loads the raw data.
  • tests: A few very basic tests.

All experiments where run through seml. The entry function is ExperimentWrapper.__init__ in chemCPA/seml_sweep_icb.py. For convenience, we provide a script to run experiments manually for debugging purposes at chemCPA/manual_seml_sweep.py. The script expects a manual_run.yaml file containing the experiment configuration.

All notebooks also exist as Python scripts (converted through jupytext) to make them easier to review.

Getting started

Environment

The easiest way to get started is to use a docker image we provide

docker run -it -p 8888:8888 --platform=linux/amd64 registry.hf.space/b1ro-chemcpa:latest

this image contains the source code and all dependencies to run the experiments. By default it runs a jupyter server on port 8888.

Alternatively you may clone this repository and setup your own environment by running:

conda env create -f environment.yml
python setup.py install -e .

Datasets

The datasets are not included in the docker image, but get automatically downloaded when you run the notebooks that require them. The datasets may alternatively be downloaded manually using the python tool in the raw_data/dataset.py folder. Usage is:

python raw_data/dataset.py --list
python raw_data/dataset.py --dataset <dataset_name>

or you may use the following links:

Some of the notebooks use a drugbank_all.csv file, which can be downloaded from here (registration needed).

Data preparation

To train the models, first the raw data needs to be processed. This can be done by running the notebooks inside the preprocessing/ folder in a sequential order. Alternatively, you may run

python preprocessing/run_notebooks.py

A description of the preprocessing steps is given in the preprocessing/README.md file and in the headers of individual notebooks. Section 4 of the paper is also highly relevant.

Training the models

Run

python chemCPA/train_hydra.py

Citation

You can cite our work as:

@inproceedings{hetzel2022predicting,
  title={Predicting Cellular Responses to Novel Drug Perturbations at a Single-Cell Resolution},
  author={Hetzel, Leon and Böhm, Simon and Kilbertus, Niki and Günnemann, Stephan and Lotfollahi, Mohammad and Theis, Fabian J},
  booktitle={NeurIPS 2022},
  year={2022}
}

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
scverse/pertpy

Single-cell perturbation analysis

362
Nov 30, 2026
RepositoryJupyter Notebook
sanderlab/scPerturb

scPerturb: A resource and a python/R tool for single-cell perturbation data

195
Feb 25, 2025
Modelfill-mask
ctheodoris/Geneformer

Geneformer Geneformer is a foundational transformer model pretrained on a large-scale corpus of human single cell transcriptomes to enable context-aware predictions in settings with limited data in network biology. - See our manuscript(https://rdcu....

♥0
1.4k
Sep 12, 2026
Dataset
wei82/precancer-omics-data

Precancer → Tumor → Late/Metastatic Progression Multi-omics A curated, continuously-harvested collection of publicly available human multi-omics datasets spanning the full tumor trajectory: precancerous lesions → early carcinoma → advanced / metastatic. Single-cell and spatial transcriptomics are prioritized. ⚠️ Provenance & licensing. Every dataset here was downloaded from a public, open-access repository (no controlled-access or patient-identifiable data). Each dataset… See the full description on the dataset page: https://huggingface.co/datasets/wei82/precancer-omics-data.

♥0
742.0k
Sep 13, 2026
Dataset
TabBioMed/TabBioMed

TabBioMed TabBioMed: A Large-Scale Benchmark for Biomedical Tabular Learning is a living benchmark of curated public biomedical tabular datasets with standardized evaluation splits. Paper · Code and preprocessing · Leaderboard Repository layout Each dataset has its own folder and a named subset in the viewer. The folders retain the data, task metadata, source attribution and applicable license notices. <dataset>/ README.md metadata.json data/train.parquet… See the full description on the dataset page: https://huggingface.co/datasets/TabBioMed/TabBioMed.

♥0
1.1k
Nov 25, 2026
RepositoryHTML
Boom5426/Awesome-Virtual-Cell

Awesome-AI-Virtual-Cell: papers, datasets, benchmarks, talks, and community resources for AIVC

342
Dec 1, 2026
RepositoryJupyter Notebook
NVIDIA/DeepLearningExamples

State-of-the-Art Deep Learning scripts organized by models - easy to train and deploy with reproducible accuracy and performance on enterprise-grade infrastructure.

14.9k
Aug 12, 2024
RepositoryJupyter Notebook
theislab/single-cell-best-practices

https://www.sc-best-practices.org

1.3k
Nov 15, 2026
RepositoryJupyter Notebook
mlmed/torchxrayvision

TorchXRayVision: A library of chest X-ray datasets and models. Classifiers, segmentation, and autoencoders.

1.2k
Oct 18, 2026