diff --git a/mmtbx/regression/pdb_interpretation/tst_custom_nb_sym_excl.py b/mmtbx/regression/pdb_interpretation/tst_custom_nb_sym_excl.py new file mode 100644 index 0000000000..707f7fe6b7 --- /dev/null +++ b/mmtbx/regression/pdb_interpretation/tst_custom_nb_sym_excl.py @@ -0,0 +1,49 @@ +from __future__ import absolute_import, division, print_function + +from libtbx.test_utils import assert_lines_in_file, assert_lines_not_in_file, assert_lines_in_text +from libtbx import easy_run +import libtbx.load_env +import os + +def exercise_01(prefix="tst_custom_nb_sym_excl"): + fname = libtbx.env.find_in_repositories( + relative_path="cctbx_project/mmtbx/regression/pdbs/1yjp_h.pdb", + test=os.path.isfile) + with open(fname, 'r') as f: + f_content = f.read() + f_content = f_content.replace("3.905 1.00 12.26", "3.905 0.33 12.26") + with open("%s.pdb" % prefix, 'w') as f2: + f2.write(f_content) + + critical=' nonbonded pdb=" OD1 ASN A 3 "' + + cmd = "mmtbx.pdb_interpretation %s.pdb custom_nonbonded_symmetry_exclusions='resname HOH' custom_nonbonded_symmetry_exclusions='resname HOH and resseq 9' " % prefix + fb = easy_run.fully_buffered(cmd) + assert not fb.return_code + stdout_text = "\n".join(fb.stdout_lines) + assert_lines_in_text(stdout_text, """\ + WARNING: 1 atom in previous symmetry exclusion group + Example: pdb=" O HOH A 9 " + WARNING: 1 atom with full occupancy + Example: pdb=" O HOH A 9 " """) + assert_lines_in_text(stdout_text, critical) + + cmd = "mmtbx.pdb_interpretation %s.pdb custom_nonbonded_symmetry_exclusions='chain A and resid 3' > %s_2.log" % (prefix, prefix) + fb = easy_run.fully_buffered(cmd) + assert not fb.return_code + + assert_lines_not_in_file("%s_2.log" % prefix, critical) + assert_lines_in_file("%s_2.log" % prefix, """\ + Custom nonbonded symmetry exclusions: + Atom selection: chain A and resid 3 + Number of atoms selected: 14 + WARNING: 13 atoms with full occupancy + Example: pdb=" CA ASN A 3 " + """) + +if(__name__ == "__main__"): + if libtbx.env.find_in_repositories(relative_path="chem_data") is None: + print("Skipping exercise_01(): chem_data directory not available") + else: + exercise_01() + print('OK') diff --git a/mmtbx/regression/pdb_interpretation/tst_tardy_geo.py b/mmtbx/regression/pdb_interpretation/tst_tardy_geo.py index af0431ae0d..a872b152fd 100644 --- a/mmtbx/regression/pdb_interpretation/tst_tardy_geo.py +++ b/mmtbx/regression/pdb_interpretation/tst_tardy_geo.py @@ -1,7 +1,7 @@ from __future__ import absolute_import, division, print_function from mmtbx.regression import model_1yjp -from libtbx.test_utils import assert_lines_in_file +from libtbx.test_utils import assert_lines_in_file, assert_lines_not_in_file from libtbx import easy_run import libtbx.load_env @@ -12,11 +12,7 @@ def exercise_01(prefix="tst_tardy_geo"): cmd = "mmtbx.pdb_interpretation %s write_geo_files=True write_tardy_geo_files=True" % fname assert not easy_run.call(cmd) assert_lines_in_file(file_name="%s.pdb.geo" % prefix, lines="Bond restraints: 59") - with open("%s.pdb.tardy.geo" % prefix, 'r') as f: - tardy_geo_cont = f.read() - # print (tardy_geo_cont.find("Bond restraints")) - # there should not be any bond restraints. - assert tardy_geo_cont.find("Bond restraints") == -1 + assert_lines_not_in_file(file_name="%s.pdb.tardy.geo" % prefix, lines="Bond restraints") if(__name__ == "__main__"): if libtbx.env.find_in_repositories(relative_path="chem_data") is None: diff --git a/mmtbx/regression/pdbs/1yjp_h.pdb b/mmtbx/regression/pdbs/1yjp_h.pdb new file mode 100644 index 0000000000..330cc0be4c --- /dev/null +++ b/mmtbx/regression/pdbs/1yjp_h.pdb @@ -0,0 +1,120 @@ +CRYST1 21.937 4.866 23.477 90.00 107.08 90.00 P 1 21 1 +SCALE1 0.045585 0.000000 0.014006 0.00000 +SCALE2 0.000000 0.205508 0.000000 0.00000 +SCALE3 0.000000 0.000000 0.044560 0.00000 +ATOM 1 N GLY A 1 -9.009 4.612 6.102 1.00 16.77 N +ATOM 2 CA GLY A 1 -9.052 4.207 4.651 1.00 16.57 C +ATOM 3 C GLY A 1 -8.015 3.140 4.419 1.00 16.16 C +ATOM 4 O GLY A 1 -7.523 2.521 5.381 1.00 16.78 O +ATOM 5 H1 GLY A 1 -9.837 4.755 6.393 1.00 16.77 H +ATOM 6 H2 GLY A 1 -8.634 3.966 6.585 1.00 16.77 H +ATOM 7 H3 GLY A 1 -8.534 5.360 6.186 1.00 16.77 H +ATOM 8 HA2 GLY A 1 -9.928 3.854 4.429 1.00 16.57 H +ATOM 9 HA3 GLY A 1 -8.860 4.969 4.083 1.00 16.57 H +ATOM 10 N ASN A 2 -7.656 2.923 3.155 1.00 15.02 N +ATOM 11 CA ASN A 2 -6.522 2.038 2.831 1.00 14.10 C +ATOM 12 C ASN A 2 -5.241 2.537 3.427 1.00 13.13 C +ATOM 13 O ASN A 2 -4.978 3.742 3.426 1.00 11.91 O +ATOM 14 CB ASN A 2 -6.346 1.881 1.341 1.00 15.38 C +ATOM 15 CG ASN A 2 -7.584 1.342 0.692 1.00 14.08 C +ATOM 16 OD1 ASN A 2 -8.025 0.227 1.016 1.00 17.46 O +ATOM 17 ND2 ASN A 2 -8.204 2.155 -0.169 1.00 11.72 N +ATOM 18 H ASN A 2 -8.044 3.269 2.470 1.00 15.02 H +ATOM 19 HA ASN A 2 -6.698 1.159 3.202 1.00 14.10 H +ATOM 20 HB2 ASN A 2 -6.150 2.746 0.949 1.00 15.38 H +ATOM 21 HB3 ASN A 2 -5.619 1.262 1.169 1.00 15.38 H +ATOM 22 HD21 ASN A 2 -8.923 1.896 -0.563 1.00 11.72 H +ATOM 23 HD22 ASN A 2 -7.868 2.925 -0.352 1.00 11.72 H +ATOM 24 N ASN A 3 -4.438 1.590 3.905 1.00 12.26 N +ATOM 25 CA ASN A 3 -3.193 1.904 4.589 1.00 11.74 C +ATOM 26 C ASN A 3 -1.955 1.332 3.895 1.00 11.10 C +ATOM 27 O ASN A 3 -1.872 0.119 3.648 1.00 10.42 O +ATOM 28 CB ASN A 3 -3.259 1.378 6.042 1.00 12.15 C +ATOM 29 CG ASN A 3 -2.006 1.739 6.861 1.00 12.82 C +ATOM 30 OD1 ASN A 3 -1.702 2.925 7.072 1.00 15.05 O +ATOM 31 ND2 ASN A 3 -1.271 0.715 7.306 1.00 13.48 N +ATOM 32 H ASN A 3 -4.598 0.756 3.852 1.00 12.26 H +ATOM 33 HA ASN A 3 -3.090 2.867 4.628 1.00 11.74 H +ATOM 34 HB2 ASN A 3 -4.029 1.767 6.485 1.00 12.15 H +ATOM 35 HB3 ASN A 3 -3.339 0.411 6.025 1.00 12.15 H +ATOM 36 HD21 ASN A 3 -0.566 0.851 7.755 1.00 13.48 H +ATOM 37 HD22 ASN A 3 -1.518 -0.074 7.128 1.00 13.48 H +ATOM 38 N GLN A 4 -1.005 2.228 3.598 1.00 10.29 N +ATOM 39 CA GLN A 4 0.384 1.888 3.199 1.00 10.53 C +ATOM 40 C GLN A 4 1.435 2.606 4.088 1.00 10.24 C +ATOM 41 O GLN A 4 1.547 3.843 4.115 1.00 8.86 O +ATOM 42 CB GLN A 4 0.656 2.148 1.711 1.00 9.80 C +ATOM 43 CG GLN A 4 1.944 1.458 1.213 1.00 10.25 C +ATOM 44 CD GLN A 4 2.504 2.044 -0.089 1.00 12.43 C +ATOM 45 OE1 GLN A 4 2.744 3.268 -0.190 1.00 14.62 O +ATOM 46 NE2 GLN A 4 2.750 1.161 -1.091 1.00 9.05 N +ATOM 47 H GLN A 4 -1.138 3.072 3.622 1.00 10.29 H +ATOM 48 HA GLN A 4 0.502 0.937 3.339 1.00 10.53 H +ATOM 49 HB2 GLN A 4 -0.088 1.808 1.189 1.00 9.80 H +ATOM 50 HB3 GLN A 4 0.753 3.103 1.569 1.00 9.80 H +ATOM 51 HG2 GLN A 4 2.630 1.544 1.893 1.00 10.25 H +ATOM 52 HG3 GLN A 4 1.754 0.520 1.057 1.00 10.25 H +ATOM 53 HE21 GLN A 4 2.575 0.329 -0.984 1.00 9.05 H +ATOM 54 HE22 GLN A 4 3.066 1.440 -1.841 1.00 9.05 H +ATOM 55 N GLN A 5 2.154 1.821 4.871 1.00 10.38 N +ATOM 56 CA GLN A 5 3.270 2.361 5.640 1.00 11.39 C +ATOM 57 C GLN A 5 4.594 1.768 5.172 1.00 11.52 C +ATOM 58 O GLN A 5 4.768 0.546 5.054 1.00 12.05 O +ATOM 59 CB GLN A 5 3.056 2.183 7.147 1.00 11.96 C +ATOM 60 CG GLN A 5 1.829 2.950 7.647 1.00 10.81 C +ATOM 61 CD GLN A 5 1.344 2.414 8.954 1.00 13.10 C +ATOM 62 OE1 GLN A 5 0.774 1.325 9.002 1.00 10.65 O +ATOM 63 NE2 GLN A 5 1.549 3.187 10.039 1.00 12.30 N +ATOM 64 H GLN A 5 2.021 0.979 4.979 1.00 10.38 H +ATOM 65 HA GLN A 5 3.322 3.315 5.479 1.00 11.39 H +ATOM 66 HB2 GLN A 5 2.923 1.242 7.340 1.00 11.96 H +ATOM 67 HB3 GLN A 5 3.834 2.514 7.621 1.00 11.96 H +ATOM 68 HG2 GLN A 5 2.063 3.883 7.769 1.00 10.81 H +ATOM 69 HG3 GLN A 5 1.111 2.866 7.000 1.00 10.81 H +ATOM 70 HE21 GLN A 5 1.950 3.944 9.958 1.00 12.30 H +ATOM 71 HE22 GLN A 5 1.285 2.920 10.813 1.00 12.30 H +ATOM 72 N ASN A 6 5.514 2.664 4.856 1.00 11.99 N +ATOM 73 CA ASN A 6 6.831 2.310 4.318 1.00 12.30 C +ATOM 74 C ASN A 6 7.854 2.761 5.324 1.00 13.40 C +ATOM 75 O ASN A 6 8.219 3.943 5.374 1.00 13.92 O +ATOM 76 CB ASN A 6 7.065 3.016 2.993 1.00 12.13 C +ATOM 77 CG ASN A 6 5.961 2.735 2.003 1.00 12.77 C +ATOM 78 OD1 ASN A 6 5.798 1.604 1.551 1.00 14.27 O +ATOM 79 ND2 ASN A 6 5.195 3.747 1.679 1.00 10.07 N +ATOM 80 H ASN A 6 5.407 3.506 4.949 1.00 11.99 H +ATOM 81 HA ASN A 6 6.903 1.351 4.191 1.00 12.30 H +ATOM 82 HB2 ASN A 6 7.100 3.974 3.143 1.00 12.13 H +ATOM 83 HB3 ASN A 6 7.901 2.706 2.610 1.00 12.13 H +ATOM 84 HD21 ASN A 6 4.549 3.639 1.122 1.00 10.07 H +ATOM 85 HD22 ASN A 6 5.339 4.516 2.026 1.00 10.07 H +ATOM 86 N TYR A 7 8.292 1.817 6.147 1.00 14.70 N +ATOM 87 CA TYR A 7 9.159 2.144 7.299 1.00 15.18 C +ATOM 88 C TYR A 7 10.603 2.331 6.885 1.00 15.91 C +ATOM 89 O TYR A 7 11.041 1.811 5.855 1.00 15.76 O +ATOM 90 CB TYR A 7 9.061 1.065 8.369 1.00 15.35 C +ATOM 91 CG TYR A 7 7.665 0.929 8.902 1.00 14.45 C +ATOM 92 CD1 TYR A 7 7.210 1.756 9.920 1.00 14.80 C +ATOM 93 CD2 TYR A 7 6.771 0.021 8.327 1.00 15.68 C +ATOM 94 CE1 TYR A 7 5.904 1.649 10.416 1.00 14.33 C +ATOM 95 CE2 TYR A 7 5.480 -0.094 8.796 1.00 13.46 C +ATOM 96 CZ TYR A 7 5.047 0.729 9.831 1.00 15.09 C +ATOM 97 OH TYR A 7 3.766 0.589 10.291 1.00 14.39 O +ATOM 98 OXT TYR A 7 11.358 2.999 7.612 1.00 17.49 O +ATOM 99 H TYR A 7 8.099 0.987 6.080 1.00 14.70 H +ATOM 100 HA TYR A 7 8.852 2.975 7.692 1.00 15.18 H +ATOM 101 HB2 TYR A 7 9.327 0.215 7.987 1.00 15.35 H +ATOM 102 HB3 TYR A 7 9.645 1.296 9.108 1.00 15.35 H +ATOM 103 HD1 TYR A 7 7.794 2.369 10.304 1.00 14.80 H +ATOM 104 HD2 TYR A 7 7.058 -0.530 7.635 1.00 15.68 H +ATOM 105 HE1 TYR A 7 5.612 2.197 11.109 1.00 14.33 H +ATOM 106 HE2 TYR A 7 4.899 -0.713 8.417 1.00 13.46 H +ATOM 107 HH TYR A 7 3.393 1.340 10.328 1.00 14.39 H +TER +HETATM 108 O HOH A 8 -6.471 5.227 7.124 1.00 22.62 O +HETATM 109 O HOH A 9 10.431 1.858 3.216 1.00 19.71 O +HETATM 110 O HOH A 10 -11.286 1.756 -1.468 1.00 17.08 O +HETATM 111 O HOH A 11 11.808 4.179 9.970 1.00 23.99 O +HETATM 112 O HOH A 12 13.605 1.327 9.198 1.00 26.17 O +HETATM 113 O HOH A 13 -2.749 3.429 10.024 1.00 39.15 O +HETATM 114 O HOH A 14 -1.500 0.682 10.967 1.00 43.49 O +END diff --git a/mmtbx/run_tests.py b/mmtbx/run_tests.py index e028b905ef..70e5efb9a1 100644 --- a/mmtbx/run_tests.py +++ b/mmtbx/run_tests.py @@ -429,6 +429,7 @@ "$D/regression/pdb_interpretation/tst_edits.py", "$D/regression/pdb_interpretation/tst_edits_actions.py", "$D/regression/pdb_interpretation/tst_tardy_geo.py", + "$D/regression/pdb_interpretation/tst_custom_nb_sym_excl.py", "$D/regression/pdb_interpretation/tst_using_ncs_1.py", "$D/regression/pdb_interpretation/tst_using_ncs_2.py", "$D/regression/tst_add_arrows_on_plot.py",