-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TESTS: configure codecov, add tests for directory initialization and …
…probability calculations (#2)
- Loading branch information
1 parent
96cf348
commit 20af783
Showing
11 changed files
with
161 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[run] | ||
source = | ||
ChemSpaceAL/InitializeWorkspace.py | ||
|
||
omit = | ||
ChemSpaceAL/Model.py | ||
ChemSpaceAL/Dataset.py | ||
ChemSpaceAL/Docking.py | ||
ChemSpaceAL/Generation.py | ||
ChemSpaceAL/Training.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
numpy==1.24.3 | ||
pandas==1.5.3 | ||
prolif==2.0.1 | ||
scikit_learn==1.3.2 | ||
PyYAML | ||
rdkit==2023.3.1 | ||
scikit_learn==1.3.2 | ||
torch | ||
tqdm==4.64.1 | ||
wandb==0.15.4 | ||
wandb==0.15.4 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from ..ALConstruction import _preprocess_scores_linearly, _preprocess_scores_softmax | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"scores, do_negation, expected", | ||
[ | ||
( | ||
{1: 2, 2: 2, 3: 2}, | ||
False, | ||
{1: 1 / 3, 2: 1 / 3, 3: 1 / 3}, | ||
), | ||
( | ||
{1: 1, 2: 0, 3: 0}, | ||
False, | ||
{1: 1, 2: 0, 3: 0}, | ||
), | ||
({}, False, {}), | ||
( | ||
{1: 0, 2: -2, 3: -2}, | ||
True, | ||
{1: 0, 2: 0.5, 3: 0.5}, | ||
), | ||
], | ||
) | ||
def test_preprocess_scores_linearly(scores, do_negation, expected): | ||
result = _preprocess_scores_linearly(scores, do_negation) | ||
for k, v in expected.items(): | ||
assert result[k] == pytest.approx(v) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"scores, do_negation, divide, divide_factor, expected", | ||
[ | ||
( | ||
{1: 2, 2: 2, 3: 2}, | ||
False, | ||
False, | ||
None, | ||
{1: 1 / 3, 2: 1 / 3, 3: 1 / 3}, | ||
), | ||
( | ||
{1: 1, 2: 0, 3: 0}, | ||
False, | ||
False, | ||
None, | ||
{1: 0.5761168847658291, 2: 0.21194155761708544, 3: 0.21194155761708544}, | ||
), | ||
( | ||
{1: 1, 2: 0, 3: 0}, | ||
False, | ||
True, | ||
0.5, | ||
{1: 0.7869860421615985, 2: 0.10650697891920075, 3: 0.10650697891920075}, | ||
), | ||
( | ||
{1: -1, 2: -1, 3: 0}, | ||
True, | ||
True, | ||
0.5, | ||
{1: 0.4683105308334812, 2: 0.4683105308334812, 3: 0.06337893833303762}, | ||
), | ||
], | ||
) | ||
def test_preprocess_scores_softmax( | ||
scores, do_negation, divide, divide_factor, expected | ||
): | ||
result = _preprocess_scores_softmax(scores, do_negation, divide, divide_factor) | ||
for k, v in expected.items(): | ||
assert result[k] == pytest.approx(v) | ||
|
||
|
||
def test_preprocess_scores_softmax_exception(): | ||
with pytest.raises(AssertionError): | ||
_preprocess_scores_softmax({1: 2, 2: 3, 3: 4}, False, True, None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
import tempfile | ||
from unittest.mock import patch | ||
from .. import InitializeWorkspace as iw | ||
|
||
|
||
def test_create_default_folders(): | ||
# Using a temporary directory for testing | ||
with tempfile.TemporaryDirectory() as tempdir: | ||
iw.create_folders(base_path=tempdir) | ||
|
||
# Check if the main folders are created | ||
assert os.path.exists(os.path.join(tempdir, "1_Pretraining")) | ||
assert os.path.exists(os.path.join(tempdir, "2_Generation")) | ||
|
||
# Check if subfolders are created | ||
assert os.path.exists(os.path.join(tempdir, "1_Pretraining", "datasets")) | ||
# ... (add more assertions for other subfolders) | ||
assert isinstance(iw.FOLDER_STRUCTURE, dict) | ||
|
||
|
||
@patch("builtins.input", return_value="Y") | ||
def test_create_folders_without_base_path(mock_input): | ||
with tempfile.TemporaryDirectory() as tempdir: | ||
os.chdir(tempdir) # Change working directory | ||
iw.create_folders() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
# ChemSpaceAL | ||
ChemSpaceAL: An Efficient Active Learning Methodology Applied to Protein- Specific Molecular Generation | ||
======================================= | ||
|
||
## An Efficient Active Learning Methodology Applied to Protein- Specific Molecular Generation | ||
|
||
<p align="center"> | ||
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a> | ||
</p> | ||
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/) | ||
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) | ||
[![codecov](https://codecov.io/gh/batistagroup/ChemSpaceAL/graph/badge.svg?token=ROJSISYJWC)](https://codecov.io/gh/batistagroup/ChemSpaceAL) | ||
|
||
![A description of the active learning methodology](media/toc_figure.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
coverage: | ||
precision: 2 | ||
round: down | ||
range: "0...90" | ||
|
||
status: | ||
project: yes | ||
patch: yes | ||
changes: no | ||
|
||
comment: | ||
layout: "header, diff, components" | ||
|
||
component_management: | ||
default_rules: | ||
statuses: | ||
- type: patch | ||
target: auto | ||
individual_components: | ||
- component_id: module_iw | ||
name: InitializeWorkspace | ||
paths: | ||
- "ChemSpaceAL/InitializeWorkspace.py" | ||
- component_id: module_al_construct | ||
name: AL Training Set Construction | ||
paths: | ||
- "ChemSpaceAL/ALConstruction.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.