Skip to content

Commit

Permalink
Merge pull request #382 from Electrostatics/nathan/380
Browse files Browse the repository at this point in the history
Add tests for failed titration state naming
  • Loading branch information
sobolevnrm authored Jan 3, 2024
2 parents 6ff4248 + 34d4858 commit dd36b30
Show file tree
Hide file tree
Showing 34 changed files with 20,208 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def compare_pqr(pqr1_path, pqr2_path, compare_resnames=False):
if compare_resnames:
diff_resname = df1.res_name != df2.res_name
if any(diff_resname):
_LOGGER.error(f"Got residue names:\n{df1[diff_resname]}")
_LOGGER.error(f"Expected residue names:\n{df2[diff_resname]}")
raise ValueError(
f"PQR files have different residue names\n{df1.res_name[diff_resname]}\nreference\n{df2.res_name[diff_resname]}"
)
Expand Down
34 changes: 34 additions & 0 deletions tests/core_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
LONG_SET = LONG_PROTEIN_SET | LONG_NUCLEIC_SET
#: Tests that should fail (broken backbones)
BROKEN_SET = {"1EJG", "3U7T", "1EJG", "4MGP", "2V75"}
#: Tests for naming residues with different protonation states
NAMING_TESTS = []
for ff in ["CHARMM", "AMBER", "PARSE", "SWANSON", "TYL06"]:
for pdb in ["1AJJ", "1BX8"]:
for pH in [2, 7, 14]:
options = {"pdb": pdb, "ff": ff, "pH": pH}
if ff == "CHARMM":
NAMING_TESTS.append(pytest.param(options, marks=pytest.mark.xfail(reason="CHARMM force field is broken!")))
else:
NAMING_TESTS.append(pytest.param(options))
# fmt: on


Expand Down Expand Up @@ -142,3 +152,27 @@ def test_cyclic_peptide(input_pdb, expected_pqr, tmp_path):
tmp_path=tmp_path,
compare_resnames=True,
)


@pytest.mark.parametrize("naming_test", NAMING_TESTS, ids=str)
def test_ph_naming(naming_test, tmp_path):
"""Non-regression tests on naming schemes at different pH values."""
args = "--log-level=INFO --ff=AMBER --drop-water --apbs-input=apbs.in"
input_pdb = naming_test["pdb"] + ".pdb"
output_pqr = Path(input_pdb).stem + ".pqr"
expected_pqr = (
f"{naming_test['pdb']}_pH{naming_test['pH']}_{naming_test['ff']}.pqr"
)
args = (
f"--log-level=INFO --ff={naming_test['ff']} --ffout={naming_test['ff']} "
f"--drop-water --whitespace --with-ph={naming_test['pH']} "
f"--titration-state-method=propka"
)
common.run_pdb2pqr(
args=args,
input_pdb=common.DATA_DIR / input_pdb,
output_pqr=output_pqr,
expected_pqr=common.DATA_DIR / expected_pqr,
tmp_path=tmp_path,
compare_resnames=True,
)
728 changes: 728 additions & 0 deletions tests/data/1AJJ.pdb

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions tests/data/1AJJ_pH14_AMBER.pqr

Large diffs are not rendered by default.

513 changes: 513 additions & 0 deletions tests/data/1AJJ_pH14_CHARMM.pqr

Large diffs are not rendered by default.

510 changes: 510 additions & 0 deletions tests/data/1AJJ_pH14_PARSE.pqr

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions tests/data/1AJJ_pH14_SWANSON.pqr

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions tests/data/1AJJ_pH14_TYL06.pqr

Large diffs are not rendered by default.

522 changes: 522 additions & 0 deletions tests/data/1AJJ_pH2_AMBER.pqr

Large diffs are not rendered by default.

522 changes: 522 additions & 0 deletions tests/data/1AJJ_pH2_CHARMM.pqr

Large diffs are not rendered by default.

522 changes: 522 additions & 0 deletions tests/data/1AJJ_pH2_PARSE.pqr

Large diffs are not rendered by default.

522 changes: 522 additions & 0 deletions tests/data/1AJJ_pH2_SWANSON.pqr

Large diffs are not rendered by default.

522 changes: 522 additions & 0 deletions tests/data/1AJJ_pH2_TYL06.pqr

Large diffs are not rendered by default.

513 changes: 513 additions & 0 deletions tests/data/1AJJ_pH7_AMBER.pqr

Large diffs are not rendered by default.

513 changes: 513 additions & 0 deletions tests/data/1AJJ_pH7_CHARMM.pqr

Large diffs are not rendered by default.

513 changes: 513 additions & 0 deletions tests/data/1AJJ_pH7_PARSE.pqr

Large diffs are not rendered by default.

513 changes: 513 additions & 0 deletions tests/data/1AJJ_pH7_SWANSON.pqr

Large diffs are not rendered by default.

513 changes: 513 additions & 0 deletions tests/data/1AJJ_pH7_TYL06.pqr

Large diffs are not rendered by default.

1,166 changes: 1,166 additions & 0 deletions tests/data/1BX8.pdb

Large diffs are not rendered by default.

697 changes: 697 additions & 0 deletions tests/data/1BX8_pH14_AMBER.pqr

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions tests/data/1BX8_pH14_CHARMM.pqr

Large diffs are not rendered by default.

693 changes: 693 additions & 0 deletions tests/data/1BX8_pH14_PARSE.pqr

Large diffs are not rendered by default.

697 changes: 697 additions & 0 deletions tests/data/1BX8_pH14_SWANSON.pqr

Large diffs are not rendered by default.

697 changes: 697 additions & 0 deletions tests/data/1BX8_pH14_TYL06.pqr

Large diffs are not rendered by default.

709 changes: 709 additions & 0 deletions tests/data/1BX8_pH2_AMBER.pqr

Large diffs are not rendered by default.

709 changes: 709 additions & 0 deletions tests/data/1BX8_pH2_CHARMM.pqr

Large diffs are not rendered by default.

709 changes: 709 additions & 0 deletions tests/data/1BX8_pH2_PARSE.pqr

Large diffs are not rendered by default.

709 changes: 709 additions & 0 deletions tests/data/1BX8_pH2_SWANSON.pqr

Large diffs are not rendered by default.

709 changes: 709 additions & 0 deletions tests/data/1BX8_pH2_TYL06.pqr

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions tests/data/1BX8_pH7_AMBER.pqr

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions tests/data/1BX8_pH7_CHARMM.pqr

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions tests/data/1BX8_pH7_PARSE.pqr

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions tests/data/1BX8_pH7_SWANSON.pqr

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions tests/data/1BX8_pH7_TYL06.pqr

Large diffs are not rendered by default.

0 comments on commit dd36b30

Please sign in to comment.