From 49393e4388279d731db433ccb5d89d22b509da38 Mon Sep 17 00:00:00 2001 From: Yuxuan Zhuang Date: Tue, 14 Jan 2025 11:59:39 -0800 Subject: [PATCH] test on small pdb for guesser --- .../MDAnalysisTests/data/adk_open_10res.pdb | 162 ++++++++++++++++++ testsuite/MDAnalysisTests/datafiles.py | 2 + .../MDAnalysisTests/guesser/test_base.py | 24 +-- 3 files changed, 176 insertions(+), 12 deletions(-) create mode 100644 testsuite/MDAnalysisTests/data/adk_open_10res.pdb diff --git a/testsuite/MDAnalysisTests/data/adk_open_10res.pdb b/testsuite/MDAnalysisTests/data/adk_open_10res.pdb new file mode 100644 index 0000000000..0f10a02eca --- /dev/null +++ b/testsuite/MDAnalysisTests/data/adk_open_10res.pdb @@ -0,0 +1,162 @@ +REMARK ADENYLATE KINASE IN OPEN STATE (4AKE) +REMARK DATE: 6/ 6/ 8 14:36:14 CREATED BY USER: denniej0 +REMARK +CRYST1 80.017 80.017 80.017 60.00 60.00 90.00 P 1 1 +ATOM 1 N MET 1 -11.921 26.307 10.410 1.00 38.38 4AKE +ATOM 2 HT1 MET 1 -11.447 26.741 9.595 1.00 0.00 4AKE +ATOM 3 HT2 MET 1 -12.440 27.042 10.926 1.00 0.00 4AKE +ATOM 4 HT3 MET 1 -12.632 25.619 10.046 1.00 0.00 4AKE +ATOM 5 CA MET 1 -10.929 25.652 11.311 1.00 26.14 4AKE +ATOM 6 HA MET 1 -10.153 26.380 11.508 1.00 0.00 4AKE +ATOM 7 CB MET 1 -11.636 25.257 12.635 1.00 31.73 4AKE +ATOM 8 HB1 MET 1 -12.362 24.432 12.448 1.00 0.00 4AKE +ATOM 9 HB2 MET 1 -12.209 26.120 13.038 1.00 0.00 4AKE +ATOM 10 CG MET 1 -10.648 24.795 13.722 1.00 35.74 4AKE +ATOM 11 HG1 MET 1 -10.136 23.879 13.356 1.00 0.00 4AKE +ATOM 12 HG2 MET 1 -11.212 24.496 14.634 1.00 0.00 4AKE +ATOM 13 SD MET 1 -9.397 26.036 14.159 1.00 39.69 4AKE +ATOM 14 CE MET 1 -10.466 27.039 15.229 1.00 39.02 4AKE +ATOM 15 HE1 MET 1 -10.806 26.451 16.109 1.00 0.00 4AKE +ATOM 16 HE2 MET 1 -11.367 27.408 14.696 1.00 0.00 4AKE +ATOM 17 HE3 MET 1 -9.923 27.924 15.627 1.00 0.00 4AKE +ATOM 18 C MET 1 -10.265 24.426 10.708 1.00 23.90 4AKE +ATOM 19 O MET 1 -10.894 23.392 10.522 1.00 20.27 4AKE +ATOM 20 N ARG 2 -8.985 24.519 10.337 1.00 16.63 4AKE +ATOM 21 HN ARG 2 -8.486 25.405 10.434 1.00 0.00 4AKE +ATOM 22 CA ARG 2 -8.224 23.447 9.735 1.00 16.71 4AKE +ATOM 23 HA ARG 2 -8.849 22.593 9.516 1.00 0.00 4AKE +ATOM 24 CB ARG 2 -7.592 23.971 8.433 1.00 27.49 4AKE +ATOM 25 HB1 ARG 2 -6.905 23.205 8.005 1.00 0.00 4AKE +ATOM 26 HB2 ARG 2 -6.987 24.872 8.688 1.00 0.00 4AKE +ATOM 27 CG ARG 2 -8.627 24.367 7.358 1.00 29.58 4AKE +ATOM 28 HG1 ARG 2 -9.496 24.882 7.820 1.00 0.00 4AKE +ATOM 29 HG2 ARG 2 -9.003 23.430 6.894 1.00 0.00 4AKE +ATOM 30 CD ARG 2 -8.015 25.322 6.330 1.00 39.14 4AKE +ATOM 31 HD1 ARG 2 -6.914 25.206 6.378 1.00 0.00 4AKE +ATOM 32 HD2 ARG 2 -8.266 26.382 6.569 1.00 0.00 4AKE +ATOM 33 NE ARG 2 -8.529 24.961 4.965 1.00 45.43 4AKE +ATOM 34 HE ARG 2 -9.470 24.666 4.860 1.00 0.00 4AKE +ATOM 35 CZ ARG 2 -7.816 25.115 3.842 1.00 43.13 4AKE +ATOM 36 NH1 ARG 2 -6.545 25.499 3.854 1.00 32.44 4AKE +ATOM 37 HH11 ARG 2 -6.042 25.480 4.723 1.00 0.00 4AKE +ATOM 38 HH12 ARG 2 -6.079 25.689 3.003 1.00 0.00 4AKE +ATOM 39 NH2 ARG 2 -8.384 24.855 2.668 1.00 44.42 4AKE +ATOM 40 HH21 ARG 2 -9.317 24.519 2.631 1.00 0.00 4AKE +ATOM 41 HH22 ARG 2 -7.849 24.956 1.840 1.00 0.00 4AKE +ATOM 42 C ARG 2 -7.143 22.997 10.702 1.00 20.47 4AKE +ATOM 43 O ARG 2 -6.235 23.756 11.035 1.00 21.86 4AKE +ATOM 44 N ILE 3 -7.237 21.762 11.210 1.00 19.35 4AKE +ATOM 45 HN ILE 3 -7.959 21.135 10.898 1.00 0.00 4AKE +ATOM 46 CA ILE 3 -6.388 21.267 12.283 1.00 15.54 4AKE +ATOM 47 HA ILE 3 -5.660 22.011 12.569 1.00 0.00 4AKE +ATOM 48 CB ILE 3 -7.237 20.918 13.511 1.00 20.99 4AKE +ATOM 49 HB ILE 3 -8.088 20.283 13.168 1.00 0.00 4AKE +ATOM 50 CG2 ILE 3 -6.434 20.139 14.579 1.00 22.72 4AKE +ATOM 51 HG21 ILE 3 -5.516 20.696 14.861 1.00 0.00 4AKE +ATOM 52 HG22 ILE 3 -6.141 19.133 14.216 1.00 0.00 4AKE +ATOM 53 HG23 ILE 3 -7.047 19.994 15.493 1.00 0.00 4AKE +ATOM 54 CG1 ILE 3 -7.822 22.201 14.144 1.00 17.87 4AKE +ATOM 55 HG11 ILE 3 -8.072 22.941 13.353 1.00 0.00 4AKE +ATOM 56 HG12 ILE 3 -7.043 22.665 14.788 1.00 0.00 4AKE +ATOM 57 CD ILE 3 -9.080 21.935 14.976 1.00 14.74 4AKE +ATOM 58 HD1 ILE 3 -8.897 21.150 15.739 1.00 0.00 4AKE +ATOM 59 HD2 ILE 3 -9.912 21.602 14.318 1.00 0.00 4AKE +ATOM 60 HD3 ILE 3 -9.398 22.860 15.505 1.00 0.00 4AKE +ATOM 61 C ILE 3 -5.617 20.052 11.802 1.00 15.29 4AKE +ATOM 62 O ILE 3 -6.169 19.177 11.139 1.00 18.83 4AKE +ATOM 63 N ILE 4 -4.315 19.962 12.136 1.00 19.32 4AKE +ATOM 64 HN ILE 4 -3.869 20.733 12.598 1.00 0.00 4AKE +ATOM 65 CA ILE 4 -3.538 18.733 12.034 1.00 20.37 4AKE +ATOM 66 HA ILE 4 -4.049 18.017 11.405 1.00 0.00 4AKE +ATOM 67 CB ILE 4 -2.149 18.974 11.447 1.00 28.16 4AKE +ATOM 68 HB ILE 4 -1.708 19.873 11.938 1.00 0.00 4AKE +ATOM 69 CG2 ILE 4 -1.212 17.770 11.676 1.00 28.24 4AKE +ATOM 70 HG21 ILE 4 -1.661 16.842 11.262 1.00 0.00 4AKE +ATOM 71 HG22 ILE 4 -1.000 17.623 12.753 1.00 0.00 4AKE +ATOM 72 HG23 ILE 4 -0.236 17.929 11.172 1.00 0.00 4AKE +ATOM 73 CG1 ILE 4 -2.272 19.248 9.937 1.00 17.10 4AKE +ATOM 74 HG11 ILE 4 -3.119 19.946 9.774 1.00 0.00 4AKE +ATOM 75 HG12 ILE 4 -2.521 18.293 9.418 1.00 0.00 4AKE +ATOM 76 CD ILE 4 -0.993 19.840 9.336 1.00 12.08 4AKE +ATOM 77 HD1 ILE 4 -0.145 19.134 9.423 1.00 0.00 4AKE +ATOM 78 HD2 ILE 4 -0.693 20.759 9.874 1.00 0.00 4AKE +ATOM 79 HD3 ILE 4 -1.131 20.080 8.262 1.00 0.00 4AKE +ATOM 80 C ILE 4 -3.432 18.120 13.420 1.00 19.61 4AKE +ATOM 81 O ILE 4 -3.061 18.791 14.384 1.00 19.76 4AKE +ATOM 82 N LEU 5 -3.771 16.822 13.558 1.00 18.91 4AKE +ATOM 83 HN LEU 5 -4.110 16.312 12.761 1.00 0.00 4AKE +ATOM 84 CA LEU 5 -3.682 16.109 14.821 1.00 17.08 4AKE +ATOM 85 HA LEU 5 -3.432 16.811 15.606 1.00 0.00 4AKE +ATOM 86 CB LEU 5 -5.046 15.474 15.169 1.00 18.00 4AKE +ATOM 87 HB1 LEU 5 -5.253 14.634 14.470 1.00 0.00 4AKE +ATOM 88 HB2 LEU 5 -5.829 16.243 14.991 1.00 0.00 4AKE +ATOM 89 CG LEU 5 -5.201 14.980 16.623 1.00 22.57 4AKE +ATOM 90 HG LEU 5 -4.374 14.265 16.845 1.00 0.00 4AKE +ATOM 91 CD1 LEU 5 -5.127 16.123 17.647 1.00 19.07 4AKE +ATOM 92 HD11 LEU 5 -5.860 16.918 17.393 1.00 0.00 4AKE +ATOM 93 HD12 LEU 5 -4.110 16.568 17.671 1.00 0.00 4AKE +ATOM 94 HD13 LEU 5 -5.361 15.745 18.665 1.00 0.00 4AKE +ATOM 95 CD2 LEU 5 -6.532 14.230 16.769 1.00 30.32 4AKE +ATOM 96 HD21 LEU 5 -6.561 13.358 16.080 1.00 0.00 4AKE +ATOM 97 HD22 LEU 5 -7.382 14.901 16.521 1.00 0.00 4AKE +ATOM 98 HD23 LEU 5 -6.668 13.868 17.809 1.00 0.00 4AKE +ATOM 99 C LEU 5 -2.571 15.060 14.812 1.00 17.45 4AKE +ATOM 100 O LEU 5 -2.695 13.954 14.265 1.00 23.44 4AKE +ATOM 101 N LEU 6 -1.431 15.390 15.446 1.00 18.86 4AKE +ATOM 102 HN LEU 6 -1.359 16.263 15.943 1.00 0.00 4AKE +ATOM 103 CA LEU 6 -0.287 14.512 15.566 1.00 19.01 4AKE +ATOM 104 HA LEU 6 -0.347 13.739 14.813 1.00 0.00 4AKE +ATOM 105 CB LEU 6 1.062 15.257 15.378 1.00 11.00 4AKE +ATOM 106 HB1 LEU 6 1.892 14.517 15.361 1.00 0.00 4AKE +ATOM 107 HB2 LEU 6 1.231 15.931 16.248 1.00 0.00 4AKE +ATOM 108 CG LEU 6 1.160 16.116 14.098 1.00 21.73 4AKE +ATOM 109 HG LEU 6 0.386 16.917 14.170 1.00 0.00 4AKE +ATOM 110 CD1 LEU 6 2.527 16.810 14.016 1.00 13.75 4AKE +ATOM 111 HD11 LEU 6 3.337 16.056 13.918 1.00 0.00 4AKE +ATOM 112 HD12 LEU 6 2.713 17.414 14.930 1.00 0.00 4AKE +ATOM 113 HD13 LEU 6 2.566 17.483 13.133 1.00 0.00 4AKE +ATOM 114 CD2 LEU 6 0.908 15.317 12.807 1.00 15.07 4AKE +ATOM 115 HD21 LEU 6 -0.129 14.923 12.776 1.00 0.00 4AKE +ATOM 116 HD22 LEU 6 1.625 14.476 12.715 1.00 0.00 4AKE +ATOM 117 HD23 LEU 6 1.044 15.976 11.922 1.00 0.00 4AKE +ATOM 118 C LEU 6 -0.310 13.828 16.926 1.00 18.47 4AKE +ATOM 119 O LEU 6 -0.941 14.280 17.880 1.00 27.19 4AKE +ATOM 120 N GLY 7 0.362 12.677 17.057 1.00 22.28 4AKE +ATOM 121 HN GLY 7 0.911 12.294 16.315 1.00 0.00 4AKE +ATOM 122 CA GLY 7 0.384 11.956 18.318 1.00 16.74 4AKE +ATOM 123 HA1 GLY 7 -0.616 11.901 18.723 1.00 0.00 4AKE +ATOM 124 HA2 GLY 7 1.094 12.443 18.974 1.00 0.00 4AKE +ATOM 125 C GLY 7 0.839 10.553 18.083 1.00 17.47 4AKE +ATOM 126 O GLY 7 0.536 9.962 17.045 1.00 20.37 4AKE +ATOM 127 N ALA 8 1.573 9.981 19.051 1.00 27.03 4AKE +ATOM 128 HN ALA 8 1.799 10.489 19.880 1.00 0.00 4AKE +ATOM 129 CA ALA 8 2.218 8.691 18.925 1.00 20.81 4AKE +ATOM 130 HA ALA 8 2.848 8.757 18.050 1.00 0.00 4AKE +ATOM 131 CB ALA 8 3.117 8.476 20.160 1.00 19.89 4AKE +ATOM 132 HB1 ALA 8 2.518 8.477 21.093 1.00 0.00 4AKE +ATOM 133 HB2 ALA 8 3.866 9.294 20.245 1.00 0.00 4AKE +ATOM 134 HB3 ALA 8 3.682 7.523 20.111 1.00 0.00 4AKE +ATOM 135 C ALA 8 1.261 7.498 18.736 1.00 22.77 4AKE +ATOM 136 O ALA 8 0.086 7.568 19.122 1.00 27.45 4AKE +ATOM 137 N PRO 9 1.685 6.374 18.144 1.00 28.81 4AKE +ATOM 138 CD PRO 9 2.983 6.221 17.483 1.00 22.28 4AKE +ATOM 139 HD1 PRO 9 3.825 6.622 18.091 1.00 0.00 4AKE +ATOM 140 HD2 PRO 9 2.944 6.742 16.500 1.00 0.00 4AKE +ATOM 141 CA PRO 9 0.831 5.206 17.927 1.00 20.62 4AKE +ATOM 142 HA PRO 9 -0.079 5.504 17.428 1.00 0.00 4AKE +ATOM 143 CB PRO 9 1.675 4.284 17.021 1.00 23.29 4AKE +ATOM 144 HB1 PRO 9 1.417 4.490 15.959 1.00 0.00 4AKE +ATOM 145 HB2 PRO 9 1.517 3.206 17.226 1.00 0.00 4AKE +ATOM 146 CG PRO 9 3.121 4.717 17.277 1.00 16.08 4AKE +ATOM 147 HG1 PRO 9 3.494 4.261 18.223 1.00 0.00 4AKE +ATOM 148 HG2 PRO 9 3.814 4.461 16.449 1.00 0.00 4AKE +ATOM 149 C PRO 9 0.430 4.516 19.224 1.00 27.01 4AKE +ATOM 150 O PRO 9 1.121 3.618 19.698 1.00 26.39 4AKE +ATOM 151 N GLY 10 -0.721 4.912 19.798 1.00 29.20 4AKE +ATOM 152 HN GLY 10 -1.240 5.629 19.341 1.00 0.00 4AKE +ATOM 153 CA GLY 10 -1.180 4.437 21.097 1.00 25.54 4AKE +ATOM 154 HA1 GLY 10 -0.450 3.768 21.530 1.00 0.00 4AKE +ATOM 155 HA2 GLY 10 -2.141 3.968 20.954 1.00 0.00 4AKE +ATOM 156 C GLY 10 -1.382 5.542 22.096 1.00 28.56 4AKE +ATOM 157 O GLY 10 -1.883 5.300 23.188 1.00 34.54 4AKE +END diff --git a/testsuite/MDAnalysisTests/datafiles.py b/testsuite/MDAnalysisTests/datafiles.py index deef782d77..1591450cc4 100644 --- a/testsuite/MDAnalysisTests/datafiles.py +++ b/testsuite/MDAnalysisTests/datafiles.py @@ -56,6 +56,7 @@ "PSF_cmap", # ala3 PSF from ParmEd test files with cmap "PSF_inscode", # PSF file with insertion codes "PDB_small", # PDB + "PDB_xsmall", # The first 10 residues of PDB_small "PDB_closed", "PDB_multiframe", "PDB_helix", @@ -453,6 +454,7 @@ PDB_varying = (_data_ref / "varying_occ_tmp.pdb").as_posix() PDB_small = (_data_ref / "adk_open.pdb").as_posix() +PDB_xsmall = (_data_ref / "adk_open_10res.pdb").as_posix() PDB_closed = (_data_ref / "adk_closed.pdb").as_posix() ALIGN = (_data_ref / "align.pdb").as_posix() diff --git a/testsuite/MDAnalysisTests/guesser/test_base.py b/testsuite/MDAnalysisTests/guesser/test_base.py index 2c753c9af3..e890ca9957 100644 --- a/testsuite/MDAnalysisTests/guesser/test_base.py +++ b/testsuite/MDAnalysisTests/guesser/test_base.py @@ -61,7 +61,7 @@ def test_guess_invalid_attribute(self): match="default guesser can not guess " "the following attribute: foo", ): - mda.Universe(datafiles.PDB, to_guess=["foo"]) + mda.Universe(datafiles.PDB_xsmall, to_guess=["foo"]) def test_guess_attribute_with_missing_parent_attr(self): names = Atomnames(np.array(["C", "HB", "HA", "O"], dtype=object)) @@ -173,23 +173,23 @@ def test_guess_topology_objects_force(self): def test_guess_topology_objects_out_of_order_init(self): u = mda.Universe( - datafiles.PDB_small, + datafiles.PDB_xsmall, to_guess=["dihedrals", "angles", "bonds"], guess_bonds=False, ) - assert len(u.atoms.angles) == 6123 - assert len(u.atoms.dihedrals) == 8921 + assert len(u.atoms.angles) == 290 + assert len(u.atoms.dihedrals) == 411 def test_guess_topology_objects_out_of_order_guess(self): - u = mda.Universe(datafiles.PDB_small) + u = mda.Universe(datafiles.PDB_xsmall) with pytest.raises(NoDataError): u.atoms.angles u.guess_TopologyAttrs( "default", to_guess=["dihedrals", "angles", "bonds"] ) - assert len(u.atoms.angles) == 6123 - assert len(u.atoms.dihedrals) == 8921 + assert len(u.atoms.angles) == 290 + assert len(u.atoms.dihedrals) == 411 def test_force_guess_overwrites_existing_bonds(self): u = mda.Universe(datafiles.CONECT) @@ -205,7 +205,7 @@ def test_force_guess_overwrites_existing_bonds(self): assert len(u.atoms.bonds) == 0 def test_guessing_angles_respects_bond_kwargs(self): - u = mda.Universe(datafiles.PDB) + u = mda.Universe(datafiles.PDB_xsmall) assert not hasattr(u.atoms, "angles") # This low radius should find no angles @@ -217,7 +217,7 @@ def test_guessing_angles_respects_bond_kwargs(self): # set higher radii for lots of angles! vdw = dict.fromkeys(set(u.atoms.types), 1) u.guess_TopologyAttrs("default", force_guess=["angles"], vdwradii=vdw) - assert len(u.atoms.angles) == 89466 + assert len(u.atoms.angles) == 7 def test_guessing_dihedrals_respects_bond_kwargs(self): u = mda.Universe(datafiles.CONECT) @@ -241,7 +241,7 @@ def test_guess_unsupported_attribute(self): def test_guess_singular(self): default_guesser = get_guesser("default") - u = mda.Universe(datafiles.PDB, to_guess=[]) + u = mda.Universe(datafiles.PDB_xsmall, to_guess=[]) assert not hasattr(u.atoms, "masses") default_guesser._universe = u @@ -252,12 +252,12 @@ def test_Universe_guess_bonds_deprecated(): with pytest.warns( DeprecationWarning, match="`guess_bonds` keyword is deprecated" ): - u = mda.Universe(datafiles.PDB_full, guess_bonds=True) + u = mda.Universe(datafiles.PDB_xsmall, guess_bonds=True) @pytest.mark.parametrize( "universe_input", - [datafiles.DCD, datafiles.XTC, np.random.rand(3, 3), datafiles.PDB], + [datafiles.DCD, datafiles.XTC, np.random.rand(3, 3), datafiles.PDB_xsmall], ) def test_universe_creation_from_coordinates(universe_input): mda.Universe(universe_input)