Skip to content

Commit

Permalink
Merge pull request #221 from mims-harvard/avelez-dev
Browse files Browse the repository at this point in the history
Conda tests via GH Actions
  • Loading branch information
amva13 authored Feb 24, 2024
2 parents ddb4f2e + 973accd commit 048e975
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/conda-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions

name: Build Conda Environment And Run Python Tests

on:
push:
branches:
- main
- avelez-dev
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4

- name: Set up Python version
uses: actions/setup-python@v1
with:
python-version: '3.9'

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: bioconda, conda-forge, defaults
use-only-tar-bz2: true
auto-update-conda: true
auto-activate-base: true

- name: Create and start Conda environment. Run tests.
run: |
echo "Creating Conda Environment from environment.yml"
conda env create -f environment.yml
conda activate tdc-conda-env
python run_tests.py
conda deactivate
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ dependencies:
- python=3.9.13
- pip=23.3.1
- pandas=2.1.4
- rdkit=2023.9.5
- requests=2.31.0
- scikit-learn=1.3.0
- seaborn=0.12.2
- tqdm=4.65.0
- pip:
- cellxgene-census==1.10.2
- PyTDC==0.4.1
- rdkit==2023.9.5
9 changes: 9 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import unittest

if __name__ == '__main__':
loader = unittest.TestLoader()
start_dir = 'tdc/test'
suite = loader.discover(start_dir)

runner = unittest.TextTestRunner()
runner.run(suite)
2 changes: 2 additions & 0 deletions tdc/test/dev_tests/chem_utils_test/test_molconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def setUp(self):
print(os.getcwd())
pass

@unittest.skip("dev test")
def test_MolConvert(self):
from tdc.chem_utils import MolConvert

Expand All @@ -34,6 +35,7 @@ def test_MolConvert(self):

MolConvert.eligible_format()

# @unittest.skip("dev test")
def tearDown(self):
print(os.getcwd())

Expand Down
2 changes: 2 additions & 0 deletions tdc/test/dev_tests/chem_utils_test/test_molfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ def setUp(self):
print(os.getcwd())
pass

@unittest.skip("dev test")
def test_MolConvert(self):
from tdc.chem_utils import MolFilter

filters = MolFilter(filters=["PAINS"], HBD=[0, 6])
filters(["CCSc1ccccc1C(=O)Nc1onc2c1CCC2"])

# @unittest.skip("dev test")
def tearDown(self):
print(os.getcwd())

Expand Down
2 changes: 2 additions & 0 deletions tdc/test/dev_tests/chem_utils_test/test_oracles.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def setUp(self):
print(os.getcwd())
pass

@unittest.skip("dev test")
def test_Oracle(self):
from tdc import Oracle

Expand All @@ -34,6 +35,7 @@ def test_Oracle(self):
oracle = Oracle(name="Hop")
x = oracle(["CC(=O)OC1=CC=CC=C1C(=O)O", "C1=CC=C(C=C1)C=O"])

@unittest.skip("dev test")
def test_distribution(self):
from tdc import Evaluator

Expand Down
7 changes: 7 additions & 0 deletions tdc/test/dev_tests/utils_tests/test_misc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def setUp(self):
print(os.getcwd())
pass

@unittest.skip("dev test")
def test_neg_sample(self):
from tdc.multi_pred import PPI

Expand All @@ -30,6 +31,7 @@ def test_neg_sample(self):
# data = ADME(name='Caco2_Wang')
# x = data.label_distribution()

@unittest.skip("dev test")
def test_get_label_map(self):
from tdc.multi_pred import DDI
from tdc.utils import get_label_map
Expand All @@ -38,22 +40,26 @@ def test_get_label_map(self):
split = data.get_split()
get_label_map(name="DrugBank", task="DDI")

@unittest.skip("dev test")
def test_balanced(self):
from tdc.single_pred import HTS

data = HTS(name="SARSCoV2_3CLPro_Diamond")
data.balanced(oversample=True, seed=42)

@unittest.skip("dev test")
def test_cid2smiles(self):
from tdc.utils import cid2smiles

smiles = cid2smiles(2248631)

@unittest.skip("dev test")
def test_uniprot2seq(self):
from tdc.utils import uniprot2seq

seq = uniprot2seq("P49122")

@unittest.skip("dev test")
def test_to_graph(self):
from tdc.multi_pred import DTI

Expand Down Expand Up @@ -87,6 +93,7 @@ def test_to_graph(self):
)
# output: {'pyg_graph': the PyG graph object, 'index_to_entities': a dict map from ID in the data to node ID in the PyG object, 'split': {'train': df, 'valid': df, 'test': df}}

# @unittest.skip("dev test")
def tearDown(self):
print(os.getcwd())

Expand Down
6 changes: 6 additions & 0 deletions tdc/test/dev_tests/utils_tests/test_splits.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ def setUp(self):
print(os.getcwd())
pass

@unittest.skip("dev test")
def test_random_split(self):
from tdc.single_pred import ADME

data = ADME(name="Caco2_Wang")
split = data.get_split(method="random")

@unittest.skip("dev test")
def test_scaffold_split(self):
## requires RDKit
from tdc.single_pred import ADME

data = ADME(name="Caco2_Wang")
split = data.get_split(method="scaffold")

@unittest.skip("dev test")
def test_cold_start_split(self):
from tdc.multi_pred import DTI

Expand Down Expand Up @@ -60,18 +63,21 @@ def test_cold_start_split(self):
self.assertEqual(0, len(train_entity.intersection(test_entity)))
self.assertEqual(0, len(valid_entity.intersection(test_entity)))

@unittest.skip("dev test")
def test_combination_split(self):
from tdc.multi_pred import DrugSyn

data = DrugSyn(name="DrugComb")
split = data.get_split(method="combination")

@unittest.skip("dev test")
def test_time_split(self):
from tdc.multi_pred import DTI

data = DTI(name="BindingDB_Patent")
split = data.get_split(method="time", time_column="Year")

@unittest.skip("dev test")
def test_tearDown(self):
print(os.getcwd())

Expand Down
3 changes: 3 additions & 0 deletions tdc/test/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ def test_ADME_evaluate_many(self):

for my_group in self.group:
self.assertTrue(my_group["name"] in results)

if __name__ == "__main__":
unittest.main()
3 changes: 3 additions & 0 deletions tdc/test/test_dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ def test_generation(self):
def tearDown(self):
print(os.getcwd())
shutil.rmtree(os.path.join(os.getcwd(), "data"))

if __name__ == "__main__":
unittest.main()
3 changes: 3 additions & 0 deletions tdc/test/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ def tearDown(self):
shutil.rmtree(os.path.join(os.getcwd(), "data"))
if os.path.exists(os.path.join(os.getcwd(), "oracle")):
shutil.rmtree(os.path.join(os.getcwd(), "oracle"))

if __name__ == "__main__":
unittest.main()
Empty file removed tstfile
Empty file.

0 comments on commit 048e975

Please sign in to comment.