Skip to content

Commit

Permalink
Merge pull request #224 from mims-harvard/avelez-dev
Browse files Browse the repository at this point in the history
add YAPF to GH Actions -- fix remaining lint errors in tdc/
  • Loading branch information
amva13 authored Mar 5, 2024
2 parents 9a5256a + 44d945c commit a1a505d
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/conda-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ jobs:
auto-update-conda: true
auto-activate-base: true

- name: Create and start Conda environment. Run tests.
- name: Create and start Conda environment. Run tests. Run YAPF
run: |
echo "Creating Conda Environment from environment.yml"
conda env create -f environment.yml
conda activate tdc-conda-env
python run_tests.py
yapf --style=google -r -d tdc
conda deactivate
2 changes: 1 addition & 1 deletion tdc/multi_pred/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
from .ppi import PPI
from .test_multi_pred import TestMultiPred
from .tcr_epi import TCREpitopeBinding
from .trialoutcome import TrialOutcome
from .trialoutcome import TrialOutcome
3 changes: 1 addition & 2 deletions tdc/test/dev_tests/chem_utils_test/test_molconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def setUp(self):
print(os.getcwd())
pass


def test_MolConvert(self):
from tdc.chem_utils import MolConvert

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

MolConvert.eligible_format()

#
#
def tearDown(self):
print(os.getcwd())

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


def test_MolConvert(self):
from tdc.chem_utils import MolFilter

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

#
#
def tearDown(self):
print(os.getcwd())

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


def test_Oracle(self):
from tdc import Oracle

Expand All @@ -35,7 +34,6 @@ 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"])


def test_distribution(self):
from tdc import Evaluator

Expand Down
7 changes: 1 addition & 6 deletions tdc/test/dev_tests/utils_tests/test_misc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def test_neg_sample(self):
# data = ADME(name='Caco2_Wang')
# x = data.label_distribution()


def test_get_label_map(self):
from tdc.multi_pred import DDI
from tdc.utils import get_label_map
Expand All @@ -42,26 +41,22 @@ def test_get_label_map(self):
split = data.get_split()
get_label_map(name="DrugBank", task="DDI")


def test_balanced(self):
from tdc.single_pred import HTS

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


def test_cid2smiles(self):
from tdc.utils import cid2smiles

smiles = cid2smiles(2248631)


def test_uniprot2seq(self):
from tdc.utils import uniprot2seq

seq = uniprot2seq("P49122")


def test_to_graph(self):
from tdc.multi_pred import DTI

Expand Down Expand Up @@ -95,7 +90,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}}

#
#
def tearDown(self):
print(os.getcwd())

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


def test_random_split(self):
from tdc.single_pred import ADME

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


def test_scaffold_split(self):
## requires RDKit
from tdc.single_pred import ADME

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


def test_cold_start_split(self):
from tdc.multi_pred import DTI

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


def test_combination_split(self):
from tdc.multi_pred import DrugSyn

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


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")


def test_tearDown(self):
print(os.getcwd())

Expand Down
6 changes: 4 additions & 2 deletions tdc/utils/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ def NegSample(df, column_names, frac, two_types):
4: "Y"
})
],
ignore_index=True, sort=False)
ignore_index=True,
sort=False)
return df
else:
df_unique_id1 = np.unique(df[id1].values.reshape(-1))
Expand Down Expand Up @@ -267,5 +268,6 @@ def NegSample(df, column_names, frac, two_types):
4: "Y"
})
],
ignore_index=True, sort=False)
ignore_index=True,
sort=False)
return df

0 comments on commit a1a505d

Please sign in to comment.