From 071f20b4f369331ee4ccafec138897ac62bc90e8 Mon Sep 17 00:00:00 2001 From: Kohulan Date: Mon, 13 Jan 2025 14:33:22 +0100 Subject: [PATCH 1/3] feat: upgrade to CDK 2.10 --- .github/workflows/test.yml | 4 ---- app/modules/toolkits/cdk_wrapper.py | 2 +- tests/test_classyfire.py | 8 +++++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a4f6b55..4d5b15e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,10 +31,6 @@ jobs: python -m pip install --upgrade pip pip3 install --upgrade setuptools pip pip3 install --no-cache-dir -r requirements.txt - pip3 install rdkit - python3 -m pip uninstall -y imantics - pip3 install imantics==0.1.12 - pip3 install openbabel-wheel pip3 install --no-deps decimer-segmentation==1.1.3 pip3 install --no-deps decimer==2.3.0 pip3 install --no-deps STOUT-pypi==2.0.5 diff --git a/app/modules/toolkits/cdk_wrapper.py b/app/modules/toolkits/cdk_wrapper.py index 6f2e9ba..c33704f 100644 --- a/app/modules/toolkits/cdk_wrapper.py +++ b/app/modules/toolkits/cdk_wrapper.py @@ -28,7 +28,7 @@ def setup_jvm(): if not isJVMStarted(): paths = { - "cdk-2.9": "https://github.com/cdk/cdk/releases/download/cdk-2.9/cdk-2.9.jar", + "cdk-2.10": "https://github.com/cdk/cdk/releases/download/cdk-2.10/cdk-2.10.jar", "SugarRemovalUtility-jar-with-dependencies": "https://github.com/JonasSchaub/SugarRemoval/releases/download/v1.3.2/SugarRemovalUtility-jar-with-dependencies.jar", "centres": "https://github.com/SiMolecule/centres/releases/download/1.0/centres.jar", "opsin-cli-2.8.0-jar-with-dependencies": "https://github.com/dan2097/opsin/releases/download/2.8.0/opsin-cli-2.8.0-jar-with-dependencies.jar", diff --git a/tests/test_classyfire.py b/tests/test_classyfire.py index 263d3c1..1ae6663 100644 --- a/tests/test_classyfire.py +++ b/tests/test_classyfire.py @@ -1,4 +1,3 @@ -""" import pytest from app.modules.classyfire import classify, result import asyncio @@ -19,7 +18,11 @@ def test_valid_classyfire(valid_smiles): result_ = loop.run_until_complete(classify(valid_smiles)) assert result_["query_type"] == "STRUCTURE" id_ = result_["id"] - classified = loop.run_until_complete(result(id_)) + while True: + classified = loop.run_until_complete(result(id_)) + if classified["classification_status"] == "Done": + break + asyncio.run(asyncio.sleep(2)) assert classified["classification_status"] == "Done" assert classified["entities"][0]["class"]["name"] == "Imidazopyrimidines" @@ -35,4 +38,3 @@ def test_invalid_classyfire(invalid_smiles): classified["invalid_entities"][0]["report"][0] == "Cannot process the input SMILES string, please check again" ) -""" From c9c488310d1128b05be2fccce4df85859d07433a Mon Sep 17 00:00:00 2001 From: Kohulan Date: Mon, 13 Jan 2025 14:47:44 +0100 Subject: [PATCH 2/3] fix: classyfire test --- tests/test_classyfire.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_classyfire.py b/tests/test_classyfire.py index 1ae6663..185c638 100644 --- a/tests/test_classyfire.py +++ b/tests/test_classyfire.py @@ -32,7 +32,11 @@ def test_invalid_classyfire(invalid_smiles): result_ = loop.run_until_complete(classify(invalid_smiles)) assert result_["query_input"] == "invalid_smiles" id_ = result_["id"] - classified = loop.run_until_complete(result(id_)) + while True: + classified = loop.run_until_complete(result(id_)) + if classified["classification_status"] == "Done": + break + asyncio.run(asyncio.sleep(2)) assert classified["classification_status"] == "Done" assert ( classified["invalid_entities"][0]["report"][0] From f2074011fc7c3a4c6f1986abaebafb4ca37da134 Mon Sep 17 00:00:00 2001 From: Kohulan Date: Mon, 13 Jan 2025 14:58:49 +0100 Subject: [PATCH 3/3] fix: functions test --- .github/workflows/test.yml | 2 +- tests/test_functions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4d5b15e..344ce26 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: API workflow +name: test on: push: diff --git a/tests/test_functions.py b/tests/test_functions.py index 1bee37f..e7db5e2 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -158,7 +158,7 @@ def test_all_rdkit_descriptors(test_smiles_descriptors): 0, 1.0, 0, - 62.12, + 61.98, ) assert expected_result == descriptors