Skip to main content

Drug response evaluation of cancer cell line drug response models in a fair setting

Project description

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

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:main

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 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 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

from drevalpy.experiment import drug_response_experiment

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 unseed 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 Random Forest and Simple Neural Network models on the CTRPv2 dataset, using the Naive Mean Effects Predictor as a baseline. The results will be stored in results/my_second_run/CTRPv2/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:

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

drevalpy-1.5.0.tar.gz (349.2 kB view details)

Uploaded Source

Built Distribution

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

drevalpy-1.5.0-py3-none-any.whl (399.8 kB view details)

Uploaded Python 3

File details

Details for the file drevalpy-1.5.0.tar.gz.

File metadata

  • Download URL: drevalpy-1.5.0.tar.gz
  • Upload date:
  • Size: 349.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for drevalpy-1.5.0.tar.gz
Algorithm Hash digest
SHA256 c09b3422c7258034d07bd0c2625d5acad0c9f5a33c6acaf0810b7d4b49d7640d
MD5 94a4ffd16b03001651535193c5503989
BLAKE2b-256 84271b92be28346d55d96e0de8c1192d69accae5fc2df3ccadc552b31b8edbc7

See more details on using hashes here.

File details

Details for the file drevalpy-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: drevalpy-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 399.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for drevalpy-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba65f0567293413f12628de822184dc74dff1974ac9bd75ce89898f6d9fcb251
MD5 d73ee166a15bde3593e0fbcfcf1ba40d
BLAKE2b-256 006d0c9e78ad23e3a3882065adf777c0c7d8b6382d53be372bdea4c6e766aa6e

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