Skip to content

Commit 3618669

Browse files
Merge pull request #226 from daisybio/development
v1.3.2
2 parents 4fe8bd1 + f3e348e commit 3618669

61 files changed

Lines changed: 6117 additions & 1562 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.github/workflows/publish_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Setup Python
1414
uses: actions/setup-python@v5
1515
with:
16-
python-version: "3.12"
16+
python-version: "3.13"
1717

1818
- name: Install pip
1919
run: |

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: ["3.11", "3.12"]
18+
python-version: ["3.11", "3.12", "3.13"]
1919

2020
steps:
2121
- name: Check out the repository

.github/workflows/run_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,6 @@ jobs:
127127
run: nox --force-color --session=coverage -- xml -i
128128

129129
- name: Upload coverage report
130-
uses: codecov/codecov-action@v5.4.2
130+
uses: codecov/codecov-action@v5.4.3
131131
with:
132132
token: ${{ secrets.CODECOV_TOKEN }}

.pre-commit-config.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,20 @@ repos:
3535
types: [python]
3636
require_serial: true
3737
args:
38-
- --ignore=D212,W503,C901
38+
- --ignore=D212,W503,C901,N803,N806
3939
- id: pyupgrade
4040
name: pyupgrade
4141
description: Automatically upgrade syntax for newer versions.
4242
entry: pyupgrade
4343
language: system
4444
types: [python]
4545
args: [--py39-plus, --keep-runtime-typing]
46-
- id: trailing-whitespace
47-
name: Trim Trailing Whitespace
48-
entry: trailing-whitespace-fixer
49-
language: system
50-
types: [text]
51-
stages: [pre-commit, pre-push, manual]
5246
- repo: https://github.com/pre-commit/mirrors-prettier
5347
rev: v2.5.1
5448
hooks:
5549
- id: prettier
5650
- repo: https://github.com/pycqa/isort
57-
rev: 5.12.0
51+
rev: 6.0.1
5852
hooks:
5953
- id: isort
6054
name: isort (python)
@@ -64,3 +58,7 @@ repos:
6458
- id: isort
6559
name: isort (pyi)
6660
types: [pyi]
61+
- repo: https://github.com/pre-commit/pre-commit-hooks
62+
rev: v5.0.0
63+
hooks:
64+
- id: trailing-whitespace

README.md

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
[![Precommit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
99
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
1010

11-
Focus on Innovating Your Models — DrEval Handles the Rest!
11+
**News:** Our preprint is out on [biorxiv](https://www.biorxiv.org/content/10.1101/2025.05.26.655288v1)!
12+
13+
Documentation at [ReadTheDocs](https://drevalpy.readthedocs.io/en/latest/index.html#).
14+
15+
**Focus on Innovating Your Models — DrEval Handles the Rest!**
1216

1317
- DrEval is a toolkit that ensures drug response prediction evaluations are statistically sound, biologically meaningful, and reproducible.
1418
- Focus on model innovation while using our automated standardized evaluation protocols and preprocessing workflows.
@@ -59,6 +63,7 @@ From source:
5963
git clone https://github.com/daisybio/drevalpy.git
6064
cd drevalpy
6165
pip install poetry
66+
pip install poetry-plugin-export
6267
poetry install
6368
```
6469

@@ -67,44 +72,86 @@ poetry install
6772
To run models from the catalog, you can run:
6873

6974
```bash
70-
python run_suite.py --run_id my_first_run --models ElasticNet SimpleNeuralNetwork --dataset GDSC2 --test_mode LCO
75+
python run_suite.py --run_id my_first_run --models NaiveTissueMeanPredictor NaiveDrugMeanPredictor --baselines NaiveMeanEffectsPredictor --dataset TOYv1 --test_mode LCO
7176
```
7277

73-
This will train and tune a neural network and an elastic net model on gene expression features and drug fingerprint
74-
features to predict IC50 values of the GDSC2 database. It will evaluate in "LCO" which is the leave-cell-line-out
75-
splitting strategy using 5 fold cross validation.
78+
This will train our baseline models which just predict the drug or tissue means or the mean drug and cell line effects.
79+
It will evaluate in "LCO" which is the leave-cell-line-out splitting strategy using 7 fold cross validation.
7680
The results will be stored in
7781

7882
```bash
79-
results/my_first_run/LCO
83+
results/my_first_run/TOYv1/LCO
8084
```
8185

8286
You can visualize them using
8387

8488
```bash
85-
python create_report.py --run_id my_first_run --dataset GDSC2
89+
python create_report.py --run_id my_first_run --dataset TOYv1
8690
```
8791

88-
This will create an index.html file which you can open in your webbrowser.
92+
This will create an index.html file which you can open in your web browser.
8993

9094
You can also run a drug response experiment using Python:
9195

9296
```python
93-
9497
from drevalpy.experiment import drug_response_experiment
98+
from drevalpy.models import MODEL_FACTORY
99+
from drevalpy.datasets import AVAILABLE_DATASETS
100+
101+
naive_mean = MODEL_FACTORY["NaiveMeanEffectsPredictor"]
102+
rf = MODEL_FACTORY["RandomForest"]
103+
simple_nn = MODEL_FACTORY["SimpleNeuralNetwork"]
104+
105+
toyv2 = AVAILABLE_DATASETS["TOYv2"](path_data="data", measure="LN_IC50_curvecurator")
95106

96107
drug_response_experiment(
97-
models=["MultiOmicsNeuralNetwork"],
98-
baselines=["RandomForest"],
99-
response_data="GDSC1",
100-
metric="mse",
101-
n_cv_splits=5,
102-
test_mode="LPO",
108+
models=[rf, simple_nn],
109+
baselines=[naive_mean],
110+
response_data=toyv2,
111+
metric="RMSE",
112+
n_cv_splits=7,
113+
test_mode="LCO",
103114
run_id="my_second_run",
115+
path_data="data",
116+
hyperparameter_tuning=False,
104117
)
105118
```
106119

107-
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](https://github.com/JudithBernett/nf-core-drugresponseeval).
120+
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`.
121+
To obtain evaluation metrics, you can use:
122+
123+
```python
124+
from drevalpy.visualization.utils import parse_results, prep_results, write_results
125+
import pathlib
126+
127+
# load data, evaluate per CV run
128+
(
129+
evaluation_results,
130+
evaluation_results_per_drug,
131+
evaluation_results_per_cell_line,
132+
true_vs_pred,
133+
) = parse_results(path_to_results="results/my_second_run", dataset='TOYv2')
134+
# reformat, calculate normalized metrics
135+
(
136+
evaluation_results,
137+
evaluation_results_per_drug,
138+
evaluation_results_per_cell_line,
139+
true_vs_pred,
140+
) = prep_results(
141+
evaluation_results, evaluation_results_per_drug, evaluation_results_per_cell_line, true_vs_pred, pathlib.Path("data")
142+
)
143+
144+
write_results(
145+
path_out="results/my_second_run",
146+
eval_results=evaluation_results,
147+
eval_results_per_drug=evaluation_results_per_drug,
148+
eval_results_per_cl=evaluation_results_per_cell_line,
149+
t_vs_p=true_vs_pred,
150+
)
151+
```
152+
153+
We recommend the use of our Nextflow pipeline for computational demanding runs and for improved reproducibility.
154+
No knowledge of Nextflow is required to run it. The nextflow pipeline is available here: [nf-core-drugresponseeval](https://github.com/JudithBernett/nf-core-drugresponseeval).
108155

109156
## Example Report
110157

@@ -115,4 +162,4 @@ We recommend the use of our nextflow pipeline for computational demanding runs a
115162
Main developers:
116163

117164
- [Judith Bernett](mailto:judith.bernett@tum.de), [Data Science in Systems Biology](https://www.mls.ls.tum.de/daisybio/startseite/), TUM
118-
- [Pascal Iversen](mailto:Pascal.Iversen@hpi.de), [Data Integration in the Life Sciences](https://www.mi.fu-berlin.de/w/DILIS/WebHome), FU Berlin, Hasso Plattner Institute
165+
- [Pascal Iversen](mailto:Pascal.Iversen@hpi.de), [Data Integration in the Life Sciences](https://www.mi.fu-berlin.de/w/DILIS/WebHome), FU Berlin, Hasso-Plattner-Institut

README.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ DrEvalPy: Python Cancer Cell Line Drug Response Prediction Suite
4040
Overview
4141
=======
4242

43-
Focus on Innovating Your Models — DrEval Handles the Rest!
43+
Check out our preprint on `bioRxiv <https://www.biorxiv.org/content/10.1101/2025.05.26.655288v1>`_!
44+
45+
**Focus on Innovating Your Models — DrEval Handles the Rest!**
46+
4447
- DrEval is a toolkit that ensures drug response prediction evaluations are statistically sound, biologically meaningful, and reproducible.
4548
- Focus on model innovation while using our automated standardized evaluation protocols and preprocessing workflows.
46-
- A flexible model interface supports all model types (e.g. Machine Learning, Stats, Network-based analyses)
49+
- A flexible model interface supports all model types (e.g. machine learning, statistical models, network-based analyses).
4750

48-
Use DrEval to Build Drug Response Models That Have an Impact
51+
Use DrEval to build drug response models that have an impact
4952

5053
1. Maintained, up-to-date baseline catalog, no need to re-implement literature models
5154

create_report.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,14 @@
7474
result_path=result_path,
7575
)
7676
# draw figures for each algorithm with all randomizations etc
77-
unique_algos = set(unique_algos) - {
77+
unique_algos_set = set(unique_algos) - {
7878
"NaiveMeanEffectsPredictor",
7979
"NaivePredictor",
8080
"NaiveCellLineMeansPredictor",
81+
"NaiveTissueMeansPredictor",
8182
"NaiveDrugMeanPredictor",
8283
}
83-
for algorithm in unique_algos:
84+
for algorithm in unique_algos_set:
8485
draw_algorithm_plots(
8586
model=algorithm,
8687
ev_res=evaluation_results,
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
pubchem_id,dim_0,dim_1,dim_2,dim_3,dim_4,dim_5,dim_6,dim_7,dim_8,dim_9,dim_10,dim_11,dim_12,dim_13,dim_14,dim_15,dim_16,dim_17,dim_18,dim_19,dim_20,dim_21,dim_22,dim_23,dim_24,dim_25,dim_26,dim_27,dim_28,dim_29,dim_30,dim_31
2+
16720766,1.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.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