Skip to content

Commit

Permalink
Bugfixed chain ID assignment in addSolvent (openmm#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
murfalo committed Jun 21, 2024
1 parent 6bf10e1 commit d241d84
Show file tree
Hide file tree
Showing 2 changed files with 250 additions and 5 deletions.
229 changes: 229 additions & 0 deletions output.pdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
REMARK 1 PDBFIXER FROM: http://www.rcsb.org/pdb/files/1LE1.pdb
REMARK 1 CREATED WITH OPENMM 8.1.1, 2024-06-21
CRYST1 1.000 1.000 1.000 90.00 90.00 90.00 P 1 1
ATOM 1 N SER A 1 -2.559 9.064 0.084 1.00 0.00 N
ATOM 2 CA SER A 1 -3.245 8.118 0.982 1.00 0.00 C
ATOM 3 C SER A 1 -2.725 6.697 0.804 1.00 0.00 C
ATOM 4 O SER A 1 -2.635 6.180 -0.308 1.00 0.00 O
ATOM 5 CB SER A 1 -4.757 8.129 0.767 1.00 0.00 C
ATOM 6 OG SER A 1 -5.352 7.344 1.778 1.00 0.00 O
ATOM 7 H SER A 1 -2.882 10.004 0.269 1.00 0.00 H
ATOM 8 H2 SER A 1 -2.761 8.824 -0.877 1.00 0.00 H
ATOM 9 H3 SER A 1 -1.562 9.017 0.240 1.00 0.00 H
ATOM 10 HA SER A 1 -3.047 8.429 2.008 1.00 0.00 H
ATOM 11 HB2 SER A 1 -5.133 9.150 0.836 1.00 0.00 H
ATOM 12 HB3 SER A 1 -4.998 7.717 -0.215 1.00 0.00 H
ATOM 13 HG SER A 1 -6.291 7.248 1.593 1.00 0.00 H
ATOM 14 N TRP A 2 -2.371 6.035 1.905 1.00 0.00 N
ATOM 15 CA TRP A 2 -2.055 4.608 1.891 1.00 0.00 C
ATOM 16 C TRP A 2 -3.337 3.758 1.821 1.00 0.00 C
ATOM 17 O TRP A 2 -4.252 3.931 2.622 1.00 0.00 O
ATOM 18 CB TRP A 2 -1.194 4.267 3.114 1.00 0.00 C
ATOM 19 CG TRP A 2 0.197 4.832 3.076 1.00 0.00 C
ATOM 20 CD1 TRP A 2 0.672 5.854 3.826 1.00 0.00 C
ATOM 21 CD2 TRP A 2 1.330 4.366 2.280 1.00 0.00 C
ATOM 22 NE1 TRP A 2 2.018 6.036 3.562 1.00 0.00 N
ATOM 23 CE2 TRP A 2 2.492 5.094 2.669 1.00 0.00 C
ATOM 24 CE3 TRP A 2 1.495 3.358 1.307 1.00 0.00 C
ATOM 25 CZ2 TRP A 2 3.768 4.797 2.159 1.00 0.00 C
ATOM 26 CZ3 TRP A 2 2.769 3.041 0.797 1.00 0.00 C
ATOM 27 CH2 TRP A 2 3.905 3.751 1.227 1.00 0.00 C
ATOM 28 H TRP A 2 -2.515 6.481 2.797 1.00 0.00 H
ATOM 29 HA TRP A 2 -1.466 4.390 0.999 1.00 0.00 H
ATOM 30 HB2 TRP A 2 -1.695 4.583 4.032 1.00 0.00 H
ATOM 31 HB3 TRP A 2 -1.099 3.183 3.166 1.00 0.00 H
ATOM 32 HD1 TRP A 2 0.088 6.419 4.542 1.00 0.00 H
ATOM 33 HE1 TRP A 2 2.582 6.754 3.994 1.00 0.00 H
ATOM 34 HE3 TRP A 2 0.626 2.811 0.982 1.00 0.00 H
ATOM 35 HZ2 TRP A 2 4.635 5.351 2.483 1.00 0.00 H
ATOM 36 HZ3 TRP A 2 2.884 2.242 0.079 1.00 0.00 H
ATOM 37 HH2 TRP A 2 4.877 3.489 0.834 1.00 0.00 H
ATOM 38 N THR A 3 -3.413 2.838 0.851 1.00 0.00 N
ATOM 39 CA THR A 3 -4.485 1.827 0.703 1.00 0.00 C
ATOM 40 C THR A 3 -3.862 0.430 0.545 1.00 0.00 C
ATOM 41 O THR A 3 -2.723 0.300 0.086 1.00 0.00 O
ATOM 42 CB THR A 3 -5.403 2.197 -0.476 1.00 0.00 C
ATOM 43 OG1 THR A 3 -5.975 3.465 -0.238 1.00 0.00 O
ATOM 44 CG2 THR A 3 -6.572 1.229 -0.680 1.00 0.00 C
ATOM 45 H THR A 3 -2.644 2.788 0.185 1.00 0.00 H
ATOM 46 HA THR A 3 -5.108 1.793 1.602 1.00 0.00 H
ATOM 47 HB THR A 3 -4.812 2.237 -1.391 1.00 0.00 H
ATOM 48 HG1 THR A 3 -5.743 3.735 0.657 1.00 0.00 H
ATOM 49 HG21 THR A 3 -7.275 1.661 -1.392 1.00 0.00 H
ATOM 50 HG22 THR A 3 -6.213 0.281 -1.082 1.00 0.00 H
ATOM 51 HG23 THR A 3 -7.091 1.058 0.264 1.00 0.00 H
ATOM 52 N TRP A 4 -4.554 -0.599 1.052 1.00 0.00 N
ATOM 53 CA TRP A 4 -4.077 -1.984 1.068 1.00 0.00 C
ATOM 54 C TRP A 4 -4.328 -2.716 -0.248 1.00 0.00 C
ATOM 55 O TRP A 4 -5.463 -2.831 -0.716 1.00 0.00 O
ATOM 56 CB TRP A 4 -4.744 -2.756 2.214 1.00 0.00 C
ATOM 57 CG TRP A 4 -4.431 -4.227 2.295 1.00 0.00 C
ATOM 58 CD1 TRP A 4 -5.181 -5.229 1.780 1.00 0.00 C
ATOM 59 CD2 TRP A 4 -3.312 -4.881 2.961 1.00 0.00 C
ATOM 60 NE1 TRP A 4 -4.628 -6.450 2.123 1.00 0.00 N
ATOM 61 CE2 TRP A 4 -3.489 -6.292 2.884 1.00 0.00 C
ATOM 62 CE3 TRP A 4 -2.176 -4.415 3.650 1.00 0.00 C
ATOM 63 CZ2 TRP A 4 -2.612 -7.193 3.506 1.00 0.00 C
ATOM 64 CZ3 TRP A 4 -1.275 -5.303 4.261 1.00 0.00 C
ATOM 65 CH2 TRP A 4 -1.502 -6.689 4.209 1.00 0.00 C
ATOM 66 H TRP A 4 -5.470 -0.430 1.438 1.00 0.00 H
ATOM 67 HA TRP A 4 -3.000 -1.963 1.222 1.00 0.00 H
ATOM 68 HB2 TRP A 4 -4.447 -2.298 3.158 1.00 0.00 H
ATOM 69 HB3 TRP A 4 -5.827 -2.650 2.125 1.00 0.00 H
ATOM 70 HD1 TRP A 4 -6.098 -5.083 1.221 1.00 0.00 H
ATOM 71 HE1 TRP A 4 -5.056 -7.336 1.896 1.00 0.00 H
ATOM 72 HE3 TRP A 4 -2.013 -3.352 3.697 1.00 0.00 H
ATOM 73 HZ2 TRP A 4 -2.783 -8.258 3.448 1.00 0.00 H
ATOM 74 HZ3 TRP A 4 -0.408 -4.915 4.776 1.00 0.00 H
ATOM 75 HH2 TRP A 4 -0.808 -7.360 4.698 1.00 0.00 H
ATOM 76 N GLU A 5 -3.270 -3.336 -0.771 1.00 0.00 N
ATOM 77 CA GLU A 5 -3.331 -4.152 -1.962 1.00 0.00 C
ATOM 78 C GLU A 5 -2.415 -5.368 -1.752 1.00 0.00 C
ATOM 79 O GLU A 5 -1.233 -5.215 -1.452 1.00 0.00 O
ATOM 80 CB GLU A 5 -2.966 -3.283 -3.174 1.00 0.00 C
ATOM 81 CG GLU A 5 -3.063 -4.020 -4.514 1.00 0.00 C
ATOM 82 CD GLU A 5 -2.697 -3.073 -5.657 1.00 0.00 C
ATOM 83 OE1 GLU A 5 -1.480 -2.841 -5.839 1.00 0.00 O
ATOM 84 OE2 GLU A 5 -3.635 -2.580 -6.321 1.00 0.00 O
ATOM 85 H GLU A 5 -2.371 -3.284 -0.290 1.00 0.00 H
ATOM 86 HA GLU A 5 -4.370 -4.452 -2.081 1.00 0.00 H
ATOM 87 HB2 GLU A 5 -3.664 -2.443 -3.211 1.00 0.00 H
ATOM 88 HB3 GLU A 5 -1.959 -2.884 -3.050 1.00 0.00 H
ATOM 89 HG2 GLU A 5 -2.386 -4.874 -4.521 1.00 0.00 H
ATOM 90 HG3 GLU A 5 -4.083 -4.385 -4.654 1.00 0.00 H
ATOM 91 N ASN A 6 -2.982 -6.575 -1.867 1.00 0.00 N
ATOM 92 CA ASN A 6 -2.345 -7.896 -1.830 1.00 0.00 C
ATOM 93 C ASN A 6 -1.084 -8.010 -0.944 1.00 0.00 C
ATOM 94 O ASN A 6 0.025 -8.210 -1.438 1.00 0.00 O
ATOM 95 CB ASN A 6 -2.094 -8.350 -3.282 1.00 0.00 C
ATOM 96 CG ASN A 6 -3.339 -8.330 -4.165 1.00 0.00 C
ATOM 97 OD1 ASN A 6 -4.454 -8.071 -3.735 1.00 0.00 O
ATOM 98 ND2 ASN A 6 -3.180 -8.596 -5.443 1.00 0.00 N
ATOM 99 H ASN A 6 -3.940 -6.600 -2.190 1.00 0.00 H
ATOM 100 HA ASN A 6 -3.072 -8.587 -1.403 1.00 0.00 H
ATOM 101 HB2 ASN A 6 -1.344 -7.695 -3.728 1.00 0.00 H
ATOM 102 HB3 ASN A 6 -1.699 -9.366 -3.269 1.00 0.00 H
ATOM 103 HD21 ASN A 6 -2.284 -8.823 -5.835 1.00 0.00 H
ATOM 104 HD22 ASN A 6 -4.022 -8.532 -5.988 1.00 0.00 H
ATOM 105 N GLY A 7 -1.264 -7.970 0.384 1.00 0.00 N
ATOM 106 CA GLY A 7 -0.160 -8.111 1.339 1.00 0.00 C
ATOM 107 C GLY A 7 0.656 -6.840 1.602 1.00 0.00 C
ATOM 108 O GLY A 7 1.564 -6.899 2.431 1.00 0.00 O
ATOM 109 H GLY A 7 -2.197 -7.857 0.747 1.00 0.00 H
ATOM 110 HA2 GLY A 7 -0.543 -8.470 2.292 1.00 0.00 H
ATOM 111 HA3 GLY A 7 0.535 -8.859 0.962 1.00 0.00 H
ATOM 112 N LYS A 8 0.365 -5.710 0.937 1.00 0.00 N
ATOM 113 CA LYS A 8 1.145 -4.471 1.064 1.00 0.00 C
ATOM 114 C LYS A 8 0.266 -3.216 1.125 1.00 0.00 C
ATOM 115 O LYS A 8 -0.934 -3.239 0.848 1.00 0.00 O
ATOM 116 CB LYS A 8 2.150 -4.394 -0.110 1.00 0.00 C
ATOM 117 CG LYS A 8 3.542 -3.884 0.304 1.00 0.00 C
ATOM 118 CD LYS A 8 4.385 -4.972 0.988 1.00 0.00 C
ATOM 119 CE LYS A 8 5.706 -4.394 1.504 1.00 0.00 C
ATOM 120 NZ LYS A 8 6.664 -5.459 1.847 1.00 0.00 N
ATOM 121 H LYS A 8 -0.372 -5.725 0.233 1.00 0.00 H
ATOM 122 HA LYS A 8 1.697 -4.515 2.003 1.00 0.00 H
ATOM 123 HB2 LYS A 8 2.269 -5.375 -0.576 1.00 0.00 H
ATOM 124 HB3 LYS A 8 1.746 -3.729 -0.878 1.00 0.00 H
ATOM 125 HG2 LYS A 8 4.070 -3.561 -0.595 1.00 0.00 H
ATOM 126 HG3 LYS A 8 3.441 -3.023 0.965 1.00 0.00 H
ATOM 127 HD2 LYS A 8 3.840 -5.406 1.825 1.00 0.00 H
ATOM 128 HD3 LYS A 8 4.596 -5.757 0.259 1.00 0.00 H
ATOM 129 HE2 LYS A 8 6.146 -3.760 0.735 1.00 0.00 H
ATOM 130 HE3 LYS A 8 5.513 -3.789 2.391 1.00 0.00 H
ATOM 131 HZ1 LYS A 8 6.347 -5.949 2.672 1.00 0.00 H
ATOM 132 HZ2 LYS A 8 6.732 -6.111 1.078 1.00 0.00 H
ATOM 133 HZ3 LYS A 8 7.572 -5.055 2.023 1.00 0.00 H
ATOM 134 N TRP A 9 0.893 -2.088 1.458 1.00 0.00 N
ATOM 135 CA TRP A 9 0.313 -0.755 1.333 1.00 0.00 C
ATOM 136 C TRP A 9 0.891 -0.114 0.065 1.00 0.00 C
ATOM 137 O TRP A 9 2.097 -0.196 -0.163 1.00 0.00 O
ATOM 138 CB TRP A 9 0.609 0.069 2.600 1.00 0.00 C
ATOM 139 CG TRP A 9 -0.079 -0.404 3.847 1.00 0.00 C
ATOM 140 CD1 TRP A 9 0.498 -1.073 4.870 1.00 0.00 C
ATOM 141 CD2 TRP A 9 -1.467 -0.192 4.246 1.00 0.00 C
ATOM 142 NE1 TRP A 9 -0.443 -1.315 5.854 1.00 0.00 N
ATOM 143 CE2 TRP A 9 -1.663 -0.753 5.540 1.00 0.00 C
ATOM 144 CE3 TRP A 9 -2.561 0.474 3.662 1.00 0.00 C
ATOM 145 CZ2 TRP A 9 -2.886 -0.653 6.225 1.00 0.00 C
ATOM 146 CZ3 TRP A 9 -3.793 0.583 4.333 1.00 0.00 C
ATOM 147 CH2 TRP A 9 -3.955 0.025 5.613 1.00 0.00 C
ATOM 148 H TRP A 9 1.886 -2.132 1.629 1.00 0.00 H
ATOM 149 HA TRP A 9 -0.769 -0.828 1.222 1.00 0.00 H
ATOM 150 HB2 TRP A 9 1.686 0.117 2.780 1.00 0.00 H
ATOM 151 HB3 TRP A 9 0.273 1.089 2.428 1.00 0.00 H
ATOM 152 HD1 TRP A 9 1.537 -1.375 4.900 1.00 0.00 H
ATOM 153 HE1 TRP A 9 -0.239 -1.812 6.709 1.00 0.00 H
ATOM 154 HE3 TRP A 9 -2.427 0.937 2.700 1.00 0.00 H
ATOM 155 HZ2 TRP A 9 -3.006 -1.088 7.206 1.00 0.00 H
ATOM 156 HZ3 TRP A 9 -4.612 1.116 3.872 1.00 0.00 H
ATOM 157 HH2 TRP A 9 -4.902 0.125 6.125 1.00 0.00 H
ATOM 158 N THR A 10 0.046 0.531 -0.748 1.00 0.00 N
ATOM 159 CA THR A 10 0.472 1.375 -1.878 1.00 0.00 C
ATOM 160 C THR A 10 -0.111 2.787 -1.735 1.00 0.00 C
ATOM 161 O THR A 10 -1.171 2.979 -1.125 1.00 0.00 O
ATOM 162 CB THR A 10 0.194 0.708 -3.240 1.00 0.00 C
ATOM 163 OG1 THR A 10 0.757 1.509 -4.251 1.00 0.00 O
ATOM 164 CG2 THR A 10 -1.276 0.504 -3.601 1.00 0.00 C
ATOM 165 H THR A 10 -0.945 0.541 -0.504 1.00 0.00 H
ATOM 166 HA THR A 10 1.556 1.498 -1.838 1.00 0.00 H
ATOM 167 HB THR A 10 0.687 -0.265 -3.261 1.00 0.00 H
ATOM 168 HG1 THR A 10 0.380 1.228 -5.089 1.00 0.00 H
ATOM 169 HG21 THR A 10 -1.745 -0.171 -2.886 1.00 0.00 H
ATOM 170 HG22 THR A 10 -1.798 1.459 -3.601 1.00 0.00 H
ATOM 171 HG23 THR A 10 -1.350 0.056 -4.594 1.00 0.00 H
ATOM 172 N TRP A 11 0.643 3.792 -2.196 1.00 0.00 N
ATOM 173 CA TRP A 11 0.305 5.209 -2.062 1.00 0.00 C
ATOM 174 C TRP A 11 -0.622 5.647 -3.206 1.00 0.00 C
ATOM 175 O TRP A 11 -0.177 5.884 -4.329 1.00 0.00 O
ATOM 176 CB TRP A 11 1.592 6.054 -1.964 1.00 0.00 C
ATOM 177 CG TRP A 11 1.401 7.529 -1.750 1.00 0.00 C
ATOM 178 CD1 TRP A 11 1.538 8.480 -2.702 1.00 0.00 C
ATOM 179 CD2 TRP A 11 1.030 8.244 -0.531 1.00 0.00 C
ATOM 180 NE1 TRP A 11 1.312 9.728 -2.152 1.00 0.00 N
ATOM 181 CE2 TRP A 11 0.978 9.641 -0.817 1.00 0.00 C
ATOM 182 CE3 TRP A 11 0.706 7.853 0.784 1.00 0.00 C
ATOM 183 CZ2 TRP A 11 0.647 10.599 0.155 1.00 0.00 C
ATOM 184 CZ3 TRP A 11 0.382 8.801 1.772 1.00 0.00 C
ATOM 185 CH2 TRP A 11 0.357 10.171 1.463 1.00 0.00 C
ATOM 186 H TRP A 11 1.478 3.551 -2.712 1.00 0.00 H
ATOM 187 HA TRP A 11 -0.252 5.330 -1.135 1.00 0.00 H
ATOM 188 HB2 TRP A 11 2.197 5.673 -1.139 1.00 0.00 H
ATOM 189 HB3 TRP A 11 2.187 5.915 -2.865 1.00 0.00 H
ATOM 190 HD1 TRP A 11 1.807 8.280 -3.731 1.00 0.00 H
ATOM 191 HE1 TRP A 11 1.397 10.590 -2.672 1.00 0.00 H
ATOM 192 HE3 TRP A 11 0.700 6.801 1.022 1.00 0.00 H
ATOM 193 HZ2 TRP A 11 0.636 11.651 -0.090 1.00 0.00 H
ATOM 194 HZ3 TRP A 11 0.145 8.475 2.774 1.00 0.00 H
ATOM 195 HH2 TRP A 11 0.115 10.892 2.231 1.00 0.00 H
ATOM 196 N LYS A 12 -1.927 5.732 -2.914 1.00 0.00 N
ATOM 197 CA LYS A 12 -3.002 6.119 -3.835 1.00 0.00 C
ATOM 198 C LYS A 12 -3.384 7.586 -3.620 1.00 0.00 C
ATOM 199 O LYS A 12 -3.583 8.050 -2.504 1.00 0.00 O
ATOM 200 CB LYS A 12 -4.237 5.217 -3.619 1.00 0.00 C
ATOM 201 CG LYS A 12 -4.022 3.714 -3.888 1.00 0.00 C
ATOM 202 CD LYS A 12 -3.661 3.366 -5.343 1.00 0.00 C
ATOM 203 CE LYS A 12 -4.848 3.505 -6.302 1.00 0.00 C
ATOM 204 NZ LYS A 12 -4.396 3.513 -7.704 1.00 0.00 N
ATOM 205 H LYS A 12 -2.195 5.599 -1.939 1.00 0.00 H
ATOM 206 HA LYS A 12 -2.646 6.011 -4.859 1.00 0.00 H
ATOM 207 HB2 LYS A 12 -4.570 5.328 -2.585 1.00 0.00 H
ATOM 208 HB3 LYS A 12 -5.045 5.573 -4.260 1.00 0.00 H
ATOM 209 HG2 LYS A 12 -3.231 3.350 -3.234 1.00 0.00 H
ATOM 210 HG3 LYS A 12 -4.936 3.182 -3.623 1.00 0.00 H
ATOM 211 HD2 LYS A 12 -2.842 4.002 -5.679 1.00 0.00 H
ATOM 212 HD3 LYS A 12 -3.318 2.333 -5.383 1.00 0.00 H
ATOM 213 HE2 LYS A 12 -5.530 2.667 -6.154 1.00 0.00 H
ATOM 214 HE3 LYS A 12 -5.380 4.433 -6.095 1.00 0.00 H
ATOM 215 HZ1 LYS A 12 -4.031 2.603 -7.947 1.00 0.00 H
ATOM 216 HZ2 LYS A 12 -5.169 3.739 -8.313 1.00 0.00 H
ATOM 217 HZ3 LYS A 12 -3.668 4.205 -7.814 1.00 0.00 H
HETATM 218 N NH2 A 13 -3.537 8.337 -4.700 1.00 0.00 N
HETATM 219 HN1 NH2 A 13 -3.387 7.953 -5.617 1.00 0.00 H
HETATM 220 HN2 NH2 A 13 -3.795 9.301 -4.560 1.00 0.00 H
TER 221 NH2 A 13
CONECT 198 218
CONECT 218 198 219 220
CONECT 219 218
CONECT 220 218
END
26 changes: 21 additions & 5 deletions pdbfixer/pdbfixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,12 +1094,28 @@ def addSolvent(self, boxSize=None, padding=None, boxVectors=None, positiveIon='N

modeller = app.Modeller(self.topology, self.positions)
forcefield = self._createForceField(self.topology, True)
original_chains = list(modeller.topology.chains())
modeller.addSolvent(forcefield, padding=padding, boxSize=boxSize, boxVectors=boxVectors, boxShape=boxShape, positiveIon=positiveIon, negativeIon=negativeIon, ionicStrength=ionicStrength)
chains = list(modeller.topology.chains())
if len(chains) == 1:
chains[0].id = 'A'
else:
chains[-1].id = chr(ord(chains[-2].id)+1)
new_chains = list(modeller.topology.chains())
added_chain_indices = range(len(original_chains), len(new_chains))
assert 1 <= len(added_chain_indices) <= 2, "Expected a new solvent chain and optionally a new ion chain"

for added_chain_index in added_chain_indices:
added_chain = new_chains[added_chain_index]
assert added_chain.id.isnumeric(), "Expected numeric chain ID assigned by modeller.addSolvent"

# If the last chain ID is a letter between A and Y, assign the next letter for the added chain ID.
if added_chain_index > 0:
prev_chain_id = new_chains[added_chain_index - 1].id
if len(prev_chain_id) == 1 and prev_chain_id.isalpha():
abet_index = ord(prev_chain_id.upper()) - ord("A") + 1
if abet_index < 26:
# A-Z
added_chain.id = chr(ord("A") + abet_index)
else:
# Otherwise, leave the ID as a string representing its index.
pass

self.topology = modeller.topology
self.positions = modeller.positions

Expand Down

0 comments on commit d241d84

Please sign in to comment.