Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
239ee33
fixed mypy and added better type annotations
picciama Oct 17, 2024
ee8ca21
fixed mypy in datasets subfolder
picciama Oct 17, 2024
309c07e
speed up tests and use worker with more memory
PascalIversen Oct 30, 2024
51de205
merge
PascalIversen Oct 30, 2024
517ac6b
merge
PascalIversen Oct 30, 2024
34027ce
speed up tests by reducing ds size drastically
PascalIversen Oct 30, 2024
79b65da
speed up moli superfelt
PascalIversen Oct 30, 2024
45884e9
tests
PascalIversen Oct 30, 2024
4a05549
Update test_run_suite.py
PascalIversen Oct 30, 2024
6cadd1d
catching empty prediction datasets
PascalIversen Oct 31, 2024
a014fe2
black
PascalIversen Oct 31, 2024
4b41406
catch emtpry training datasets in superfelt
PascalIversen Nov 1, 2024
6946c22
molir fix empty train data
PascalIversen Nov 3, 2024
0d13f31
Merge branch 'development' of github.com:daisybio/drevalpy into devel…
JudithBernett Nov 4, 2024
7dac3d1
[DEPENDABOT]: Bump crazy-max/ghaction-github-labeler from 5.0.0 to 5.1.0
dependabot[bot] Nov 4, 2024
e84e624
[DEPENDABOT]: Bump pypa/gh-action-pypi-publish from 1.4.2 to 1.11.0
dependabot[bot] Nov 4, 2024
7d9d436
New Model: DIPK
reinej03 Nov 5, 2024
d715821
fixing bugs for when training data is too small/non-existent
JudithBernett Nov 7, 2024
cf4feca
github action should only run on pull request
JudithBernett Nov 7, 2024
1593bf3
Merge pull request #64 from daisybio/datasetloader
JudithBernett Nov 7, 2024
1a37855
Merge branch 'development' of github.com:daisybio/drevalpy into devel…
JudithBernett Nov 7, 2024
d2e9553
Merge pull request #66 from daisybio/dependabot/github_actions/develo…
JudithBernett Nov 7, 2024
089e56c
Merge pull request #67 from daisybio/dependabot/github_actions/develo…
JudithBernett Nov 7, 2024
8f2fa63
Merge branch 'development' of github.com:daisybio/drevalpy into devel…
JudithBernett Nov 7, 2024
2cdaaae
Merge pull request #68 from reinej03/development
JudithBernett Nov 7, 2024
d9a02a5
new poetry lock
JudithBernett Nov 7, 2024
35c5f25
trying to fix python-package.yml
JudithBernett Nov 7, 2024
c829e64
trying to fix python-package.yml
JudithBernett Nov 7, 2024
3b04cf4
fixing all flake8 errors: still TODO: drevalpy/experiment.py, drevalp…
JudithBernett Nov 7, 2024
b3ecf04
merge
PascalIversen Nov 8, 2024
fa419dd
model description and some imports
PascalIversen Nov 8, 2024
c96d9d2
flake8 stuff fixed dipk
PascalIversen Nov 8, 2024
5f1cdb0
refactoring
PascalIversen Nov 8, 2024
7d46356
fixed flake8 errors for all of drevalpy/
JudithBernett Nov 8, 2024
620b193
refractoring, avoiding duplications
PascalIversen Nov 8, 2024
3382cac
refractoring and name changes
PascalIversen Nov 8, 2024
2248b96
fixed flake8 errors for everything
JudithBernett Nov 8, 2024
19205c0
fixed whole pre-commit
JudithBernett Nov 8, 2024
2acf3e2
merge etc
PascalIversen Nov 10, 2024
71b30b5
mypy drp_model
PascalIversen Nov 11, 2024
0cb8ee5
ignoring a ray-related security issue
JudithBernett Nov 11, 2024
816acf2
types DS
PascalIversen Nov 11, 2024
e42a75a
towards experiments
PascalIversen Nov 11, 2024
d1f8c56
fixed typeguard errors
JudithBernett Nov 11, 2024
afa9dda
towards exp
PascalIversen Nov 11, 2024
31f230b
Merge branch 'typing' into typeguard_fix
JudithBernett Nov 11, 2024
8eb5f6a
minor fixes for precommmit and typeguard
JudithBernett Nov 11, 2024
e3c5978
loade
PascalIversen Nov 11, 2024
5699f6b
merge
PascalIversen Nov 11, 2024
a98729e
fix stupid
PascalIversen Nov 11, 2024
6f1aac7
Merge branch 'typeguard_fix' of github.com:daisybio/drevalpy into typ…
JudithBernett Nov 11, 2024
deb6d92
fixing pre-commit and typeguard errors
JudithBernett Nov 11, 2024
375bbed
trying to fix windows mistake
JudithBernett Nov 11, 2024
df8a3e9
pre commit
PascalIversen Nov 11, 2024
2ad7a5d
merge
PascalIversen Nov 11, 2024
7ea8560
trying to fix windows and mac mistake
JudithBernett Nov 11, 2024
9f059e0
Merge remote-tracking branch 'origin/typeguard_fix' into typeguard_fix
JudithBernett Nov 11, 2024
c223f3f
still fixing windows mistake
JudithBernett Nov 11, 2024
ded5880
[DEPENDABOT]: Bump pypa/gh-action-pypi-publish from 1.11.0 to 1.12.2
dependabot[bot] Nov 11, 2024
4b0a836
trying to fix mac mistake and typeguard error
JudithBernett Nov 12, 2024
459fb4c
Merge pull request #71 from daisybio/dependabot/github_actions/develo…
JudithBernett Nov 12, 2024
e6fe39a
Merge branch 'development' of github.com:daisybio/drevalpy into devel…
JudithBernett Nov 12, 2024
b9494dc
Merge branch 'development' into typeguard_fix
JudithBernett Nov 12, 2024
0f7a7b0
trying to fix mac mistake
JudithBernett Nov 12, 2024
ab00f44
cancelling mac test because there is a bug on macos-13 and macos-late…
JudithBernett Nov 12, 2024
8d1d429
Fixing typeguard bugs in MOLIR, SuperFELTR
JudithBernett Nov 12, 2024
984c21d
mypy
PascalIversen Nov 12, 2024
2d915e9
fixing typeguard errors for MOLIR and SuperFELTR
JudithBernett Nov 12, 2024
baa6639
Merge pull request #70 from daisybio/typeguard_fix
JudithBernett Nov 12, 2024
d7580e3
fixed mypy errors in visualization
JudithBernett Nov 12, 2024
f8e9117
fixed mypy errors in tests
JudithBernett Nov 12, 2024
b84c016
fixed mypy errors in datasefixed mypy errors in dataset
JudithBernett Nov 12, 2024
aa2d773
merge
PascalIversen Nov 12, 2024
000ca4b
merge
PascalIversen Nov 12, 2024
9b90730
fixed error in test
JudithBernett Nov 12, 2024
9fa1a0e
Merge branch 'mypy_fix' of github.com:daisybio/drevalpy into mypy_fix
JudithBernett Nov 12, 2024
14a0396
experiment
PascalIversen Nov 12, 2024
2f29309
fixed mypy errors for baseline models
JudithBernett Nov 12, 2024
49f4839
Merge branch 'mypy_fix' of github.com:daisybio/drevalpy into mypy_fix
JudithBernett Nov 12, 2024
4d3f2d4
accidentally broke naivepredictors
JudithBernett Nov 12, 2024
067a876
classmethod
PascalIversen Nov 12, 2024
550906f
experiment.py without iossue
PascalIversen Nov 12, 2024
77a27b7
fixing tests
PascalIversen Nov 12, 2024
995aeed
remove str and none type
PascalIversen Nov 12, 2024
ef61be4
mypy simple nn
PascalIversen Nov 12, 2024
f7b29b6
simplify model_name
PascalIversen Nov 13, 2024
2540052
no implicit optional
PascalIversen Nov 13, 2024
80d90f7
remove unused classproperty
PascalIversen Nov 13, 2024
1a6c14c
comment abstract model name
PascalIversen Nov 13, 2024
d45ee6e
removed unnecessary init in drp_model, added types-pyyaml to developm…
JudithBernett Nov 13, 2024
8b40ffa
Merge branch 'mypy_fix' of github.com:daisybio/drevalpy into mypy_fix
JudithBernett Nov 13, 2024
c66ef74
Fixed mypy errors for models/
JudithBernett Nov 14, 2024
59faaff
all mypy errors should be fixed!
JudithBernett Nov 14, 2024
25f1f47
I don't understand why old commits are tested in the pull request
JudithBernett Nov 14, 2024
9fe6f88
limiting sphinx-rtd-theme because apparently, it's a problem. Also, f…
JudithBernett Nov 14, 2024
3afdf81
Merge pull request #72 from daisybio/mypy_fix
JudithBernett Nov 14, 2024
7d465b8
Merge branch 'development' of github.com:daisybio/drevalpy into devel…
JudithBernett Nov 14, 2024
be6ebe3
Merge branch 'development' into dipk
JudithBernett Nov 14, 2024
0634848
Fixed flake8 and mypy errors for DIPK
JudithBernett Nov 14, 2024
c99445e
adjusted test for model factory
JudithBernett Nov 14, 2024
ae8ef05
added CODECOV_TOKEN
JudithBernett Nov 15, 2024
3743530
fixed formatting
picciama Nov 15, 2024
d8fadfd
added types-pyyaml
picciama Nov 15, 2024
2ac2c98
intermediate mypy fix
picciama Nov 15, 2024
584ee5e
Merge branch 'development' into chore/setup-mypy
picciama Nov 15, 2024
cd88de7
fixed mypy
picciama Nov 15, 2024
885c9e5
fixed load function changed to from_csv
picciama Nov 15, 2024
015b022
fix plural column names to singular
picciama Nov 15, 2024
22ca828
use from_csv to load dataset
picciama Nov 15, 2024
4240f87
Merge pull request #73 from daisybio/chore/setup-mypy
JudithBernett Nov 18, 2024
8bfcf83
dipk autoencoder
PascalIversen Nov 18, 2024
8e963fa
removed unneccessary main statements from tests, included creation of…
JudithBernett Nov 18, 2024
7e09393
Merge branch 'dipk' of github.com:daisybio/drevalpy into dipk
JudithBernett Nov 18, 2024
e06a130
gene expression encoder
PascalIversen Nov 18, 2024
a267f8d
gene expression encoder
PascalIversen Nov 18, 2024
d091a70
fix
PascalIversen Nov 18, 2024
3498c4f
towards bionic features, but they currently are all zeros??
PascalIversen Nov 18, 2024
907e929
[DEPENDABOT]: Bump codecov/codecov-action from 4.6.0 to 5.0.2
dependabot[bot] Nov 18, 2024
230d1e3
[DEPENDABOT]: Bump sphinx-rtd-theme from 3.0.1 to 3.0.2
dependabot[bot] Nov 18, 2024
c07c591
Merge branch 'dipk' of github.com:daisybio/drevalpy into dipk
JudithBernett Nov 19, 2024
2d9f7f9
Merge pull request #74 from daisybio/dependabot/github_actions/develo…
JudithBernett Nov 19, 2024
87ea9fd
Merge pull request #75 from daisybio/dependabot/pip/development/sphin…
JudithBernett Nov 19, 2024
8b9f6f3
Merge branch 'development' of github.com:daisybio/drevalpy into devel…
JudithBernett Nov 19, 2024
b0ce932
Merge branch 'development' into dipk, updating dependencies
JudithBernett Nov 19, 2024
15f3410
updated requirements.txt and poetry lock
JudithBernett Nov 19, 2024
3837795
updated requirements.txt for docs
JudithBernett Nov 19, 2024
ff011a4
bionic works
PascalIversen Nov 19, 2024
8c1b1c9
merge
PascalIversen Nov 19, 2024
1ac9d65
Merge branch 'dipk' of github.com:daisybio/drevalpy into dipk
JudithBernett Nov 19, 2024
0412c1e
autoencoder
PascalIversen Nov 19, 2024
b096387
fix features
PascalIversen Nov 19, 2024
42a659c
fix features
PascalIversen Nov 19, 2024
eacba41
Merge branch 'dipk' of github.com:daisybio/drevalpy into dipk
JudithBernett Nov 19, 2024
7366a7d
hpams
PascalIversen Nov 19, 2024
3fc4f0d
towards removing pytorch geometric bc it is super unnecessary and pro…
PascalIversen Nov 19, 2024
03ddc49
added Dockerfile which installs drevalpy from source
JudithBernett Nov 19, 2024
a0c1c8a
still not working
PascalIversen Nov 19, 2024
8a03e3b
fixed attention and improved feature loading
PascalIversen Nov 20, 2024
6848690
name change test
PascalIversen Nov 20, 2024
5f18481
created a github action for publishing the docker image to ghcr.io
JudithBernett Nov 20, 2024
5ebad71
tests etc
PascalIversen Nov 20, 2024
c3d5149
tests and hpam fixes
PascalIversen Nov 20, 2024
c635aed
fix tests
PascalIversen Nov 20, 2024
b236bd3
typing
PascalIversen Nov 20, 2024
73c7c03
mypy
PascalIversen Nov 20, 2024
df425ba
type
PascalIversen Nov 20, 2024
a09a4b2
mypy happy?
PascalIversen Nov 20, 2024
7486ec2
test names
PascalIversen Nov 20, 2024
ca19aad
added some verbose to training
PascalIversen Nov 20, 2024
af28a34
I love mypy! <3
PascalIversen Nov 20, 2024
eac5b88
fix print
PascalIversen Nov 20, 2024
b14dec4
early stopping
PascalIversen Nov 20, 2024
cad592c
mypy es
PascalIversen Nov 20, 2024
1c6bc4f
fix es
PascalIversen Nov 20, 2024
c614d10
Merge pull request #69 from daisybio/dipk
JudithBernett Nov 20, 2024
1579b37
Merge branch 'development' of github.com:daisybio/drevalpy into devel…
JudithBernett Nov 20, 2024
8b919a7
Merge branch 'development' into docker
JudithBernett Nov 20, 2024
01e9f43
possibly fixed the python-package action
JudithBernett Nov 21, 2024
c0d2c96
do I have to import the package in conf.py?
JudithBernett Nov 21, 2024
f3b417e
do I have to add -e . to the requirements.txt?
JudithBernett Nov 21, 2024
409597a
I think the badges were wrong
JudithBernett Nov 21, 2024
34627ce
Merge pull request #79 from daisybio/docker
JudithBernett Nov 21, 2024
9006677
Merge branch 'development' of github.com:daisybio/drevalpy into devel…
JudithBernett Nov 21, 2024
a13dea0
there was a wrong line break in the python-package.yml
JudithBernett Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
uses: actions/checkout@v4

- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v5.0.0
uses: crazy-max/ghaction-github-labeler@v5.1.0
with:
skip-delete: true
64 changes: 64 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Create and publish a Docker image

# Configures this workflow to run every time a release is published
on:
release:
types: [published]

# Defines two custom environment variables for the workflow.
# These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest

# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
# Necessary for buildx
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup QEMU
uses: docker/setup-qemu-action@v3

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
24 changes: 17 additions & 7 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,32 @@ jobs:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
- name: Check out the repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
pipx install poetry
poetry --version

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
poetry install --with development

- name: Build package
run: poetry build --ansi

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore W503
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore W503,D212
- name: Test with pytest
run: |
pytest
poetry run pytest
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
7 changes: 3 additions & 4 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Run drevalpy Tests
on:
push:
branches:
- development
- main
- "release/*"
pull_request:
branches:
Expand All @@ -23,7 +21,6 @@ jobs:
- { python-version: "3.10", os: ubuntu-latest, session: "mypy" }
- { python-version: "3.10", os: ubuntu-latest, session: "tests" }
- { python-version: "3.10", os: windows-latest, session: "tests" }
- { python-version: "3.10", os: macos-latest, session: "tests" }
- { python-version: "3.10", os: ubuntu-latest, session: "typeguard" }
- { python-version: "3.10", os: ubuntu-latest, session: "xdoctest" }
- { python-version: "3.10", os: ubuntu-latest, session: "docs-build" }
Expand Down Expand Up @@ -130,4 +127,6 @@ jobs:
run: nox --force-color --session=coverage -- xml -i

- name: Upload coverage report
uses: codecov/codecov-action@v4.6.0
uses: codecov/codecov-action@v5.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repos:
types: [python]
require_serial: true
args:
- --ignore=W503
- --ignore=D212,W503,C901
- id: pyupgrade
name: pyupgrade
description: Automatically upgrade syntax for newer versions.
Expand Down
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# I followed this article's recommendations
# https://medium.com/@albertazzir/blazing-fast-python-docker-builds-with-poetry-a78a66f5aed0

# The builder image, used to build the virtual environment
FROM python:3.10-buster as builder

RUN pip install poetry==1.8.4

# POETRY_VIRTUALENVS_CREATE=1: Makes sure that environment will be as isolated as possible and above all that
# installation will not mess up with the system Python or, even worse, with Poetry itself.
# POETRY_CACHE_DIR: When removing the cache folder, make sure this is done in the same RUN command. If it’s done in a
# separate RUN command, the cache will still be part of the previous Docker layer (the one containing poetry install )
# effectively rendering your optimization useless.

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

WORKDIR /root

COPY pyproject.toml poetry.lock ./

# First, we install only the dependencies. This way, we can cache this layer and avoid re-installing dependencies
# every time we change our application code.
# Because poetry will complain if a README.md is not found, we create a dummy one.
RUN touch README.md

RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR

# The runtime image, used to run the code
FROM python:3.10-slim-buster as runtime

LABEL image.author.name="Judith Bernett"
LABEL image.author.email="judith.bernett@tum.de"

ENV VIRTUAL_ENV=/root/.venv \
PATH="/root/.venv/bin:$PATH"

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}

# Copy all relevant code

COPY drevalpy ./drevalpy
COPY create_report.py ./
COPY README.md ./
COPY run_suite.py ./
COPY setup.py ./
COPY pyproject.toml ./
COPY poetry.lock ./

# Install drevalpy
RUN pip install .
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pip install drevalpy
From Source:

```bash
conda env create -f models/simple_neural_network/env.yml
conda env create -f models/SimpleNeuralNetwork/env.yml
pip install .
```

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ DrEvalPy: Python Cancer Cell Line Drug Response Prediction Suite
.. |Read the Docs| image:: https://img.shields.io/readthedocs/drevalpy/latest.svg?label=Read%20the%20Docs
:target: https://drevalpy.readthedocs.io/
:alt: Read the documentation at https://drevalpy.readthedocs.io/
.. |Build| image:: https://github.com/daisybio/drevalpy/workflows/Build%20drevalpy%20Package/badge.svg
.. |Build| image:: https://github.com/daisybio/drevalpy/actions/workflows/build_package.yml/badge.svg
:target: https://github.com/daisybio/drevalpy/actions?workflow=Package
:alt: Build Package Status
.. |Tests| image:: https://github.com/daisybio/drevalpy/workflows/Run%20drevalpy%20Tests/badge.svg
.. |Tests| image:: https://github.com/daisybio/drevalpy/actions/workflows/run_tests.yml/badge.svg
:target: https://github.com/daisybio/drevalpy/actions?workflow=Tests
:alt: Run Tests Status
.. |Codecov| image:: https://codecov.io/gh/daisybio/drevalpy/branch/main/graph/badge.svg
Expand Down
Empty file removed configs/CCLE.yaml
Empty file.
37 changes: 0 additions & 37 deletions configs/GDSC.yaml

This file was deleted.

71 changes: 46 additions & 25 deletions create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import argparse
import os

import pandas as pd

from drevalpy.visualization import (
CorrelationComparisonScatter,
CriticalDifferencePlot,
Expand All @@ -14,8 +16,10 @@
from drevalpy.visualization.utils import create_html, create_index_html, parse_results, prep_results, write_results


def create_output_directories(custom_id):
"""If they do not exist yet, make directories for the visualization files.
def create_output_directories(custom_id: str) -> None:
"""
If they do not exist yet, make directories for the visualization files.

:param custom_id: run id passed via command line
"""
os.makedirs(f"results/{custom_id}/violin_plots", exist_ok=True)
Expand All @@ -26,13 +30,22 @@ def create_output_directories(custom_id):
os.makedirs(f"results/{custom_id}/critical_difference_plots", exist_ok=True)


def draw_setting_plots(lpo_lco_ldo, ev_res, ev_res_per_drug, ev_res_per_cell_line, custom_id):
"""Draw all plots for a specific setting (LPO, LCO, LDO).
def draw_setting_plots(
lpo_lco_ldo: str,
ev_res: pd.DataFrame,
ev_res_per_drug: pd.DataFrame,
ev_res_per_cell_line: pd.DataFrame,
custom_id: str,
) -> list[str]:
"""
Draw all plots for a specific setting (LPO, LCO, LDO).

:param lpo_lco_ldo: setting
:param ev_res: overall evaluation results
:param ev_res_per_drug: evaluation results per drug
:param ev_res_per_cell_line: evaluation results per cell line
:param custom_id: run id passed via command line
:returns: list of unique algorithms
"""
ev_res_subset = ev_res[ev_res["LPO_LCO_LDO"] == lpo_lco_ldo]
# PIPELINE: SAVE_TABLES
Expand Down Expand Up @@ -99,8 +112,12 @@ def draw_setting_plots(lpo_lco_ldo, ev_res, ev_res_per_drug, ev_res_per_cell_lin
return eval_results_preds["algorithm"].unique()


def draw_per_grouping_setting_plots(grouping, ev_res_per_group, lpo_lco_ldo, custom_id):
"""Draw plots for a specific grouping (drug or cell line) for a specific setting (LPO, LCO, LDO).
def draw_per_grouping_setting_plots(
grouping: str, ev_res_per_group: pd.DataFrame, lpo_lco_ldo: str, custom_id: str
) -> None:
"""
Draw plots for a specific grouping (drug or cell line) for a specific setting (LPO, LCO, LDO).

:param grouping: drug or cell_line
:param ev_res_per_group: evaluation results per drug or per cell line
:param lpo_lco_ldo: setting
Expand Down Expand Up @@ -132,15 +149,17 @@ def draw_per_grouping_setting_plots(grouping, ev_res_per_group, lpo_lco_ldo, cus


def draw_algorithm_plots(
model,
ev_res,
ev_res_per_drug,
ev_res_per_cell_line,
t_vs_p,
lpo_lco_ldo,
custom_id,
):
"""Draw all plots for a specific algorithm.
model: str,
ev_res: pd.DataFrame,
ev_res_per_drug: pd.DataFrame,
ev_res_per_cell_line: pd.DataFrame,
t_vs_p: pd.DataFrame,
lpo_lco_ldo: str,
custom_id: str,
) -> None:
"""
Draw all plots for a specific algorithm.

:param model: name of the model/algorithm
:param ev_res: overall evaluation results
:param ev_res_per_drug: evaluation results per drug
Expand Down Expand Up @@ -194,15 +213,17 @@ def draw_algorithm_plots(


def draw_per_grouping_algorithm_plots(
grouping_slider,
grouping_scatter_table,
model,
ev_res_per_group,
t_v_p,
lpo_lco_ldo,
custom_id,
grouping_slider: str,
grouping_scatter_table: str,
model: str,
ev_res_per_group: pd.DataFrame,
t_v_p: pd.DataFrame,
lpo_lco_ldo: str,
custom_id: str,
):
"""Draw plots for a specific grouping (drug or cell line) for a specific algorithm.
"""
Draw plots for a specific grouping (drug or cell line) for a specific algorithm.

:param grouping_slider: the grouping variable for the regression plots
:param grouping_scatter_table: the grouping variable for the scatter plots.
If grouping_slider is drug, this should be cell_line and vice versa
Expand Down Expand Up @@ -320,8 +341,8 @@ def draw_per_grouping_algorithm_plots(
custom_id=run_id,
)
# get all html files from results/{run_id}
all_files = []
for _, _, files in os.walk(f"results/{run_id}"):
all_files: list[str] = []
for _, _, files in os.walk(f"results/{run_id}"): # type: ignore[assignment]
for file in files:
if file.endswith(".html") and file not in ["index.html", "LPO.html", "LCO.html", "LDO.html"]:
all_files.append(file)
Expand Down
Loading