Skip to content

Commit ab4d8cd

Browse files
authored
readd ad4 tests (#122)
1 parent b55ac50 commit ab4d8cd

File tree

2 files changed

+47
-47
lines changed

2 files changed

+47
-47
lines changed

unidock_tools/tests/applications/test_unidock.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,24 @@ def test_unidock_pipeline_ligand_index(receptor, ligand, pocket):
7979
shutil.rmtree(results_dir, ignore_errors=True)
8080

8181

82-
# def test_unidock_pipeline_scoring_ad4(receptor, ligand, pocket):
83-
# results_dir = "unidock_results_ad4"
84-
# cmd = f"unidocktools unidock_pipeline -r {receptor} -l {ligand} -sd {results_dir} \
85-
# -cx {pocket['center_x']} -cy {pocket['center_y']} -cz {pocket['center_z']} \
86-
# -sx {pocket['size_x']} -sy {pocket['size_y']} -sz {pocket['size_z']} \
87-
# -sf ad4 -nm 1 --seed 181129"
88-
# print(cmd)
89-
# resp = subprocess.run(cmd, shell=True, capture_output=True, encoding="utf-8")
90-
# print(resp.stdout)
91-
# assert resp.returncode == 0, f"run unidock pipeline app err:\n{resp.stderr}"
92-
93-
# result_file = os.path.join(results_dir, Path(ligand).name)
94-
# assert os.path.exists(result_file), f"docking result file not found"
95-
96-
# score_list = read_scores(result_file, "docking_score")
97-
# score = score_list[0]
98-
# assert -20 <= score <= 0, f"Uni-Dock score not in range: {score}"
99-
# shutil.rmtree(results_dir, ignore_errors=True)
82+
def test_unidock_pipeline_scoring_ad4(receptor, ligand, pocket):
83+
results_dir = "unidock_results_ad4"
84+
cmd = f"unidocktools unidock_pipeline -r {receptor} -l {ligand} -sd {results_dir} \
85+
-cx {pocket['center_x']} -cy {pocket['center_y']} -cz {pocket['center_z']} \
86+
-sx {pocket['size_x']} -sy {pocket['size_y']} -sz {pocket['size_z']} \
87+
-sf ad4 -nm 1 --seed 181129"
88+
print(cmd)
89+
resp = subprocess.run(cmd, shell=True, capture_output=True, encoding="utf-8")
90+
print(resp.stdout)
91+
assert resp.returncode == 0, f"run unidock pipeline app err:\n{resp.stderr}"
92+
93+
result_file = os.path.join(results_dir, Path(ligand).name)
94+
assert os.path.exists(result_file), f"docking result file not found"
95+
96+
score_list = read_scores(result_file, "docking_score")
97+
score = score_list[0]
98+
assert -20 <= score <= 0, f"Uni-Dock score not in range: {score}"
99+
shutil.rmtree(results_dir, ignore_errors=True)
100100

101101

102102
def test_unidock_pipeline_multi_pose(receptor, ligand, pocket):

unidock_tools/tests/ut/dock/test_run_unidock.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,32 @@ def test_run_unidock_vina(receptor, ligand, pocket):
5555
shutil.rmtree(workdir, ignore_errors=True)
5656

5757

58-
# def test_run_unidock_ad4(receptor, ligand, pocket):
59-
# from unidock_tools.modules.docking import run_unidock
60-
61-
# workdir = Path(f"./tmp+{uuid.uuid4()}")
62-
# workdir.mkdir(parents=True, exist_ok=True)
63-
64-
# result_ligands, scores_list = run_unidock(
65-
# receptor=receptor,
66-
# ligands=[ligand],
67-
# output_dir=workdir,
68-
# center_x=pocket[0],
69-
# center_y=pocket[1],
70-
# center_z=pocket[2],
71-
# size_x=pocket[3],
72-
# size_y=pocket[4],
73-
# size_z=pocket[5],
74-
# scoring="ad4",
75-
# num_modes=5,
76-
# energy_range=6.0,
77-
# seed=181129,
78-
# )
79-
80-
# result_ligand = result_ligands[0]
81-
# assert os.path.exists(result_ligand)
82-
83-
# scores = scores_list[0]
84-
# assert len(scores) == 5
85-
86-
# shutil.rmtree(workdir, ignore_errors=True)
58+
def test_run_unidock_ad4(receptor, ligand, pocket):
59+
from unidock_tools.modules.docking import run_unidock
60+
61+
workdir = Path(f"./tmp+{uuid.uuid4()}")
62+
workdir.mkdir(parents=True, exist_ok=True)
63+
64+
result_ligands, scores_list = run_unidock(
65+
receptor=receptor,
66+
ligands=[ligand],
67+
output_dir=workdir,
68+
center_x=pocket[0],
69+
center_y=pocket[1],
70+
center_z=pocket[2],
71+
size_x=pocket[3],
72+
size_y=pocket[4],
73+
size_z=pocket[5],
74+
scoring="ad4",
75+
num_modes=5,
76+
energy_range=6.0,
77+
seed=181129,
78+
)
79+
80+
result_ligand = result_ligands[0]
81+
assert os.path.exists(result_ligand)
82+
83+
scores = scores_list[0]
84+
assert len(scores) == 5
85+
86+
shutil.rmtree(workdir, ignore_errors=True)

0 commit comments

Comments
 (0)