Skip to main content

DrEvalPy: Python Cancer Cell Line Drug Response Prediction Suite

DOI PyPI version Python versions License Read the Docs Test status Precommit Code style: black DOI

News: Our paper is out on Nature Communications!

Documentation at ReadTheDocs.

Focus on Innovating Your Models — DrEval Handles the Rest!

  • DrEval is a toolkit that ensures drug response prediction evaluations are statistically sound, biologically meaningful, and reproducible.
  • Focus on model innovation while using our automated standardized evaluation protocols and preprocessing workflows.
  • A flexible model interface supports all model types (e.g. Machine Learning, Stats, Network-based analyses)

By contributing your model to the DrEval catalog, you can increase your work's exposure, reusability, and transferability.

DrEval


Use DrEval to build drug response models that have an impact

  1. Maintained, up-to-date baseline catalog, no need to re-implement literature models
  2. Gold standard datasets for benchmarking
  3. Consistent application-driven evaluation
  4. Ablation studies with permutation tests
  5. Cross-study evaluation for generalization analysis
  6. Optimized nextflow pipeline for fast experiments
  7. Easy-to-use hyperparameter tuning
  8. Paper-ready visualizations to display performance

DrEvalPy Leaderboard

In the critical difference diagram, you can see which models outperform which other models significantly. The diagram is based on the average ranks of the models across all datasets and metrics, and the critical difference is calculated using the Nemenyi test. If model A is outside the bar corresponding to model B, it is significantly better (if it lies to the left) or worse (if it lies to the right) than model B.

Critical difference diagram showing which models significantly outperform which other models

This project is a collaboration of the Technical University of Munich (TUM, Germany) and the Freie Universität Berlin (FU, Germany).

Demo

Check out our demo notebook in Colab: Open In Colab

Expected runtime on a normal machine:

  • Standalone demo: 38 minutes
  • Nextflow demo: 5 minutes

Installation

Using pip:

pip install drevalpy

Optional Ray Tune support (for parallel hyperparameter tuning):

pip install "drevalpy[multiprocessing]"

On a regular machine, the installation should take about a minute.

Using docker:

docker pull ghcr.io/daisybio/drevalpy:latest

From source:

git clone https://github.com/daisybio/drevalpy.git
cd drevalpy
pip install poetry
pip install poetry-plugin-export
poetry install

Check your installation by running in your console:

drevalpy --help

Quickstart

To run models from the catalog, you can run:

drevalpy --run_id my_first_run --models NaiveTissueMeanPredictor NaiveDrugMeanPredictor --dataset_name TOYv1 --test_mode LCO

This will download a small toy drug response dataset, train our baseline models which just predict the drug or tissue means or the mean drug and cell line effects. It will evaluate in "LCO" which is the leave-cell-line-out splitting strategy using 7 fold cross validation. The results will be stored in

results/my_first_run/TOYv1/LCO

You can visualize them using

drevalpy report --run_id my_first_run --dataset_name TOYv1

This will create an index.html file in the results directory which you can open in your web browser.

You can also run a drug response experiment using Python:

from drevalpy.experiment import drug_response_experiment
from drevalpy.models import MODEL_FACTORY
from drevalpy.datasets import AVAILABLE_DATASETS

naive_mean = MODEL_FACTORY["NaivePredictor"] # a naive model that just predicts the training mean
enet = MODEL_FACTORY["ElasticNet"] # An Elastic Net based on drug fingerprints and gene expression of 1000 landmark genes
simple_nn = MODEL_FACTORY["SimpleNeuralNetwork"] # A neural network based on drug fingerprints and gene expression of 1000 landmark genes

toyv1 = AVAILABLE_DATASETS["TOYv1"](path_data="data")

drug_response_experiment(
            models=[enet, simple_nn],
            baselines=[naive_mean], # Ablation studies and robustness tests are not run for baselines.
            response_data=toyv1,
            n_cv_splits=2, # the number of cross validation splits. Should be higher in practice :)
            test_mode="LCO", # LCO means Leave-Cell-Line out. This means that the test and validation splits only contain unseen cell lines.
            run_id="my_first_run",
            path_data="data", # where the downloaded drug response and feature data is stored
            path_out="results", # results are stored here :)
            hyperparameter_tuning=False) # if True (default), hyperparameters of the models and baselines are tuned.

This will run the ElasticNet and SimpleNeuralNetwork models on the TOYv1 dataset, using the NaivePredictor as a baseline. The results will be stored in results/my_first_run/TOYv1/LCO. To obtain evaluation metrics, you can use:

from drevalpy.visualization.create_report import create_report

create_report(
    run_id="my_first_run",
    dataset=toyv1.dataset_name,
    path_data= "data",
    result_path="results",
)

We recommend the use of our Nextflow pipeline for computational demanding runs and for improved reproducibility. No knowledge of Nextflow is required to run it. The nextflow pipeline is available here: nf-core/drugresponseeval.

Example Report

Browse our benchmark results here. You can reproduce the whole analysis by running the following commands:

# Main run
nextflow run nf-core/drugresponseeval \
    -profile docker \
    --run_id main_results \
    --dataset_name CTRPv2 \
    --cross_study_datasets CTRPv1,CCLE,GDSC1,GDSC2 \
    --models DIPK,MultiViewRandomForest \
    --baselines SimpleNeuralNetwork,RandomForest,MultiViewNeuralNetwork,NaiveMeanEffectsPredictor,GradientBoosting,SRMF,ElasticNet,NaiveTissueMeanPredictor,NaivePredictor,SuperFELTR,NaiveCellLineMeanPredictor,NaiveDrugMeanPredictor \
    --test_mode LPO,LCO,LTO,LDO \
    --randomization_mode SVRC,SVRD \
    --randomization_type permutation \
    --measure LN_IC50

# EC50 run
nextflow run nf-core/drugresponseeval \
    -profile docker \
    --run_id ec50_run \
    --dataset_name CTRPv2 \
    --cross_study_datasets CTRPv1,CCLE,GDSC1,GDSC2,PDX_Bruna,BeatAML2 \
    --models RandomForest \
    --baselines NaiveMeanEffectsPredictor \
    --test_mode LCO \
    --measure pEC50

# AUC run
nextflow run nf-core/drugresponseeval \
    -profile docker \
    --run_id auc_run \
    --dataset_name CTRPv2 \
    --cross_study_datasets CTRPv1,CCLE,GDSC1,GDSC2,PDX_Bruna,BeatAML2 \
    --models RandomForest \
    --baselines NaiveMeanEffectsPredictor \
    --test_mode LCO \
    --measure AUC

# Invariant ablation run
# Run this on CPU
nextflow run nf-core/drugresponseeval \
    -profile docker \
    --run_id invariant-rf \
    --dataset_name CTRPv2 \
    --models MultiViewRandomForest \
    --baselines NaiveMeanEffectsPredictor \
    --test_mode LPO,LCO,LDO \
    --randomization_mode SVRC,SVRD \
    --randomization_type invariant \
    --measure LN_IC50

# modify the profile to run this on GPU, if possible
nextflow run nf-core/drugresponseeval \
    -profile docker \
    --run_id invariant-dipk \
    --dataset_name CTRPv2 \
    --models DIPK \
    --baselines NaiveMeanEffectsPredictor \
    --test_mode LPO,LCO,LDO \
    --randomization_mode SVRC,SVRD \
    --randomization_type invariant \
    --measure LN_IC50

## Inference on BeatAMl2, PDX_Bruna
# run this on CPU
nextflow run nf-core/drugresponseeval \
    -profile docker \
    --run_id infer_pdx_beat \
    --dataset_name CTRPv2 \
    --cross_study_datasets PDX_Bruna,BeatAML2 \
    --models RandomForest,SimpleNeuralNetwork,GradientBoosting,SRMF,ElasticNet,NaivePredictor,NaiveDrugMeanPredictor,NaiveCellLineMeanPredictor \
    --baselines NaiveMeanEffectsPredictor \
    --test_mode LPO,LCO,LDO \
    --measure LN_IC50

# modify profile to run this on GPU, if possible
nextflow run nf-core/drugresponseeval \
    -profile docker \
    --run_id dipk_pdx_beat \
    --dataset_name CTRPv2 \
    --cross_study_datasets PDX_Bruna,BeatAML2 \
    --models DIPK \
    --baselines NaiveMeanEffectsPredictor \
    --test_mode LPO,LCO,LDO \
    --measure LN_IC50

Contact

Main developers:

Metadata

Release files for drevalpy 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drevalpy 1.6.0
File Size Uploaded
drevalpy-1.6.0.tar.gz 401.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drevalpy 1.6.0
File Interpreter ABI Platform
drevalpy-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 867.1 kB

Release files / drevalpy-1.6.0.tar.gz

Download URL drevalpy-1.6.0.tar.gz
Size 401.5 kB
Tags Source
SHA-256 checksum
How to use checksums
095dbac5cdec237ba4bfcd6f703e68c762601a3c249939d1a2b80dd7f9313f85
BLAKE2b-256 checksum
How to use checksums
4a47d4ef7db6872e37f0a58684e95c82c8f98fe51a97e5d1f1f8a49b4aa35f3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / drevalpy-1.6.0-py3-none-any.whl

Download URL drevalpy-1.6.0-py3-none-any.whl
Size 465.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd6a314929adbafe0476fda5afe6312f4bc6cfee454e59a256f33b102aee40b5
BLAKE2b-256 checksum
How to use checksums
63f4a37df5738c1090c9302d6d2f810bf32f28ea721b9f36c80fe6ddf6ff6ce4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page