Skip to content

Commit

Permalink
Add tests for ligand class
Browse files Browse the repository at this point in the history
  • Loading branch information
ralf-meyer committed Nov 11, 2023
1 parent 252eb1b commit 5cc7c87
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_ligand_class.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from molSimplify.Classes.ligand import ligand


def test_ligand_class(resource_path_root):
mol2_file = str(
resource_path_root / "inputs" / "ligand_class" / "fe_acac.mol2"
)
lig = ligand(
master_mol=None,
index_list=None,
dent=None,
read_lig=mol2_file,
)
assert lig.dent == 2
assert lig.master_mol.make_formula(latex=False) == "Fe1O2C5H7"

lig_graph_det, mol2_str = lig.get_lig_mol2()
assert lig_graph_det == '-2.023585127e+17'

with open(resource_path_root / "inputs" / "ligand_class" / "acac_ref.mol2") as fin:
ref_str = fin.read()
# Remove last new line (because of our autoformatting)
assert mol2_str[:-1] == ref_str

buried_vol = lig.percent_buried_vol()
assert abs(buried_vol - 30.034) < 1e-3
42 changes: 42 additions & 0 deletions tests/testresources/inputs/ligand_class/acac_ref.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@<TRIPOS>MOLECULE
ligand
15 15 1
SMALL
PartialCharges
****
Generated from molSimplify

@<TRIPOS>ATOM
1 O1 3.1117 0.8158 -1.394 O.2 1 RES1 0.0
2 C1 2.5035 0.2178 -0.5193 C.2 1 RES1 0.0
3 C2 1.0119 0.1135 -0.5927 C.3 1 RES1 0.0
4 C3 3.2352 -0.4172 0.6354 C.2 1 RES1 0.0
5 C4 4.7377 -0.323 0.7389 C.2 1 RES1 0.0
6 O2 5.3853 0.2682 -0.1114 O.2 1 RES1 0.0
7 C5 5.4522 -0.9568 1.8929 C.3 1 RES1 0.0
8 H1 0.6247 0.6297 -1.4972 H 1 RES1 0.0
9 H2 0.5611 0.5821 0.307 H 1 RES1 0.0
10 H3 0.7146 -0.9552 -0.636 H 1 RES1 0.0
11 H4 4.7384 -1.4561 2.5816 H 1 RES1 0.0
12 H5 6.007 -0.1796 2.459 H 1 RES1 0.0
13 H6 6.1702 -1.7146 1.5151 H 1 RES1 0.0
14 H7 2.7035 -0.9212 1.3622 H 1 RES1 0.0
15 X1 0.0 0.0 0.0 X 1 RES1 0.0
@<TRIPOS>BOND
1 1 2 2
1 1 15 1
1 2 3 1
1 2 4 1
1 3 8 1
1 3 9 1
1 3 10 1
1 4 5 2
1 4 14 1
1 5 6 1
1 5 7 1
1 6 15 1
1 7 11 1
1 7 12 1
1 7 13 1
@<TRIPOS>SUBSTRUCTURE
1 RES1 15
38 changes: 38 additions & 0 deletions tests/testresources/inputs/ligand_class/fe_acac.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@<TRIPOS>MOLECULE
*****
15 15 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
1 O 3.1117 0.8158 -1.3940 O.2 1 UNL1 -0.2958
2 C 2.5035 0.2178 -0.5193 C.2 1 UNL1 0.1238
3 C 1.0119 0.1135 -0.5927 C.3 1 UNL1 -0.0046
4 C 3.2352 -0.4172 0.6354 C.2 1 UNL1 -0.1413
5 C 4.7377 -0.3230 0.7389 C.2 1 UNL1 -0.1413
6 O 5.3853 0.2682 -0.1114 O.2 1 UNL1 -0.5072
7 C 5.4522 -0.9568 1.8929 C.3 1 UNL1 -0.1389
8 H 0.6247 0.6297 -1.4972 H 1 UNL1 0.0308
9 H 0.5611 0.5821 0.3070 H 1 UNL1 0.0308
10 H 0.7146 -0.9552 -0.6360 H 1 UNL1 0.0308
11 H 4.7384 -1.4561 2.5816 H 1 UNL1 -0.0057
12 H 6.0070 -0.1796 2.4590 H 1 UNL1 -0.0057
13 H 6.1702 -1.7146 1.5151 H 1 UNL1 -0.0057
14 H 2.7035 -0.9212 1.3622 H 1 UNL1 0.0298
15 Fe 0.0000 0.0000 0.0000 Fe 1 UNL1 0.0000
@<TRIPOS>BOND
1 1 2 2
2 2 3 1
3 2 4 1
4 3 8 1
5 3 9 1
6 3 10 1
7 4 5 2
8 4 14 1
9 5 6 1
10 5 7 1
11 7 11 1
12 7 12 1
13 7 13 1
14 1 15 1
15 6 15 1

0 comments on commit 5cc7c87

Please sign in to comment.