Package test_suite :: Package system_tests :: Module structure
[hide private]
[frames] | no frames]

Source Code for Module test_suite.system_tests.structure

   1  ############################################################################### 
   2  #                                                                             # 
   3  # Copyright (C) 2008-2014 Edward d'Auvergne                                   # 
   4  #                                                                             # 
   5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
   6  #                                                                             # 
   7  # This program is free software: you can redistribute it and/or modify        # 
   8  # it under the terms of the GNU General Public License as published by        # 
   9  # the Free Software Foundation, either version 3 of the License, or           # 
  10  # (at your option) any later version.                                         # 
  11  #                                                                             # 
  12  # This program is distributed in the hope that it will be useful,             # 
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
  15  # GNU General Public License for more details.                                # 
  16  #                                                                             # 
  17  # You should have received a copy of the GNU General Public License           # 
  18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
  19  #                                                                             # 
  20  ############################################################################### 
  21   
  22  # Python module imports. 
  23  from math import sqrt 
  24  from numpy import float64, zeros 
  25  from os import sep 
  26  from tempfile import mktemp 
  27   
  28  # relax module imports. 
  29  from data_store import Relax_data_store; ds = Relax_data_store() 
  30  from pipe_control.mol_res_spin import count_spins, return_spin, spin_loop 
  31  from lib.geometry.rotations import euler_to_R_zyz 
  32  from lib.errors import RelaxError 
  33  from lib.io import DummyFileObject 
  34  from status import Status; status = Status() 
  35  from test_suite.system_tests.base_classes import SystemTestCase 
  36   
  37   
38 -class Structure(SystemTestCase):
39 """Class for testing the structural objects.""" 40
41 - def setUp(self):
42 """Set up for all the functional tests.""" 43 44 # Create the data pipe. 45 self.interpreter.pipe.create('mf', 'mf')
46 47
48 - def strip_remarks(self, lines):
49 """Strip out all PDB remark lines. 50 51 @param lines: The list of PDB lines. 52 @type lines: list of str 53 """ 54 55 # Rebuild the list. 56 lines[:] = [x for x in lines if x[:6] != 'REMARK']
57 58
59 - def test_alt_loc_missing(self):
60 """Test that a RelaxError occurs when the alternate location indicator is present but not specified.""" 61 62 # Path of the structure file. 63 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 64 65 # Load the file, load the spins, and attach the protons. 66 self.assertRaises(RelaxError, self.interpreter.structure.read_pdb, '1OGT_trunc.pdb', dir=path)
67 68
70 """Test the bug reported as the U{support request #2998<https://web.archive.org/web/https://gna.org/support/?2998>}, the broken CONECT records.""" 71 72 # Path of the structure file. 73 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 74 75 # Load the file. 76 self.interpreter.structure.read_pdb('1RTE_trunc.pdb', dir=path)
77 78
80 """Catch U{bug #20470<https://web.archive.org/web/https://gna.org/bugs/?20470>}, the alternate location indicator problem.""" 81 82 # Path of the structure file. 83 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 84 85 # Load the file, load the spins, and attach the protons. 86 self.interpreter.structure.read_pdb('1OGT_trunc.pdb', dir=path, alt_loc='A') 87 self.interpreter.structure.load_spins(spin_id='@N', ave_pos=True) 88 self.interpreter.sequence.attach_protons()
89 90
92 """Catch U{bug #21187<https://web.archive.org/web/https://gna.org/bugs/?21187>}, the corrupted PDB with all proton atoms numbers set to zero.""" 93 94 # Path of the structure file. 95 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 96 97 # Load the file. 98 self.interpreter.structure.read_pdb('bug_21187_molecule.pdb', dir=path) 99 100 # Load the @N, @H, and @NE1 spins (needed to create the :60@0 spin to trigger the bug later). 101 self.interpreter.structure.load_spins(spin_id='@N', ave_pos=True) 102 self.interpreter.structure.load_spins(spin_id='@NE1', ave_pos=True) 103 self.interpreter.structure.load_spins(spin_id='@H', ave_pos=True) 104 105 # Load the :60@HE1 spin - this clashes with the :60@H spin as both have the spin ID of ':60@0'. 106 self.interpreter.structure.load_spins(spin_id='@HE1', ave_pos=True)
107 108
110 """Catch U{bug #21522<https://web.archive.org/web/https://gna.org/bugs/?21522>}, the structure.write_pdb user function creating an incorrect MASTER record. 111 112 This also triggers U{bug #21520<https://web.archive.org/web/https://gna.org/bugs/?21520>}, the failure of the structure.write_pdb user function when creating the MASTER record due to too many ATOM and HETATM records being present. 113 """ 114 115 # Create 2 models. 116 self.interpreter.structure.add_model(model_num=1) 117 self.interpreter.structure.add_model(model_num=2) 118 119 # Add a single atom. 120 self.interpreter.structure.add_atom(atom_name='N', res_name='Pro', res_num=2, pos=[1., 2., 3.], element='N') 121 122 # Create a PDB file. 123 file = DummyFileObject() 124 self.interpreter.structure.write_pdb(file=file, force=True) 125 126 # The file contents, without remarks, as they should be. 127 contents = [ 128 "MODEL 1 \n", 129 "ATOM 1 N Pro A 2 1.000 2.000 3.000 1.00 0.00 N \n", 130 "TER 2 Pro A 2 \n", 131 "ENDMDL \n", 132 "MODEL 2 \n", 133 "ATOM 1 N Pro A 2 1.000 2.000 3.000 1.00 0.00 N \n", 134 "TER 2 Pro A 2 \n", 135 "ENDMDL \n", 136 "MASTER 0 0 0 0 0 0 0 0 1 1 0 0 \n", 137 "END \n" 138 ] 139 140 # Check the created PDB file. 141 lines = file.readlines() 142 self.strip_remarks(lines) 143 for i in range(len(lines)): 144 self.assertEqual(contents[i], lines[i])
145 146
148 """Catch U{bug #21814<https://web.archive.org/web/https://gna.org/bugs/?21814>}, the PDB reading failure when not padded to 80 spaces.""" 149 150 # Path of the structure file. 151 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 152 153 # Load the file. 154 self.interpreter.structure.read_pdb('SpUreE_dimer_H_new', dir=path)
155 156
158 """Catch U{bug #22041<https://web.archive.org/web/https://gna.org/bugs/?22041>}, the atom serial number not being sequential from 1 onwards.""" 159 160 # Path of the structure file. 161 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 162 163 # Read a PDB file twice as two different molecules. 164 self.interpreter.structure.read_pdb('1RTE_trunc.pdb', dir=path, set_mol_name='N-dom') 165 self.interpreter.structure.read_pdb('1RTE_trunc.pdb', dir=path, set_mol_name='C-dom') 166 167 # Create a PDB file. 168 file = DummyFileObject() 169 self.interpreter.structure.write_pdb(file=file, force=True) 170 171 # The file contents, without remarks, as they should be. 172 contents = [ 173 "HET CYN A 445 1 \n", 174 "HET CYN B 445 1 \n", 175 "HETNAM CYN UNKNOWN \n", 176 "FORMUL 1 CYN C1 \n", 177 "ATOM 1 N LEU A 3 49.617 4.693 46.426 1.00 0.00 N \n", 178 "ATOM 2 CA LEU A 3 49.432 5.476 45.190 1.00 0.00 C \n", 179 "ATOM 3 C LEU A 3 50.346 4.980 44.055 1.00 0.00 C \n", 180 "ATOM 4 O LEU A 3 49.924 4.868 42.889 1.00 0.00 O \n", 181 "ATOM 5 CB LEU A 3 49.673 6.968 45.457 1.00 0.00 C \n", 182 "ATOM 6 CG LEU A 3 49.804 7.863 44.222 1.00 0.00 C \n", 183 "ATOM 7 CD1 LEU A 3 48.564 7.837 43.327 1.00 0.00 C \n", 184 "ATOM 8 CD2 LEU A 3 50.075 9.282 44.625 1.00 0.00 C \n", 185 "TER 9 LEU A 3 \n", 186 "HETATM 10 C CYN A 445 29.160 13.127 62.533 1.00 0.00 C \n", 187 "ATOM 11 N LEU B 3 49.617 4.693 46.426 1.00 0.00 N \n", 188 "ATOM 12 CA LEU B 3 49.432 5.476 45.190 1.00 0.00 C \n", 189 "ATOM 13 C LEU B 3 50.346 4.980 44.055 1.00 0.00 C \n", 190 "ATOM 14 O LEU B 3 49.924 4.868 42.889 1.00 0.00 O \n", 191 "ATOM 15 CB LEU B 3 49.673 6.968 45.457 1.00 0.00 C \n", 192 "ATOM 16 CG LEU B 3 49.804 7.863 44.222 1.00 0.00 C \n", 193 "ATOM 17 CD1 LEU B 3 48.564 7.837 43.327 1.00 0.00 C \n", 194 "ATOM 18 CD2 LEU B 3 50.075 9.282 44.625 1.00 0.00 C \n", 195 "TER 19 LEU B 3 \n", 196 "HETATM 20 C CYN B 445 29.160 13.127 62.533 1.00 0.00 C \n", 197 "MASTER 0 0 2 0 0 0 0 0 18 2 0 0 \n", 198 "END \n" 199 ] 200 201 # Check the created PDB file. 202 lines = file.readlines() 203 self.strip_remarks(lines) 204 for i in range(len(lines)): 205 self.assertEqual(contents[i], lines[i])
206 207
209 """Catch U{bug #22069<https://web.archive.org/web/https://gna.org/bugs/?22069>}, the failure of the structure.delete user function with helix attribute errors.""" 210 211 # Path of the structure file. 212 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam' 213 214 # Load the structure. 215 self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path) 216 217 # Delete the calciums. 218 self.interpreter.structure.delete(atom_id='@CA')
219 220
222 """Catch U{bug #22070<https://web.archive.org/web/https://gna.org/bugs/?22070>}, the failure of the structure.superimpose user function after deleting atoms with structure.delete.""" 223 224 # Path of the structure file. 225 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam' 226 227 # Load the structures to superimpose. 228 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_mol_name='C-dom', set_model_num=1) 229 self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, set_mol_name='C-dom', set_model_num=2) 230 231 # Delete the calciums. 232 self.interpreter.structure.delete(atom_id='@CA') 233 234 # Check the deleted atoms of both models (the last atoms should now be the last ATOM record proton and not the HETATOM CA). 235 for i in range(2): 236 print("Checking the last atom of model %s." % i) 237 self.assertEqual(cdp.structure.structural_data[i].mol[0].atom_name[-1], 'H') 238 239 # Superimpose. 240 self.interpreter.structure.superimpose(method='fit to first', centre_type='CoM')
241 242
243 - def test_delete_empty(self):
244 """Test the deletion of non-existent structural data.""" 245 246 # Delete all structural data. 247 self.interpreter.structure.delete()
248 249
250 - def test_delete_multi_pipe(self):
251 """Test the deletion of structural data in only one pipe.""" 252 253 # Create a structure with a single atom. 254 self.interpreter.structure.add_atom(atom_name='PIV', res_name='M1', res_num=1, pos=[0., 1., 2.], element='S') 255 256 # Create a new data pipe. 257 self.interpreter.pipe.create('new', 'N-state') 258 259 # Create a structure with a single atom. 260 self.interpreter.structure.add_atom(atom_name='PIV', res_name='M1', res_num=2, pos=[4., 5., 6.], element='S') 261 262 # Delete all structural data. 263 self.interpreter.structure.delete() 264 265 # Checks. 266 self.assert_(hasattr(cdp, 'structure')) 267 self.assertEqual(len(cdp.structure.structural_data), 0) 268 self.interpreter.pipe.switch('mf') 269 self.assert_(hasattr(cdp, 'structure')) 270 self.assertEqual(len(cdp.structure.structural_data), 1)
271 272
273 - def test_displacement(self):
274 """Test of the structure.displacement user function.""" 275 276 # Path of the structure file. 277 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 278 279 # Load the file as two models. 280 self.interpreter.structure.read_pdb('Ap4Aase_res1-12.pdb', dir=path, set_model_num=1) 281 self.interpreter.structure.read_pdb('Ap4Aase_res1-12.pdb', dir=path, set_model_num=2) 282 283 # A rotation. 284 R = zeros((3, 3), float64) 285 euler_to_R_zyz(1.3, 0.4, 4.5, R) 286 287 # Rotate the second model. 288 self.interpreter.structure.rotate(R, model=2) 289 290 # Calculate the displacement. 291 self.interpreter.structure.displacement() 292 293 # Shift a third structure back using the calculated displacement. 294 self.interpreter.structure.read_pdb('Ap4Aase_res1-12.pdb', dir=path, set_model_num=3) 295 self.interpreter.structure.rotate(R, model=3) 296 297 # The data to check. 298 models = [1, 2] 299 trans_vect = [ 300 [[0.0, 0.0, 0.0], 301 [ 2.270857972754659, -1.811667138656451, 1.878400649688508]], 302 [[ -2.270857972754659, 1.811667138656451, -1.878400649688508], 303 [0.0, 0.0, 0.0]] 304 ] 305 dist = [ 306 [0.0000000000000000, 3.4593818457148173], 307 [3.4593818457148173, 0.0000000000000000] 308 ] 309 rot_axis = [ 310 [None, 311 [ 0.646165066909452, 0.018875759848125, -0.762964227206007]], 312 [[ -0.646165066909452, -0.018875759848125, 0.762964227206007], 313 None] 314 ] 315 angle = [ 316 [0.0000000000000000, 0.6247677290742989], 317 [0.6247677290742989, 0.0000000000000000] 318 ] 319 320 # Test the results. 321 self.assert_(hasattr(cdp.structure, 'displacements')) 322 for i in range(len(models)): 323 for j in range(len(models)): 324 # Check the translation. 325 self.assertAlmostEqual(cdp.structure.displacements._translation_distance[models[i]][models[j]], dist[i][j]) 326 for k in range(3): 327 self.assertAlmostEqual(cdp.structure.displacements._translation_vector[models[i]][models[j]][k], trans_vect[i][j][k]) 328 329 # Check the rotation. 330 self.assertAlmostEqual(cdp.structure.displacements._rotation_angle[models[i]][models[j]], angle[i][j]) 331 if rot_axis[i][j] != None: 332 for k in range(3): 333 self.assertAlmostEqual(cdp.structure.displacements._rotation_axis[models[i]][models[j]][k], rot_axis[i][j][k]) 334 335 # Save the results. 336 self.tmpfile = mktemp() 337 self.interpreter.state.save(self.tmpfile, dir=None, force=True) 338 339 # Reset relax. 340 self.interpreter.reset() 341 342 # Load the results. 343 self.interpreter.state.load(self.tmpfile) 344 345 # Test the re-loaded data. 346 self.assert_(hasattr(cdp.structure, 'displacements')) 347 for i in range(len(models)): 348 for j in range(len(models)): 349 # Check the translation. 350 self.assertAlmostEqual(cdp.structure.displacements._translation_distance[models[i]][models[j]], dist[i][j]) 351 for k in range(3): 352 self.assertAlmostEqual(cdp.structure.displacements._translation_vector[models[i]][models[j]][k], trans_vect[i][j][k]) 353 354 # Check the rotation. 355 self.assertAlmostEqual(cdp.structure.displacements._rotation_angle[models[i]][models[j]], angle[i][j]) 356 if rot_axis[i][j] != None: 357 for k in range(3): 358 self.assertAlmostEqual(cdp.structure.displacements._rotation_axis[models[i]][models[j]][k], rot_axis[i][j][k])
359 360
361 - def test_load_spins_mol_cat(self):
362 """Test the loading of spins from different molecules into one molecule container.""" 363 364 # Path of the files. 365 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 366 367 # Read the PDBs. 368 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, set_mol_name='L1') 369 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=path, set_mol_name='L2') 370 371 # Load a few protons. 372 self.interpreter.structure.load_spins('#L1:900@C1', mol_name_target='Lactose') 373 self.interpreter.structure.load_spins('#L2:900@C2', mol_name_target='Lactose') 374 375 # Check the spin data. 376 self.assertEqual(len(cdp.mol), 1) 377 self.assertEqual(cdp.mol[0].name, 'Lactose') 378 self.assertEqual(len(cdp.mol[0].res), 1) 379 self.assertEqual(cdp.mol[0].res[0].name, 'UNK') 380 self.assertEqual(cdp.mol[0].res[0].num, 900) 381 self.assertEqual(len(cdp.mol[0].res[0].spin), 2) 382 self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'C1') 383 self.assertEqual(cdp.mol[0].res[0].spin[0].num, 1) 384 self.assertEqual(cdp.mol[0].res[0].spin[1].name, 'C2') 385 self.assertEqual(cdp.mol[0].res[0].spin[1].num, 2)
386 387
388 - def test_load_internal_results(self):
389 """Load the PDB file using the information in a results file (using the internal structural object).""" 390 391 # Path of the files. 392 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 393 394 # Read the results file. 395 self.interpreter.results.read(file='str_internal', dir=path) 396 397 # Test the structure metadata. 398 self.assert_(hasattr(cdp, 'structure')) 399 self.assert_(hasattr(cdp.structure, 'structural_data')) 400 self.assert_(len(cdp.structure.structural_data)) 401 self.assert_(len(cdp.structure.structural_data[0].mol)) 402 403 mol = cdp.structure.structural_data[0].mol[0] 404 self.assertEqual(mol.file_name, 'Ap4Aase_res1-12.pdb') 405 self.assertEqual(mol.file_path, '') 406 self.assertEqual(mol.file_model, 1) 407 self.assertEqual(mol.file_mol_num, 1) 408 409 # The real atomic data. 410 atom_name = ['N', 'CA', '1HA', '2HA', 'C', 'O', '1HT', '2HT', '3HT', 'N', 'CD', 'CA', 'HA', 'CB', '1HB', '2HB', 'CG', '1HG', '2HG', '1HD', '2HD', 'C', 'O', 'N', 'H', 'CA', 'HA', 'CB', '1HB', '2HB', 'CG', 'HG', 'CD1', '1HD1', '2HD1', '3HD1', 'CD2', '1HD2', '2HD2', '3HD2', 'C', 'O', 'N', 'H', 'CA', '1HA', '2HA', 'C', 'O', 'N', 'H', 'CA', 'HA', 'CB', '1HB', '2HB', 'OG', 'HG', 'C', 'O', 'N', 'H', 'CA', 'HA', 'CB', '1HB', '2HB', 'CG', '1HG', '2HG', 'SD', 'CE', '1HE', '2HE', '3HE', 'C', 'O', 'N', 'H', 'CA', 'HA', 'CB', '1HB', '2HB', 'CG', 'OD1', 'OD2', 'C', 'O', 'N', 'H', 'CA', 'HA', 'CB', '1HB', '2HB', 'OG', 'HG', 'C', 'O', 'N', 'CD', 'CA', 'HA', 'CB', '1HB', '2HB', 'CG', '1HG', '2HG', '1HD', '2HD', 'C', 'O', 'N', 'CD', 'CA', 'HA', 'CB', '1HB', '2HB', 'CG', '1HG', '2HG', '1HD', '2HD', 'C', 'O', 'N', 'H', 'CA', 'HA', 'CB', '1HB', '2HB', 'CG', '1HG', '2HG', 'CD', 'OE1', 'OE2', 'C', 'O', 'N', 'H', 'CA', '1HA', '2HA', 'C', 'O'] 411 bonded = [[]]*174 412 chain_id = [None]*174 413 element = ['N', 'C', 'H', 'H', 'C', 'O', 'H', 'H', 'H', 'N', 'C', 'C', 'H', 'C', 'H', 'H', 'C', 'H', 'H', 'H', 'H', 'C', 'O', 'N', 'H', 'C', 'H', 'C', 'H', 'H', 'C', 'H', 'C', 'H', 'H', 'H', 'C', 'H', 'H', 'H', 'C', 'O', 'N', 'H', 'C', 'H', 'H', 'C', 'O', 'N', 'H', 'C', 'H', 'C', 'H', 'H', 'O', 'H', 'C', 'O', 'N', 'H', 'C', 'H', 'C', 'H', 'H', 'C', 'H', 'H', 'S', 'C', 'H', 'H', 'H', 'C', 'O', 'N', 'H', 'C', 'H', 'C', 'H', 'H', 'C', 'O', 'O', 'C', 'O', 'N', 'H', 'C', 'H', 'C', 'H', 'H', 'O', 'H', 'C', 'O', 'N', 'C', 'C', 'H', 'C', 'H', 'H', 'C', 'H', 'H', 'H', 'H', 'C', 'O', 'N', 'C', 'C', 'H', 'C', 'H', 'H', 'C', 'H', 'H', 'H', 'H', 'C', 'O', 'N', 'H', 'C', 'H', 'C', 'H', 'H', 'C', 'H', 'H', 'C', 'O', 'O', 'C', 'O', 'N', 'H', 'C', 'H', 'H', 'C', 'O'] 414 pdb_record = ['ATOM']*174 415 res_name = ['GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'MET', 'ASP', 'ASP', 'ASP', 'ASP', 'ASP', 'ASP', 'ASP', 'ASP', 'ASP', 'ASP', 'ASP', 'ASP', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'SER', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'PRO', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLU', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY', 'GLY'] 416 res_num = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12] 417 seg_id = [None]*174 418 x = [8.442, 7.469, 8.013, 6.825, 6.610, 6.827, 9.398, 8.180, 8.448, 5.613, 5.281, 4.714, 5.222, 3.646, 3.332, 2.800, 4.319, 4.853, 3.587, 6.162, 4.805, 4.075, 3.593, 4.074, 4.475, 3.498, 3.572, 2.025, 1.965, 1.609, 1.176, 1.823, 0.176, 0.096, 0.509, -0.789, 0.474, 0.809, -0.595, 0.707, 4.264, 4.364, 4.809, 4.697, 5.561, 6.220, 6.156, 4.659, 4.746, 3.786, 3.770, 2.851, 2.368, 1.785, 1.177, 1.165, 2.360, 1.690, 3.546, 3.804, 3.814, 3.563, 4.442, 4.984, 5.411, 6.192, 4.872, 6.068, 6.868, 5.332, 6.747, 6.155, 5.409, 6.977, 5.721, 3.369, 2.255, 3.703, 4.604, 2.753, 1.851, 3.329, 4.182, 3.644, 2.319, 1.992, 1.854, 2.419, 1.251, 3.451, 4.359, 3.267, 2.246, 4.223, 4.054, 4.040, 5.573, 6.142, 3.488, 4.276, 2.795, 1.828, 2.929, 2.810, 1.772, 0.912, 2.067, 1.505, 0.464, 2.138, 0.938, 2.273, 4.268, 4.585, 5.076, 4.776, 6.392, 6.925, 7.120, 7.968, 7.464, 6.130, 6.384, 6.135, 4.210, 4.246, 6.325, 5.263, 7.477, 8.281, 7.587, 7.039, 9.047, 9.133, 9.654, 9.590, 10.670, 9.215, 9.190, 10.055, 8.012, 7.007, 7.361, 6.144, 5.925, 5.555, 6.329, 4.814, 4.894, 4.761] 419 y = [10.188, 9.889, 9.712, 10.745, 8.674, 7.991, 10.291, 11.073, 9.416, 8.385, 9.152, 7.243, 6.302, 7.443, 6.483, 7.963, 8.253, 7.605, 8.842, 9.327, 10.088, 7.251, 8.285, 6.099, 5.309, 5.986, 4.953, 6.396, 7.471, 6.106, 5.775, 5.225, 4.796, 4.954, 3.787, 4.949, 6.853, 7.828, 6.775, 6.720, 6.853, 8.068, 6.222, 5.251, 6.956, 6.273, 7.706, 7.634, 8.841, 6.847, 5.889, 7.360, 6.511, 8.230, 7.620, 8.669, 9.269, 9.652, 8.174, 9.362, 7.546, 6.604, 8.253, 9.095, 7.354, 7.976, 6.886, 6.258, 5.824, 5.499, 6.846, 5.570, 5.985, 5.190, 4.766, 8.771, 8.245, 9.789, 10.161, 10.351, 10.605, 11.610, 11.341, 12.287, 12.322, 11.787, 13.410, 9.322, 9.015, 8.776, 9.052, 7.758, 7.826, 7.990, 8.977, 7.248, 7.894, 8.285, 6.370, 6.214, 5.342, 5.431, 3.973, 3.943, 3.230, 3.234, 2.212, 3.991, 3.892, 3.624, 5.960, 5.908, 3.339, 3.179, 2.980, 3.150, 2.375, 2.876, 2.616, 3.262, 1.675, 3.264, 4.305, 2.758, 4.055, 2.299, 0.876, 0.258, 0.312, 0.871, -1.106, -1.253, -1.489, -2.564, -1.049, -1.041, -1.011, -0.052, -1.970, -2.740, -1.931, -2.037, -1.962, -2.949, -2.983, -3.917, -4.588, -4.488, -3.289, -3.932] 420 z = [6.302, 7.391, 8.306, 7.526, 7.089, 6.087, 6.697, 5.822, 5.604, 7.943, 9.155, 7.752, 7.908, 8.829, 9.212, 8.407, 9.880, 10.560, 10.415, 9.754, 8.900, 6.374, 5.909, 5.719, 6.139, 4.391, 4.081, 4.415, 4.326, 5.367, 3.307, 2.640, 3.889, 4.956, 3.700, 3.430, 2.493, 2.814, 2.633, 1.449, 3.403, 3.572, 2.369, 2.281, 1.371, 0.855, 1.868, 0.359, 0.149, -0.269, -0.055, -1.268, -1.726, -0.608, 0.037, -1.377, 0.162, 0.731, -2.354, -2.175, -3.496, -3.603, -4.606, -4.199, -5.387, -5.803, -6.196, -4.563, -5.146, -4.350, -3.001, -1.895, -1.241, -1.307, -2.472, -5.551, -5.582, -6.328, -6.269, -7.274, -6.735, -7.913, -8.518, -7.133, -8.791, -9.871, -8.395, -8.346, -8.584, -8.977, -8.732, -10.002, -10.355, -11.174, -11.584, -11.936, -10.759, -11.425, -9.403, -8.469, -9.921, -11.030, -9.410, -8.336, -10.080, -9.428, -10.291, -11.333, -11.606, -12.128, -10.723, -11.893, -9.781, -10.959, -8.768, -7.344, -8.971, -9.765, -7.642, -7.816, -7.251, -6.715, -6.584, -5.765, -7.175, -6.955, -9.288, -9.222, -9.654, -9.696, -10.009, -10.928, -10.249, -10.194, -9.475, -11.596, -11.540, -11.813, -12.724, -13.193, -13.137, -8.947, -7.774, -9.383, -10.338, -8.477, -8.138, -9.017, -7.265, -6.226] 421 422 # Test the atomic data. 423 mol = cdp.structure.structural_data[0].mol[0] 424 for i in range(len(mol.atom_name)): 425 self.assertEqual(mol.atom_name[i], atom_name[i]) 426 self.assertEqual(mol.bonded[i], bonded[i]) 427 self.assertEqual(mol.chain_id[i], chain_id[i]) 428 self.assertEqual(mol.element[i], element[i]) 429 self.assertEqual(mol.pdb_record[i], pdb_record[i]) 430 self.assertEqual(mol.res_name[i], res_name[i]) 431 self.assertEqual(mol.res_num[i], res_num[i]) 432 self.assertEqual(mol.seg_id[i], seg_id[i]) 433 self.assertEqual(mol.x[i], x[i]) 434 self.assertEqual(mol.y[i], y[i]) 435 self.assertEqual(mol.z[i], z[i])
436 437
439 """Load the PDB file using the information in a results file (using the internal structural object).""" 440 441 # Path of the files. 442 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 443 444 # Read the results file. 445 self.interpreter.results.read(file=path+sep+'str_internal')
446 447
448 - def test_metadata_xml(self):
449 """Test the storage and loading of metadata into an XML state file.""" 450 451 # Load the file. 452 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 453 self.interpreter.structure.read_pdb('1UBQ.pdb', dir=path) 454 455 # Delete a big chunk of the molecule. 456 self.interpreter.structure.delete(":35-76") 457 458 # Delete all waters. 459 self.interpreter.structure.delete(":HOH") 460 461 # Write out the results file. 462 self.tmpfile = mktemp() + '.bz2' 463 self.interpreter.results.write(self.tmpfile, dir=None) 464 465 # Create a new data pipe and load the results. 466 self.interpreter.pipe.create('xml text', 'mf') 467 self.interpreter.results.read(self.tmpfile) 468 469 # What the data should look like. 470 helices = [ 471 ['H1', 'A', 'ILE', 23, 'A', 'GLU', 34, 1, 12] 472 ] 473 sheets = [ 474 [1, 'BET', 5, 'GLY', 'A', 10, None, 'VAL', 'A', 17, None, 0, None, None, None, None, None, None, None, None, None, None], 475 [2, 'BET', 5, 'MET', 'A', 1, None, 'THR', 'A', 7, None, -1, None, None, None, None, None, None, None, None, None, None] 476 ] 477 478 # Check the helix data. 479 self.assert_(hasattr(cdp.structure, 'helices')) 480 self.assertEqual(len(cdp.structure.helices), 1) 481 self.assertEqual(cdp.structure.helices[0], helices[0]) 482 483 # Check the sheet data. 484 self.assert_(hasattr(cdp.structure, 'sheets')) 485 self.assertEqual(len(cdp.structure.sheets), 2) 486 self.assertEqual(cdp.structure.sheets[0], sheets[0]) 487 self.assertEqual(cdp.structure.sheets[1], sheets[1])
488 489
491 """Load the structure from the 'strychnine_opt_cdcl3_b3lyp_gaussian.log.bz2' compressed Gaussian log file.""" 492 493 # Path of the files. 494 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 495 496 # Read the XYZ file. 497 self.interpreter.structure.read_gaussian(file='strychnine_opt_cdcl3_b3lyp_gaussian.log.bz2', dir=path, set_mol_name='strychnine') 498 499 # Test the molecule data. 500 self.assertEqual(len(cdp.structure.structural_data), 1) 501 self.assertEqual(len(cdp.structure.structural_data[0].mol), 1) 502 503 # Load the carbon atoms and test it. 504 self.interpreter.structure.load_spins('@C') 505 self.assertEqual(count_spins(), 21) 506 507 # Load the protons. 508 self.interpreter.structure.load_spins('@H') 509 self.assertEqual(count_spins(), 43) 510 511 # And now all the rest of the atoms. 512 self.interpreter.structure.load_spins() 513 514 # The actual data. 515 data = [ 516 [ 5, 'C', -0.258837, -2.073956, -0.558021], 517 [ 6, 'C', -0.824223, -1.406962, -1.808433], 518 [ 7, 'C', -1.741283, -0.250780, -1.378644], 519 [ 8, 'C', -0.819735, 0.828965, -0.783392], 520 [ 9, 'C', 0.003153, 0.334416, 0.415455], 521 [10, 'C', 2.358372, 0.448322, 0.162421], 522 [11, 'C', 3.667689, 0.888405, -0.010558], 523 [12, 'C', 4.632616, -0.056196, -0.360560], 524 [13, 'C', 4.303015, -1.398582, -0.525823], 525 [14, 'C', 2.988069, -1.825141, -0.331972], 526 [15, 'C', 2.015427, -0.899636, 0.012625], 527 [16, 'C', 0.561728, -1.122705, 0.360284], 528 [17, 'C', 0.390886, -1.834862, 1.723978], 529 [18, 'C', -1.067936, -2.282629, 1.709808], 530 [19, 'C', -2.708975, -2.252045, -0.131301], 531 [20, 'C', -2.815469, -0.775379, -0.431910], 532 [21, 'C', -3.718174, 0.023460, 0.134879], 533 [22, 'C', -3.726395, 1.516213, -0.058936], 534 [23, 'C', -1.423939, 2.193179, -0.407936], 535 [24, 'C', -0.372897, 3.059448, 0.332496], 536 [25, 'C', 1.064718, 2.558120, 0.325331], 537 [26, 'H', 0.399932, -2.896344, -0.855386], 538 [27, 'H', -1.364146, -2.140645, -2.409934], 539 [28, 'H', -0.007016, -1.035292, -2.430851], 540 [29, 'H', -2.229948, 0.177326, -2.261725], 541 [30, 'H', -0.101863, 1.055799, -1.581061], 542 [31, 'H', -0.582210, 0.470722, 1.326014], 543 [32, 'H', 3.918694, 1.929549, 0.116264], 544 [33, 'H', 5.656588, 0.267474, -0.505165], 545 [34, 'H', 5.068478, -2.115052, -0.797816], 546 [35, 'H', 2.736463, -2.873299, -0.445917], 547 [36, 'H', 1.059165, -2.698455, 1.760657], 548 [37, 'H', 0.631843, -1.189746, 2.570301], 549 [38, 'H', -1.243126, -3.142405, 2.361743], 550 [39, 'H', -1.719677, -1.470258, 2.058429], 551 [40, 'H', -3.410692, -2.541912, 0.651788], 552 [41, 'H', -2.971493, -2.840572, -1.016009], 553 [42, 'H', -4.455619, -0.395106, 0.813636], 554 [43, 'H', -3.834304, 1.785629, -1.118252], 555 [44, 'H', -4.559845, 1.966160, 0.480526], 556 [45, 'H', -1.736135, 2.699031, -1.329897], 557 [46, 'H', -0.354638, 4.078330, -0.048526], 558 [47, 'H', -0.690723, 3.116119, 1.378208], 559 [ 1, 'O', -2.547545, 2.139059, 0.472310], 560 [ 2, 'O', 2.015408, 3.324289, 0.213156], 561 [ 3, 'N', 1.207610, 1.203922, 0.478894], 562 [ 4, 'N', -1.350394, -2.624460, 0.301178] 563 ] 564 565 # Check the data. 566 i = 0 567 for spin in spin_loop(): 568 self.assertEqual(spin.num, data[i][0]) 569 self.assertEqual(spin.name, data[i][1]) 570 self.assertEqual(spin.element, data[i][1]) 571 self.assertEqual(spin.pos[0], data[i][2]) 572 self.assertEqual(spin.pos[1], data[i][3]) 573 self.assertEqual(spin.pos[2], data[i][4]) 574 575 # Increment the spin index. 576 i += 1
577 578
579 - def test_read_merge(self):
580 """Test the merging of two molecules into one.""" 581 582 # Path of the files. 583 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 584 585 # Read the PDB files. 586 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-6.pdb', dir=path, set_mol_name='Ap4Aase', set_model_num=1) 587 self.interpreter.structure.read_pdb(file='Ap4Aase_res7-12.pdb', dir=path, set_mol_name='Ap4Aase', set_model_num=1, merge=True) 588 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=path, set_mol_name='Ap4Aase', set_model_num=2) 589 590 # Check that everything is ok. 591 cdp.structure.validate_models()
592 593
594 - def test_read_not_pdb(self):
595 """Test the reading of a file by structure.read_pdb that is not a PDB.""" 596 597 # Path of the files. 598 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'saved_states' 599 600 # Read the non-PDB file. 601 self.interpreter.structure.read_pdb(file='basic_single_pipe.bz2', dir=path)
602 603
604 - def test_read_pdb_internal1(self):
605 """Load the '1F35_N_H_molmol.pdb' PDB file (using the internal structural object PDB reader).""" 606 607 # Path of the files. 608 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 609 610 # Read the PDB. 611 self.interpreter.structure.read_pdb(file='1F35_N_H_molmol.pdb', dir=path) 612 613 # Test the molecule name. 614 self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name, '1F35_N_H_molmol_mol1') 615 616 # Load a single atom and test it. 617 self.interpreter.structure.load_spins('#1F35_N_H_molmol_mol1:3@N') 618 self.assertEqual(count_spins(), 1) 619 620 # Try loading a few protons. 621 self.interpreter.structure.load_spins('@*H*') 622 623 # And now all the rest of the atoms. 624 self.interpreter.structure.load_spins() 625 626 # Extract a N-Ca vector. 627 self.interpreter.interatom.define(spin_id1='@CA', spin_id2='#1F35_N_H_molmol_mol1:3@N') 628 self.interpreter.interatom.unit_vectors() 629 print(cdp.interatomic[0]) 630 self.assert_(hasattr(cdp.interatomic[0], 'vector'))
631 632
633 - def test_read_pdb_internal2(self):
634 """Load the 'Ap4Aase_res1-12.pdb' PDB file (using the internal structural object PDB reader).""" 635 636 # Path of the files. 637 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 638 639 # Read the PDB. 640 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=path) 641 642 # Try loading a few protons. 643 self.interpreter.structure.load_spins('@*H*') 644 645 # And now all the rest of the atoms. 646 self.interpreter.structure.load_spins()
647 648
649 - def test_read_pdb_internal3(self):
650 """Load the 'gromacs.pdb' PDB file (using the internal structural object PDB reader).""" 651 652 # Path of the files. 653 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'phthalic_acid' 654 655 # Read the PDB. 656 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path) 657 658 # Try loading a few protons, without positions averaging across models. 659 self.interpreter.structure.load_spins('@*H*', ave_pos=False) 660 661 # A test. 662 self.assertEqual(len(cdp.mol[0].res[0].spin[0].pos), 2) 663 664 # And now all the rest of the atoms. 665 self.interpreter.structure.load_spins()
666 667
668 - def test_read_pdb_internal4(self):
669 """Load the 'tylers_peptide_trunc.pdb' PDB file (using the internal structural object PDB reader).""" 670 671 # Path of the files. 672 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 673 674 # Read the PDB. 675 self.interpreter.structure.read_pdb(file='tylers_peptide_trunc.pdb', dir=path) 676 677 # Try loading a few protons. 678 self.interpreter.structure.load_spins('@*H*') 679 680 # And now all the rest of the atoms. 681 self.interpreter.structure.load_spins()
682 683
684 - def test_read_pdb_internal5(self):
685 """Load the 'lactose_MCMM4_S1_1.pdb' PDB file (using the internal structural object PDB reader).""" 686 687 # Path of the files. 688 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 689 690 # Read the PDB. 691 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path) 692 693 # Try loading a few protons. 694 self.interpreter.structure.load_spins('@*H*') 695 696 # And now all the rest of the atoms. 697 self.interpreter.structure.load_spins()
698 699
700 - def test_read_pdb_internal6(self):
701 """Load the 'lactose_MCMM4_S1_1.pdb' and 'lactose_MCMM4_S1_2.pdb' PDB files as 2 separate structures (using the internal structural object PDB reader).""" 702 703 # Path of the files. 704 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 705 706 # Read the PDB twice. 707 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path) 708 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=path) 709 710 # Try loading a few protons. 711 self.interpreter.structure.load_spins('@*H*') 712 713 # And now all the rest of the atoms. 714 self.interpreter.structure.load_spins()
715 716
717 - def test_read_pdb_internal7(self):
718 """Load the 'lactose_MCMM4_S1_1.pdb' PDB file twice as 2 separate structures (using the internal structural object PDB reader).""" 719 720 # Path of the files. 721 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 722 723 # Read the PDB twice. 724 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path) 725 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path) 726 727 # Try loading a few protons. 728 self.interpreter.structure.load_spins('@*H*') 729 730 # And now all the rest of the atoms. 731 self.interpreter.structure.load_spins()
732 733
735 """Load a few 'lactose_MCMM4_S1_*.pdb' PDB files as models (using the internal structural object PDB reader).""" 736 737 # Path of the files. 738 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 739 740 # Files. 741 files = ['lactose_MCMM4_S1_1.pdb', 742 'lactose_MCMM4_S1_2.pdb', 743 'lactose_MCMM4_S1_3.pdb'] 744 745 # Read the PDBs. 746 self.interpreter.structure.read_pdb(file=files[0], dir=path, set_model_num=1) 747 self.interpreter.structure.read_pdb(file=files[1], dir=path, set_model_num=1) 748 self.interpreter.structure.read_pdb(file=files[2], dir=path, set_model_num=1) 749 750 # Try loading a few protons. 751 self.interpreter.structure.load_spins('@*H*') 752 753 # And now all the rest of the atoms. 754 self.interpreter.structure.load_spins() 755 756 # Test the structural data. 757 self.assert_(hasattr(cdp, 'structure')) 758 self.assert_(hasattr(cdp.structure, 'structural_data')) 759 self.assertEqual(len(cdp.structure.structural_data), 1) 760 self.assertEqual(len(cdp.structure.structural_data[0].mol), 3) 761 762 i = 0 763 for mol in cdp.structure.structural_data[0].mol: 764 self.assertEqual(mol.file_name, files[i]) 765 self.assertEqual(mol.file_path, path) 766 self.assertEqual(mol.file_model, 1) 767 self.assertEqual(mol.file_mol_num, 1) 768 i = i + 1
769 770
772 """Load the 2 models of the 'gromacs.pdb' PDB file as separate molecules of the same model (using the internal structural object PDB reader).""" 773 774 # Path of the files. 775 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'phthalic_acid' 776 777 # Read the PDB models. 778 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, read_model=1, set_model_num=1) 779 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, read_model=2, set_model_num=1) 780 781 # Try loading a few protons. 782 self.interpreter.structure.load_spins('@*H*') 783 784 # And now all the rest of the atoms. 785 self.interpreter.structure.load_spins() 786 787 # Test the structural data. 788 self.assert_(hasattr(cdp, 'structure')) 789 self.assert_(hasattr(cdp.structure, 'structural_data')) 790 self.assertEqual(len(cdp.structure.structural_data), 1) 791 self.assertEqual(len(cdp.structure.structural_data[0].mol), 2) 792 793 i = 0 794 for mol in cdp.structure.structural_data[0].mol: 795 self.assertEqual(mol.file_name, 'gromacs.pdb') 796 self.assertEqual(mol.file_path, path) 797 self.assertEqual(mol.file_model, i+1) 798 self.assertEqual(mol.file_mol_num, 1) 799 i = i + 1
800 801
803 """Test the packing of models and molecules using 'gromacs.pdb' and 'lactose_MCMM4_S1_*.pdb' (using the internal structural object PDB reader).""" 804 805 # Path of the files. 806 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 807 808 # Read the PDB models. 809 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path+sep+'phthalic_acid') 810 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_1.pdb', dir=path, set_model_num=1, set_mol_name='lactose_MCMM4_S1') 811 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_2.pdb', dir=path, set_model_num=2, set_mol_name='lactose_MCMM4_S1') 812 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_3.pdb', dir=path, set_model_num=1, set_mol_name='lactose_MCMM4_S1b') 813 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_4.pdb', dir=path, set_model_num=2, set_mol_name='lactose_MCMM4_S1b') 814 815 # Try loading a few protons. 816 self.interpreter.structure.load_spins('@*H*') 817 818 # And now all the rest of the atoms. 819 self.interpreter.structure.load_spins() 820 821 # Test the structural data. 822 self.assert_(hasattr(cdp, 'structure')) 823 self.assert_(hasattr(cdp.structure, 'structural_data')) 824 self.assertEqual(len(cdp.structure.structural_data), 2) 825 self.assertEqual(len(cdp.structure.structural_data[0].mol), 3) 826 self.assertEqual(len(cdp.structure.structural_data[1].mol), 3) 827 828 files = [['gromacs.pdb', 'lactose_MCMM4_S1_1.pdb', 'lactose_MCMM4_S1_3.pdb'], 829 ['gromacs.pdb', 'lactose_MCMM4_S1_2.pdb', 'lactose_MCMM4_S1_4.pdb']] 830 paths = [[path+sep+'phthalic_acid', path+sep+'lactose', path+sep+'lactose'], 831 [path+sep+'phthalic_acid', path+sep+'lactose', path+sep+'lactose']] 832 models = [[1, 1, 1], [2, 1, 1]] 833 834 for i in range(len(cdp.structure.structural_data)): 835 for j in range(len(cdp.structure.structural_data[i].mol)): 836 mol = cdp.structure.structural_data[i].mol[j] 837 self.assertEqual(mol.file_name, files[i][j]) 838 self.assertEqual(mol.file_path, paths[i][j]) 839 self.assertEqual(mol.file_model, models[i][j]) 840 self.assertEqual(mol.file_mol_num, 1)
841 842
843 - def test_read_pdb_1UBQ(self):
844 """Test the reading of the complete 1UBQ PDB file.""" 845 846 # Load the file. 847 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 848 self.interpreter.structure.read_pdb('1UBQ.pdb', dir=path) 849 850 # Check the data. 851 self.assert_(hasattr(cdp, 'structure')) 852 self.assert_(hasattr(cdp.structure, 'structural_data')) 853 self.assertEqual(len(cdp.structure.structural_data), 1) 854 self.assertEqual(len(cdp.structure.structural_data[0].mol), 1) 855 856 # Check the first atom. 857 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_num[0], 1) 858 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_name[0], 'N') 859 self.assertEqual(cdp.structure.structural_data[0].mol[0].chain_id[0], 'A') 860 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_name[0], 'MET') 861 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_num[0], 1) 862 self.assertEqual(cdp.structure.structural_data[0].mol[0].x[0], 27.340) 863 self.assertEqual(cdp.structure.structural_data[0].mol[0].y[0], 24.430) 864 self.assertEqual(cdp.structure.structural_data[0].mol[0].z[0], 2.614) 865 self.assertEqual(cdp.structure.structural_data[0].mol[0].element[0], 'N') 866 867 # Check the last atom (from the last water HETATM record). 868 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_num[-1], 661) 869 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_name[-1], 'O') 870 self.assertEqual(cdp.structure.structural_data[0].mol[0].chain_id[-1], None) 871 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_name[-1], 'HOH') 872 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_num[-1], 58) 873 self.assertEqual(cdp.structure.structural_data[0].mol[0].x[-1], 37.667) 874 self.assertEqual(cdp.structure.structural_data[0].mol[0].y[-1], 43.421) 875 self.assertEqual(cdp.structure.structural_data[0].mol[0].z[-1], 17.000) 876 self.assertEqual(cdp.structure.structural_data[0].mol[0].element[-1], 'O')
877 878
879 - def test_read_write_pdb_1UBQ(self):
880 """Test the reading and writing of the 1UBQ PDB file.""" 881 882 # Load the file. 883 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 884 self.interpreter.structure.read_pdb('1UBQ.pdb', dir=path) 885 886 # Delete a big chunk of the molecule. 887 self.interpreter.structure.delete(":35-76") 888 889 # Delete all waters. 890 self.interpreter.structure.delete(":HOH") 891 892 # Write out the file. 893 self.tmpfile = mktemp() + '.pdb' 894 self.interpreter.structure.write_pdb(self.tmpfile) 895 896 # Read the contents of the file. 897 file = open(self.tmpfile) 898 lines = file.readlines() 899 file.close() 900 901 # What the contents should be, without remarks. 902 real_data = [ 903 "HELIX 1 H1 ILE A 23 GLU A 34 1 12 \n", 904 "SHEET 1 BET 5 GLY A 10 VAL A 17 0 \n", 905 "SHEET 2 BET 5 MET A 1 THR A 7 -1 \n", 906 "ATOM 1 N MET A 1 27.340 24.430 2.614 1.00 0.00 N \n", 907 "ATOM 2 CA MET A 1 26.266 25.413 2.842 1.00 0.00 C \n", 908 "ATOM 3 C MET A 1 26.913 26.639 3.531 1.00 0.00 C \n", 909 "ATOM 4 O MET A 1 27.886 26.463 4.263 1.00 0.00 O \n", 910 "ATOM 5 CB MET A 1 25.112 24.880 3.649 1.00 0.00 C \n", 911 "ATOM 6 CG MET A 1 25.353 24.860 5.134 1.00 0.00 C \n", 912 "ATOM 7 SD MET A 1 23.930 23.959 5.904 1.00 0.00 S \n", 913 "ATOM 8 CE MET A 1 24.447 23.984 7.620 1.00 0.00 C \n", 914 "ATOM 9 N GLN A 2 26.335 27.770 3.258 1.00 0.00 N \n", 915 "ATOM 10 CA GLN A 2 26.850 29.021 3.898 1.00 0.00 C \n", 916 "ATOM 11 C GLN A 2 26.100 29.253 5.202 1.00 0.00 C \n", 917 "ATOM 12 O GLN A 2 24.865 29.024 5.330 1.00 0.00 O \n", 918 "ATOM 13 CB GLN A 2 26.733 30.148 2.905 1.00 0.00 C \n", 919 "ATOM 14 CG GLN A 2 26.882 31.546 3.409 1.00 0.00 C \n", 920 "ATOM 15 CD GLN A 2 26.786 32.562 2.270 1.00 0.00 C \n", 921 "ATOM 16 OE1 GLN A 2 27.783 33.160 1.870 1.00 0.00 O \n", 922 "ATOM 17 NE2 GLN A 2 25.562 32.733 1.806 1.00 0.00 N \n", 923 "ATOM 18 N ILE A 3 26.849 29.656 6.217 1.00 0.00 N \n", 924 "ATOM 19 CA ILE A 3 26.235 30.058 7.497 1.00 0.00 C \n", 925 "ATOM 20 C ILE A 3 26.882 31.428 7.862 1.00 0.00 C \n", 926 "ATOM 21 O ILE A 3 27.906 31.711 7.264 1.00 0.00 O \n", 927 "ATOM 22 CB ILE A 3 26.344 29.050 8.645 1.00 0.00 C \n", 928 "ATOM 23 CG1 ILE A 3 27.810 28.748 8.999 1.00 0.00 C \n", 929 "ATOM 24 CG2 ILE A 3 25.491 27.771 8.287 1.00 0.00 C \n", 930 "ATOM 25 CD1 ILE A 3 27.967 28.087 10.417 1.00 0.00 C \n", 931 "ATOM 26 N PHE A 4 26.214 32.097 8.771 1.00 0.00 N \n", 932 "ATOM 27 CA PHE A 4 26.772 33.436 9.197 1.00 0.00 C \n", 933 "ATOM 28 C PHE A 4 27.151 33.362 10.650 1.00 0.00 C \n", 934 "ATOM 29 O PHE A 4 26.350 32.778 11.395 1.00 0.00 O \n", 935 "ATOM 30 CB PHE A 4 25.695 34.498 8.946 1.00 0.00 C \n", 936 "ATOM 31 CG PHE A 4 25.288 34.609 7.499 1.00 0.00 C \n", 937 "ATOM 32 CD1 PHE A 4 24.147 33.966 7.038 1.00 0.00 C \n", 938 "ATOM 33 CD2 PHE A 4 26.136 35.346 6.640 1.00 0.00 C \n", 939 "ATOM 34 CE1 PHE A 4 23.812 34.031 5.677 1.00 0.00 C \n", 940 "ATOM 35 CE2 PHE A 4 25.810 35.392 5.267 1.00 0.00 C \n", 941 "ATOM 36 CZ PHE A 4 24.620 34.778 4.853 1.00 0.00 C \n", 942 "ATOM 37 N VAL A 5 28.260 33.943 11.096 1.00 0.00 N \n", 943 "ATOM 38 CA VAL A 5 28.605 33.965 12.503 1.00 0.00 C \n", 944 "ATOM 39 C VAL A 5 28.638 35.461 12.900 1.00 0.00 C \n", 945 "ATOM 40 O VAL A 5 29.522 36.103 12.320 1.00 0.00 O \n", 946 "ATOM 41 CB VAL A 5 29.963 33.317 12.814 1.00 0.00 C \n", 947 "ATOM 42 CG1 VAL A 5 30.211 33.394 14.304 1.00 0.00 C \n", 948 "ATOM 43 CG2 VAL A 5 29.957 31.838 12.352 1.00 0.00 C \n", 949 "ATOM 44 N LYS A 6 27.751 35.867 13.740 1.00 0.00 N \n", 950 "ATOM 45 CA LYS A 6 27.691 37.315 14.143 1.00 0.00 C \n", 951 "ATOM 46 C LYS A 6 28.469 37.475 15.420 1.00 0.00 C \n", 952 "ATOM 47 O LYS A 6 28.213 36.753 16.411 1.00 0.00 O \n", 953 "ATOM 48 CB LYS A 6 26.219 37.684 14.307 1.00 0.00 C \n", 954 "ATOM 49 CG LYS A 6 25.884 39.139 14.615 1.00 0.00 C \n", 955 "ATOM 50 CD LYS A 6 24.348 39.296 14.642 1.00 0.00 C \n", 956 "ATOM 51 CE LYS A 6 23.865 40.723 14.749 1.00 0.00 C \n", 957 "ATOM 52 NZ LYS A 6 22.375 40.720 14.907 1.00 0.00 N \n", 958 "ATOM 53 N THR A 7 29.426 38.430 15.446 1.00 0.00 N \n", 959 "ATOM 54 CA THR A 7 30.225 38.643 16.662 1.00 0.00 C \n", 960 "ATOM 55 C THR A 7 29.664 39.839 17.434 1.00 0.00 C \n", 961 "ATOM 56 O THR A 7 28.850 40.565 16.859 1.00 0.00 O \n", 962 "ATOM 57 CB THR A 7 31.744 38.879 16.299 1.00 0.00 C \n", 963 "ATOM 58 OG1 THR A 7 31.737 40.257 15.824 1.00 0.00 O \n", 964 "ATOM 59 CG2 THR A 7 32.260 37.969 15.171 1.00 0.00 C \n", 965 "ATOM 60 N LEU A 8 30.132 40.069 18.642 1.00 0.00 N \n", 966 "ATOM 61 CA LEU A 8 29.607 41.180 19.467 1.00 0.00 C \n", 967 "ATOM 62 C LEU A 8 30.075 42.538 18.984 1.00 0.00 C \n", 968 "ATOM 63 O LEU A 8 29.586 43.570 19.483 1.00 0.00 O \n", 969 "ATOM 64 CB LEU A 8 29.919 40.890 20.938 1.00 0.00 C \n", 970 "ATOM 65 CG LEU A 8 29.183 39.722 21.581 1.00 0.00 C \n", 971 "ATOM 66 CD1 LEU A 8 29.308 39.750 23.095 1.00 0.00 C \n", 972 "ATOM 67 CD2 LEU A 8 27.700 39.721 21.228 1.00 0.00 C \n", 973 "ATOM 68 N THR A 9 30.991 42.571 17.998 1.00 0.00 N \n", 974 "ATOM 69 CA THR A 9 31.422 43.940 17.553 1.00 0.00 C \n", 975 "ATOM 70 C THR A 9 30.755 44.351 16.277 1.00 0.00 C \n", 976 "ATOM 71 O THR A 9 31.207 45.268 15.566 1.00 0.00 O \n", 977 "ATOM 72 CB THR A 9 32.979 43.918 17.445 1.00 0.00 C \n", 978 "ATOM 73 OG1 THR A 9 33.174 43.067 16.265 1.00 0.00 O \n", 979 "ATOM 74 CG2 THR A 9 33.657 43.319 18.672 1.00 0.00 C \n", 980 "ATOM 75 N GLY A 10 29.721 43.673 15.885 1.00 0.00 N \n", 981 "ATOM 76 CA GLY A 10 28.978 43.960 14.678 1.00 0.00 C \n", 982 "ATOM 77 C GLY A 10 29.604 43.507 13.393 1.00 0.00 C \n", 983 "ATOM 78 O GLY A 10 29.219 43.981 12.301 1.00 0.00 O \n", 984 "ATOM 79 N LYS A 11 30.563 42.623 13.495 1.00 0.00 N \n", 985 "ATOM 80 CA LYS A 11 31.191 42.012 12.331 1.00 0.00 C \n", 986 "ATOM 81 C LYS A 11 30.459 40.666 12.130 1.00 0.00 C \n", 987 "ATOM 82 O LYS A 11 30.253 39.991 13.133 1.00 0.00 O \n", 988 "ATOM 83 CB LYS A 11 32.672 41.717 12.505 1.00 0.00 C \n", 989 "ATOM 84 CG LYS A 11 33.280 41.086 11.227 1.00 0.00 C \n", 990 "ATOM 85 CD LYS A 11 34.762 40.799 11.470 1.00 0.00 C \n", 991 "ATOM 86 CE LYS A 11 35.614 40.847 10.240 1.00 0.00 C \n", 992 "ATOM 87 NZ LYS A 11 35.100 40.073 9.101 1.00 0.00 N \n", 993 "ATOM 88 N THR A 12 30.163 40.338 10.886 1.00 0.00 N \n", 994 "ATOM 89 CA THR A 12 29.542 39.020 10.653 1.00 0.00 C \n", 995 "ATOM 90 C THR A 12 30.494 38.261 9.729 1.00 0.00 C \n", 996 "ATOM 91 O THR A 12 30.849 38.850 8.706 1.00 0.00 O \n", 997 "ATOM 92 CB THR A 12 28.113 39.049 10.015 1.00 0.00 C \n", 998 "ATOM 93 OG1 THR A 12 27.280 39.722 10.996 1.00 0.00 O \n", 999 "ATOM 94 CG2 THR A 12 27.588 37.635 9.715 1.00 0.00 C \n", 1000 "ATOM 95 N ILE A 13 30.795 37.015 10.095 1.00 0.00 N \n", 1001 "ATOM 96 CA ILE A 13 31.720 36.289 9.176 1.00 0.00 C \n", 1002 "ATOM 97 C ILE A 13 30.955 35.211 8.459 1.00 0.00 C \n", 1003 "ATOM 98 O ILE A 13 30.025 34.618 9.040 1.00 0.00 O \n", 1004 "ATOM 99 CB ILE A 13 32.995 35.883 9.934 1.00 0.00 C \n", 1005 "ATOM 100 CG1 ILE A 13 33.306 34.381 9.840 1.00 0.00 C \n", 1006 "ATOM 101 CG2 ILE A 13 33.109 36.381 11.435 1.00 0.00 C \n", 1007 "ATOM 102 CD1 ILE A 13 34.535 34.028 10.720 1.00 0.00 C \n", 1008 "ATOM 103 N THR A 14 31.244 34.986 7.197 1.00 0.00 N \n", 1009 "ATOM 104 CA THR A 14 30.505 33.884 6.512 1.00 0.00 C \n", 1010 "ATOM 105 C THR A 14 31.409 32.680 6.446 1.00 0.00 C \n", 1011 "ATOM 106 O THR A 14 32.619 32.812 6.125 1.00 0.00 O \n", 1012 "ATOM 107 CB THR A 14 30.091 34.393 5.078 1.00 0.00 C \n", 1013 "ATOM 108 OG1 THR A 14 31.440 34.513 4.487 1.00 0.00 O \n", 1014 "ATOM 109 CG2 THR A 14 29.420 35.756 5.119 1.00 0.00 C \n", 1015 "ATOM 110 N LEU A 15 30.884 31.485 6.666 1.00 0.00 N \n", 1016 "ATOM 111 CA LEU A 15 31.677 30.275 6.639 1.00 0.00 C \n", 1017 "ATOM 112 C LEU A 15 31.022 29.288 5.665 1.00 0.00 C \n", 1018 "ATOM 113 O LEU A 15 29.809 29.395 5.545 1.00 0.00 O \n", 1019 "ATOM 114 CB LEU A 15 31.562 29.686 8.045 1.00 0.00 C \n", 1020 "ATOM 115 CG LEU A 15 32.631 29.444 9.060 1.00 0.00 C \n", 1021 "ATOM 116 CD1 LEU A 15 33.814 30.390 9.030 1.00 0.00 C \n", 1022 "ATOM 117 CD2 LEU A 15 31.945 29.449 10.436 1.00 0.00 C \n", 1023 "ATOM 118 N GLU A 16 31.834 28.412 5.125 1.00 0.00 N \n", 1024 "ATOM 119 CA GLU A 16 31.220 27.341 4.275 1.00 0.00 C \n", 1025 "ATOM 120 C GLU A 16 31.440 26.079 5.080 1.00 0.00 C \n", 1026 "ATOM 121 O GLU A 16 32.576 25.802 5.461 1.00 0.00 O \n", 1027 "ATOM 122 CB GLU A 16 31.827 27.262 2.894 1.00 0.00 C \n", 1028 "ATOM 123 CG GLU A 16 31.363 28.410 1.962 1.00 0.00 C \n", 1029 "ATOM 124 CD GLU A 16 31.671 28.291 0.498 1.00 0.00 C \n", 1030 "ATOM 125 OE1 GLU A 16 30.869 28.621 -0.366 1.00 0.00 O \n", 1031 "ATOM 126 OE2 GLU A 16 32.835 27.861 0.278 1.00 0.00 O \n", 1032 "ATOM 127 N VAL A 17 30.310 25.458 5.384 1.00 0.00 N \n", 1033 "ATOM 128 CA VAL A 17 30.288 24.245 6.193 1.00 0.00 C \n", 1034 "ATOM 129 C VAL A 17 29.279 23.227 5.641 1.00 0.00 C \n", 1035 "ATOM 130 O VAL A 17 28.478 23.522 4.725 1.00 0.00 O \n", 1036 "ATOM 131 CB VAL A 17 29.903 24.590 7.665 1.00 0.00 C \n", 1037 "ATOM 132 CG1 VAL A 17 30.862 25.496 8.389 1.00 0.00 C \n", 1038 "ATOM 133 CG2 VAL A 17 28.476 25.135 7.705 1.00 0.00 C \n", 1039 "ATOM 134 N GLU A 18 29.380 22.057 6.232 1.00 0.00 N \n", 1040 "ATOM 135 CA GLU A 18 28.468 20.940 5.980 1.00 0.00 C \n", 1041 "ATOM 136 C GLU A 18 27.819 20.609 7.316 1.00 0.00 C \n", 1042 "ATOM 137 O GLU A 18 28.449 20.674 8.360 1.00 0.00 O \n", 1043 "ATOM 138 CB GLU A 18 29.213 19.697 5.506 1.00 0.00 C \n", 1044 "ATOM 139 CG GLU A 18 29.728 19.755 4.060 1.00 0.00 C \n", 1045 "ATOM 140 CD GLU A 18 28.754 20.061 2.978 1.00 0.00 C \n", 1046 "ATOM 141 OE1 GLU A 18 27.546 19.992 2.985 1.00 0.00 O \n", 1047 "ATOM 142 OE2 GLU A 18 29.336 20.423 1.904 1.00 0.00 O \n", 1048 "ATOM 143 N PRO A 19 26.559 20.220 7.288 1.00 0.00 N \n", 1049 "ATOM 144 CA PRO A 19 25.829 19.825 8.494 1.00 0.00 C \n", 1050 "ATOM 145 C PRO A 19 26.541 18.732 9.251 1.00 0.00 C \n", 1051 "ATOM 146 O PRO A 19 26.333 18.536 10.457 1.00 0.00 O \n", 1052 "ATOM 147 CB PRO A 19 24.469 19.332 7.952 1.00 0.00 C \n", 1053 "ATOM 148 CG PRO A 19 24.299 20.134 6.704 1.00 0.00 C \n", 1054 "ATOM 149 CD PRO A 19 25.714 20.108 6.073 1.00 0.00 C \n", 1055 "ATOM 150 N SER A 20 27.361 17.959 8.559 1.00 0.00 N \n", 1056 "ATOM 151 CA SER A 20 28.054 16.835 9.210 1.00 0.00 C \n", 1057 "ATOM 152 C SER A 20 29.258 17.318 9.984 1.00 0.00 C \n", 1058 "ATOM 153 O SER A 20 29.930 16.477 10.606 1.00 0.00 O \n", 1059 "ATOM 154 CB SER A 20 28.523 15.820 8.182 1.00 0.00 C \n", 1060 "ATOM 155 OG SER A 20 28.946 16.445 6.967 1.00 0.00 O \n", 1061 "ATOM 156 N ASP A 21 29.599 18.599 9.828 1.00 0.00 N \n", 1062 "ATOM 157 CA ASP A 21 30.796 19.083 10.566 1.00 0.00 C \n", 1063 "ATOM 158 C ASP A 21 30.491 19.162 12.040 1.00 0.00 C \n", 1064 "ATOM 159 O ASP A 21 29.367 19.523 12.441 1.00 0.00 O \n", 1065 "ATOM 160 CB ASP A 21 31.155 20.515 10.048 1.00 0.00 C \n", 1066 "ATOM 161 CG ASP A 21 31.923 20.436 8.755 1.00 0.00 C \n", 1067 "ATOM 162 OD1 ASP A 21 32.493 19.374 8.456 1.00 0.00 O \n", 1068 "ATOM 163 OD2 ASP A 21 31.838 21.402 7.968 1.00 0.00 O \n", 1069 "ATOM 164 N THR A 22 31.510 18.936 12.852 1.00 0.00 N \n", 1070 "ATOM 165 CA THR A 22 31.398 19.064 14.286 1.00 0.00 C \n", 1071 "ATOM 166 C THR A 22 31.593 20.553 14.655 1.00 0.00 C \n", 1072 "ATOM 167 O THR A 22 32.159 21.311 13.861 1.00 0.00 O \n", 1073 "ATOM 168 CB THR A 22 32.492 18.193 14.995 1.00 0.00 C \n", 1074 "ATOM 169 OG1 THR A 22 33.778 18.739 14.516 1.00 0.00 O \n", 1075 "ATOM 170 CG2 THR A 22 32.352 16.700 14.630 1.00 0.00 C \n", 1076 "ATOM 171 N ILE A 23 31.113 20.863 15.860 1.00 0.00 N \n", 1077 "ATOM 172 CA ILE A 23 31.288 22.201 16.417 1.00 0.00 C \n", 1078 "ATOM 173 C ILE A 23 32.776 22.519 16.577 1.00 0.00 C \n", 1079 "ATOM 174 O ILE A 23 33.233 23.659 16.384 1.00 0.00 O \n", 1080 "ATOM 175 CB ILE A 23 30.520 22.300 17.764 1.00 0.00 C \n", 1081 "ATOM 176 CG1 ILE A 23 29.006 22.043 17.442 1.00 0.00 C \n", 1082 "ATOM 177 CG2 ILE A 23 30.832 23.699 18.358 1.00 0.00 C \n", 1083 "ATOM 178 CD1 ILE A 23 28.407 22.948 16.366 1.00 0.00 C \n", 1084 "ATOM 179 N GLU A 24 33.548 21.526 16.950 1.00 0.00 N \n", 1085 "ATOM 180 CA GLU A 24 35.031 21.722 17.069 1.00 0.00 C \n", 1086 "ATOM 181 C GLU A 24 35.615 22.190 15.759 1.00 0.00 C \n", 1087 "ATOM 182 O GLU A 24 36.532 23.046 15.724 1.00 0.00 O \n", 1088 "ATOM 183 CB GLU A 24 35.667 20.383 17.447 1.00 0.00 C \n", 1089 "ATOM 184 CG GLU A 24 37.128 20.293 17.872 1.00 0.00 C \n", 1090 "ATOM 185 CD GLU A 24 37.561 18.851 18.082 1.00 0.00 C \n", 1091 "ATOM 186 OE1 GLU A 24 37.758 18.024 17.195 1.00 0.00 O \n", 1092 "ATOM 187 OE2 GLU A 24 37.628 18.599 19.313 1.00 0.00 O \n", 1093 "ATOM 188 N ASN A 25 35.139 21.624 14.662 1.00 0.00 N \n", 1094 "ATOM 189 CA ASN A 25 35.590 21.945 13.302 1.00 0.00 C \n", 1095 "ATOM 190 C ASN A 25 35.238 23.382 12.920 1.00 0.00 C \n", 1096 "ATOM 191 O ASN A 25 36.066 24.109 12.333 1.00 0.00 O \n", 1097 "ATOM 192 CB ASN A 25 35.064 20.957 12.255 1.00 0.00 C \n", 1098 "ATOM 193 CG ASN A 25 35.541 21.418 10.871 1.00 0.00 C \n", 1099 "ATOM 194 OD1 ASN A 25 36.772 21.623 10.676 1.00 0.00 O \n", 1100 "ATOM 195 ND2 ASN A 25 34.628 21.595 9.920 1.00 0.00 N \n", 1101 "ATOM 196 N VAL A 26 34.007 23.745 13.250 1.00 0.00 N \n", 1102 "ATOM 197 CA VAL A 26 33.533 25.097 12.978 1.00 0.00 C \n", 1103 "ATOM 198 C VAL A 26 34.441 26.099 13.684 1.00 0.00 C \n", 1104 "ATOM 199 O VAL A 26 34.883 27.090 13.093 1.00 0.00 O \n", 1105 "ATOM 200 CB VAL A 26 32.060 25.257 13.364 1.00 0.00 C \n", 1106 "ATOM 201 CG1 VAL A 26 31.684 26.749 13.342 1.00 0.00 C \n", 1107 "ATOM 202 CG2 VAL A 26 31.152 24.421 12.477 1.00 0.00 C \n", 1108 "ATOM 203 N LYS A 27 34.734 25.822 14.949 1.00 0.00 N \n", 1109 "ATOM 204 CA LYS A 27 35.596 26.715 15.736 1.00 0.00 C \n", 1110 "ATOM 205 C LYS A 27 36.975 26.826 15.107 1.00 0.00 C \n", 1111 "ATOM 206 O LYS A 27 37.579 27.926 15.159 1.00 0.00 O \n", 1112 "ATOM 207 CB LYS A 27 35.715 26.203 17.172 1.00 0.00 C \n", 1113 "ATOM 208 CG LYS A 27 34.343 26.445 17.898 1.00 0.00 C \n", 1114 "ATOM 209 CD LYS A 27 34.509 26.077 19.360 1.00 0.00 C \n", 1115 "ATOM 210 CE LYS A 27 33.206 26.311 20.122 1.00 0.00 C \n", 1116 "ATOM 211 NZ LYS A 27 33.455 25.910 21.546 1.00 0.00 N \n", 1117 "ATOM 212 N ALA A 28 37.499 25.743 14.571 1.00 0.00 N \n", 1118 "ATOM 213 CA ALA A 28 38.794 25.761 13.880 1.00 0.00 C \n", 1119 "ATOM 214 C ALA A 28 38.728 26.591 12.611 1.00 0.00 C \n", 1120 "ATOM 215 O ALA A 28 39.704 27.346 12.277 1.00 0.00 O \n", 1121 "ATOM 216 CB ALA A 28 39.285 24.336 13.566 1.00 0.00 C \n", 1122 "ATOM 217 N LYS A 29 37.633 26.543 11.867 1.00 0.00 N \n", 1123 "ATOM 218 CA LYS A 29 37.471 27.391 10.668 1.00 0.00 C \n", 1124 "ATOM 219 C LYS A 29 37.441 28.882 11.052 1.00 0.00 C \n", 1125 "ATOM 220 O LYS A 29 38.020 29.772 10.382 1.00 0.00 O \n", 1126 "ATOM 221 CB LYS A 29 36.193 27.058 9.911 1.00 0.00 C \n", 1127 "ATOM 222 CG LYS A 29 36.153 25.620 9.409 1.00 0.00 C \n", 1128 "ATOM 223 CD LYS A 29 34.758 25.280 8.900 1.00 0.00 C \n", 1129 "ATOM 224 CE LYS A 29 34.793 24.264 7.767 1.00 0.00 C \n", 1130 "ATOM 225 NZ LYS A 29 34.914 24.944 6.441 1.00 0.00 N \n", 1131 "ATOM 226 N ILE A 30 36.811 29.170 12.192 1.00 0.00 N \n", 1132 "ATOM 227 CA ILE A 30 36.731 30.570 12.645 1.00 0.00 C \n", 1133 "ATOM 228 C ILE A 30 38.148 30.981 13.069 1.00 0.00 C \n", 1134 "ATOM 229 O ILE A 30 38.544 32.150 12.856 1.00 0.00 O \n", 1135 "ATOM 230 CB ILE A 30 35.708 30.776 13.806 1.00 0.00 C \n", 1136 "ATOM 231 CG1 ILE A 30 34.228 30.630 13.319 1.00 0.00 C \n", 1137 "ATOM 232 CG2 ILE A 30 35.874 32.138 14.512 1.00 0.00 C \n", 1138 "ATOM 233 CD1 ILE A 30 33.284 30.504 14.552 1.00 0.00 C \n", 1139 "ATOM 234 N GLN A 31 38.883 30.110 13.713 1.00 0.00 N \n", 1140 "ATOM 235 CA GLN A 31 40.269 30.508 14.115 1.00 0.00 C \n", 1141 "ATOM 236 C GLN A 31 41.092 30.808 12.851 1.00 0.00 C \n", 1142 "ATOM 237 O GLN A 31 41.828 31.808 12.681 1.00 0.00 O \n", 1143 "ATOM 238 CB GLN A 31 40.996 29.399 14.865 1.00 0.00 C \n", 1144 "ATOM 239 CG GLN A 31 42.445 29.848 15.182 1.00 0.00 C \n", 1145 "ATOM 240 CD GLN A 31 43.090 28.828 16.095 1.00 0.00 C \n", 1146 "ATOM 241 OE1 GLN A 31 42.770 27.655 15.906 1.00 0.00 O \n", 1147 "ATOM 242 NE2 GLN A 31 43.898 29.252 17.050 1.00 0.00 N \n", 1148 "ATOM 243 N ASP A 32 41.001 29.878 11.931 1.00 0.00 N \n", 1149 "ATOM 244 CA ASP A 32 41.718 30.022 10.643 1.00 0.00 C \n", 1150 "ATOM 245 C ASP A 32 41.399 31.338 9.967 1.00 0.00 C \n", 1151 "ATOM 246 O ASP A 32 42.260 32.036 9.381 1.00 0.00 O \n", 1152 "ATOM 247 CB ASP A 32 41.398 28.780 9.810 1.00 0.00 C \n", 1153 "ATOM 248 CG ASP A 32 42.626 28.557 8.928 1.00 0.00 C \n", 1154 "ATOM 249 OD1 ASP A 32 43.666 28.262 9.539 1.00 0.00 O \n", 1155 "ATOM 250 OD2 ASP A 32 42.430 28.812 7.728 1.00 0.00 O \n", 1156 "ATOM 251 N LYS A 33 40.117 31.750 9.988 1.00 0.00 N \n", 1157 "ATOM 252 CA LYS A 33 39.808 32.994 9.233 1.00 0.00 C \n", 1158 "ATOM 253 C LYS A 33 39.837 34.271 9.995 1.00 0.00 C \n", 1159 "ATOM 254 O LYS A 33 40.164 35.323 9.345 1.00 0.00 O \n", 1160 "ATOM 255 CB LYS A 33 38.615 32.801 8.320 1.00 0.00 C \n", 1161 "ATOM 256 CG LYS A 33 37.220 32.822 8.827 1.00 0.00 C \n", 1162 "ATOM 257 CD LYS A 33 36.351 33.613 7.838 1.00 0.00 C \n", 1163 "ATOM 258 CE LYS A 33 36.322 32.944 6.477 1.00 0.00 C \n", 1164 "ATOM 259 NZ LYS A 33 35.768 33.945 5.489 1.00 0.00 N \n", 1165 "ATOM 260 N GLU A 34 39.655 34.335 11.285 1.00 0.00 N \n", 1166 "ATOM 261 CA GLU A 34 39.676 35.547 12.072 1.00 0.00 C \n", 1167 "ATOM 262 C GLU A 34 40.675 35.527 13.200 1.00 0.00 C \n", 1168 "ATOM 263 O GLU A 34 40.814 36.528 13.911 1.00 0.00 O \n", 1169 "ATOM 264 CB GLU A 34 38.290 35.814 12.698 1.00 0.00 C \n", 1170 "ATOM 265 CG GLU A 34 37.156 35.985 11.688 1.00 0.00 C \n", 1171 "ATOM 266 CD GLU A 34 37.192 37.361 11.033 1.00 0.00 C \n", 1172 "ATOM 267 OE1 GLU A 34 37.519 38.360 11.645 1.00 0.00 O \n", 1173 "ATOM 268 OE2 GLU A 34 36.861 37.320 9.822 1.00 0.00 O \n", 1174 "TER 269 GLU A 34 \n", 1175 "MASTER 0 0 0 0 0 0 0 0 268 1 0 0 \n", 1176 "END \n" 1177 ] 1178 1179 # Check the data. 1180 self.strip_remarks(lines) 1181 for i in range(len(real_data)): 1182 self.assertEqual(real_data[i], lines[i])
1183 1184
1185 - def test_read_xyz_internal1(self):
1186 """Load the 'Indol_test.xyz' XYZ file (using the internal structural object XYZ reader).""" 1187 1188 # Path of the files. 1189 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1190 1191 # Read the XYZ file. 1192 self.interpreter.structure.read_xyz(file='Indol_test.xyz', dir=path) 1193 1194 # Test the molecule name. 1195 self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name, 'Indol_test_mol1') 1196 1197 # Load a single atom and test it. 1198 self.interpreter.structure.load_spins('#Indol_test_mol1@3') 1199 self.assertEqual(count_spins(), 1) 1200 1201 # Try loading a few protons. 1202 self.interpreter.structure.load_spins('@*H*') 1203 1204 # And now all the rest of the atoms. 1205 self.interpreter.structure.load_spins()
1206 1207
1208 - def test_read_xyz_internal2(self):
1209 """Load the 'SSS-cluster4-new-test.xyz' XYZ file (using the internal structural object XYZ reader).""" 1210 1211 # Path of the files. 1212 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1213 1214 # Read the XYZ file. 1215 self.interpreter.structure.read_xyz(file='SSS-cluster4-new-test.xyz', dir=path, read_model=[1]) 1216 1217 # Test the molecule name. 1218 self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name, 'SSS-cluster4-new-test_mol1') 1219 1220 # Load a single atom and test it. 1221 self.interpreter.structure.load_spins('#SSS-cluster4-new-test_mol1@2') 1222 self.assertEqual(count_spins(), 1) 1223 1224 # Test the spin coordinates. 1225 a=return_spin('#SSS-cluster4-new-test_mol1@2') 1226 self.assertAlmostEqual(a.pos[0], -12.398) 1227 self.assertAlmostEqual(a.pos[1], -15.992) 1228 self.assertAlmostEqual(a.pos[2], 11.448) 1229 1230 # Try loading a few protons. 1231 #self.interpreter.structure.load_spins('@H') 1232 1233 # And now all the rest of the atoms. 1234 self.interpreter.structure.load_spins() 1235 1236 # Extract a vector between first two spins. 1237 self.interpreter.interatom.define(spin_id1='@2', spin_id2='@10') 1238 self.interpreter.interatom.unit_vectors() 1239 self.assertAlmostEqual(cdp.interatomic[0].vector[0], -0.4102707) 1240 self.assertAlmostEqual(cdp.interatomic[0].vector[1], 0.62128879) 1241 self.assertAlmostEqual(cdp.interatomic[0].vector[2], -0.6675913)
1242 1243
1244 - def test_read_xyz_strychnine(self):
1245 """Load the 'strychnine.xyz' XYZ file (using the internal structural object XYZ reader).""" 1246 1247 # Path of the files. 1248 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1249 1250 # Read the XYZ file. 1251 self.interpreter.structure.read_xyz(file='strychnine.xyz', dir=path, set_mol_name='strychnine') 1252 1253 # Test the molecule data. 1254 self.assertEqual(len(cdp.structure.structural_data), 1) 1255 self.assertEqual(len(cdp.structure.structural_data[0].mol), 1) 1256 1257 # Load the carbon atoms and test it. 1258 self.interpreter.structure.load_spins('@C') 1259 self.assertEqual(count_spins(), 21) 1260 1261 # Load the protons. 1262 self.interpreter.structure.load_spins('@H') 1263 self.assertEqual(count_spins(), 43) 1264 1265 # And now all the rest of the atoms. 1266 self.interpreter.structure.load_spins()
1267 1268
1269 - def test_rmsd(self):
1270 """Test the structure.rmsd user function.""" 1271 1272 # Set up 3 models. 1273 self.interpreter.structure.add_model(model_num=1) 1274 self.interpreter.structure.add_model(model_num=2) 1275 self.interpreter.structure.add_model(model_num=4) 1276 1277 # Check that the models were correctly created. 1278 self.assert_(hasattr(cdp, 'structure')) 1279 self.assert_(hasattr(cdp.structure, 'structural_data')) 1280 self.assertEqual(len(cdp.structure.structural_data), 3) 1281 1282 # Create a structure with some atoms. 1283 self.interpreter.structure.add_atom(atom_name='A', res_name='UNK', res_num=1, pos=[[1., 0., -1.], [0., 0., 0.], [-1., 0., 1.]], element='S') 1284 self.interpreter.structure.add_atom(atom_name='A', res_name='UNK', res_num=2, pos=[[1., 2., -1.], [0., 2., 0.], [-1., 2., 1.]], element='S') 1285 self.interpreter.structure.add_atom(atom_name='A', res_name='UNK', res_num=3, pos=[[1., 20., -1.], [0., 20., 0.], [-1., 20., 1.]], element='S') 1286 1287 # Check the internal atomic info. 1288 self.assertEqual(cdp.structure.structural_data[0].mol[0].x, [1., 1., 1.]) 1289 self.assertEqual(cdp.structure.structural_data[0].mol[0].y, [0., 2., 20.]) 1290 self.assertEqual(cdp.structure.structural_data[0].mol[0].z, [-1., -1., -1.]) 1291 self.assertEqual(cdp.structure.structural_data[1].mol[0].x, [0., 0., 0.]) 1292 self.assertEqual(cdp.structure.structural_data[1].mol[0].y, [0., 2., 20.]) 1293 self.assertEqual(cdp.structure.structural_data[1].mol[0].z, [0., 0., 0.]) 1294 self.assertEqual(cdp.structure.structural_data[2].mol[0].x, [-1., -1., -1.]) 1295 self.assertEqual(cdp.structure.structural_data[2].mol[0].y, [0., 2., 20.]) 1296 self.assertEqual(cdp.structure.structural_data[2].mol[0].z, [1., 1., 1.]) 1297 1298 # Calculate the RMSD. 1299 self.interpreter.structure.rmsd() 1300 1301 # Checks. 1302 self.assert_(hasattr(cdp.structure, 'rmsd')) 1303 self.assertAlmostEqual(cdp.structure.rmsd, 2./3*sqrt(2))
1304 1305
1306 - def test_rmsd_ubi(self):
1307 """Test the structure.rmsd user function on the truncated ubiquitin ensemble.""" 1308 1309 # Load the structure. 1310 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1311 self.interpreter.structure.read_pdb('trunc_ubi_pcs.pdb', dir=path) 1312 1313 # Calculate the RMSD. 1314 self.interpreter.structure.rmsd() 1315 1316 # Checks (the values match the VMD 1.9.1 RMSD numbers). 1317 self.assert_(hasattr(cdp.structure, 'rmsd')) 1318 self.assertAlmostEqual(cdp.structure.rmsd, 0.77282758781333061)
1319 1320
1322 """Test of the structure.superimpose user function, fitting to the first structure.""" 1323 1324 # Path of the structure file. 1325 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam' 1326 1327 # Load the two rotated structures. 1328 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=1, set_mol_name='CaM') 1329 self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, set_model_num=2, set_mol_name='CaM') 1330 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=3, set_mol_name='CaM') 1331 1332 # Superimpose the backbone heavy atoms. 1333 self.interpreter.structure.superimpose(method='fit to first', atom_id='@N,C,CA,O') 1334 1335 # Check that the two structures now have the same atomic coordinates. 1336 model1 = cdp.structure.structural_data[0].mol[0] 1337 model2 = cdp.structure.structural_data[1].mol[0] 1338 model3 = cdp.structure.structural_data[2].mol[0] 1339 for i in range(len(model1.atom_name)): 1340 # Check model 2. 1341 self.assertAlmostEqual(model1.x[i], model2.x[i], 2) 1342 self.assertAlmostEqual(model1.y[i], model2.y[i], 2) 1343 self.assertAlmostEqual(model1.z[i], model2.z[i], 2) 1344 1345 # Check model 3. 1346 self.assertAlmostEqual(model1.x[i], model3.x[i], 2) 1347 self.assertAlmostEqual(model1.y[i], model3.y[i], 2) 1348 self.assertAlmostEqual(model1.z[i], model3.z[i], 2)
1349 1350
1352 """Test of the structure.superimpose user function, fitting to the mean structure.""" 1353 1354 # Path of the structure file. 1355 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam' 1356 1357 # Load the two rotated structures. 1358 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=1, set_mol_name='CaM') 1359 self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, set_model_num=2, set_mol_name='CaM') 1360 1361 # Superimpose the backbone heavy atoms. 1362 self.interpreter.structure.superimpose(method='fit to mean', atom_id='@N,C,CA,O') 1363 1364 # Check that the two structures now have the same atomic coordinates. 1365 model1 = cdp.structure.structural_data[0].mol[0] 1366 model2 = cdp.structure.structural_data[1].mol[0] 1367 for i in range(len(model1.atom_name)): 1368 self.assertAlmostEqual(model1.x[i], model2.x[i], 2) 1369 self.assertAlmostEqual(model1.y[i], model2.y[i], 2) 1370 self.assertAlmostEqual(model1.z[i], model2.z[i], 2)
1371 1372
1374 """Second test of the structure.superimpose user function, fitting to the mean structure.""" 1375 1376 # Path of the structure file. 1377 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam' 1378 1379 # Load the two rotated structures. 1380 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=1, set_mol_name='CaM') 1381 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=2, set_mol_name='CaM') 1382 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=3, set_mol_name='CaM') 1383 1384 # Transpose model 3. 1385 self.interpreter.structure.translate([20.0, 0.0, 0.0], model=3) 1386 1387 # Superimpose the backbone heavy atoms. 1388 self.interpreter.structure.superimpose(models=[2, 3], method='fit to mean', atom_id='@N,C,CA,O') 1389 1390 # Check that the two structures now have the same atomic coordinates as the original, but shifted 10 Angstrom in x. 1391 model1 = cdp.structure.structural_data[0].mol[0] 1392 model2 = cdp.structure.structural_data[1].mol[0] 1393 model3 = cdp.structure.structural_data[2].mol[0] 1394 for i in range(len(model1.atom_name)): 1395 # Check model 2. 1396 self.assertAlmostEqual(model1.x[i] + 10, model2.x[i], 2) 1397 self.assertAlmostEqual(model1.y[i], model2.y[i], 2) 1398 self.assertAlmostEqual(model1.z[i], model2.z[i], 2) 1399 1400 # Check model 3. 1401 self.assertAlmostEqual(model2.x[i], model3.x[i], 2) 1402 self.assertAlmostEqual(model2.y[i], model3.y[i], 2) 1403 self.assertAlmostEqual(model2.z[i], model3.z[i], 2)
1404 1405
1406 - def test_web_of_motion_12(self):
1407 """Check the operation of the structure.web_of_motion user function using structural models 1 and 2 (of 3).""" 1408 1409 # Load the file. 1410 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1411 self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path) 1412 1413 # Run the structure.web_of_motion user function and collect the results in a dummy file object. 1414 file = DummyFileObject() 1415 self.interpreter.structure.web_of_motion(file=file, models=[1, 2]) 1416 1417 # The result, without remarks. 1418 result = [ 1419 "ATOM 1 N LEU A 4 9.464 -9.232 27.573 1.00 0.00 N ", 1420 "ATOM 2 N LEU A 4 9.211 -9.425 26.970 1.00 0.00 N ", 1421 "ATOM 3 H LEU A 4 8.575 -8.953 27.963 1.00 0.00 H ", 1422 "ATOM 4 H LEU A 4 9.085 -9.743 27.919 1.00 0.00 H ", 1423 "ATOM 5 CA LEU A 4 10.302 -8.195 26.930 1.00 0.00 C ", 1424 "ATOM 6 CA LEU A 4 10.077 -8.221 26.720 1.00 0.00 C ", 1425 "ATOM 7 CB LEU A 4 9.494 -7.221 26.051 1.00 0.00 C ", 1426 "ATOM 8 CB LEU A 4 9.297 -7.096 26.024 1.00 0.00 C ", 1427 "ATOM 9 CG LEU A 4 10.107 -5.862 25.665 1.00 0.00 C ", 1428 "ATOM 10 CG LEU A 4 10.061 -5.803 25.679 1.00 0.00 C ", 1429 "ATOM 11 CD1 LEU A 4 11.182 -6.007 24.608 1.00 0.00 C ", 1430 "ATOM 12 CD1 LEU A 4 11.029 -6.002 24.507 1.00 0.00 C ", 1431 "ATOM 13 CD2 LEU A 4 9.036 -4.875 25.171 1.00 0.00 C ", 1432 "ATOM 14 CD2 LEU A 4 9.120 -4.618 25.384 1.00 0.00 C ", 1433 "ATOM 15 C LEU A 4 10.999 -7.436 28.046 1.00 0.00 C ", 1434 "ATOM 16 C LEU A 4 10.625 -7.721 28.047 1.00 0.00 C ", 1435 "TER 17 LEU A 4 ", 1436 "CONECT 1 2 ", 1437 "CONECT 2 1 ", 1438 "CONECT 3 4 ", 1439 "CONECT 4 3 ", 1440 "CONECT 5 6 ", 1441 "CONECT 6 5 ", 1442 "CONECT 7 8 ", 1443 "CONECT 8 7 ", 1444 "CONECT 9 10 ", 1445 "CONECT 10 9 ", 1446 "CONECT 11 12 ", 1447 "CONECT 12 11 ", 1448 "CONECT 13 14 ", 1449 "CONECT 14 13 ", 1450 "CONECT 15 16 ", 1451 "CONECT 16 15 ", 1452 "MASTER 0 0 0 0 0 0 0 0 16 1 16 0 ", 1453 "END " 1454 ] 1455 1456 # Check the created PDB file. 1457 lines = file.readlines() 1458 self.strip_remarks(lines) 1459 for i in range(len(lines)): 1460 self.assertEqual(result[i]+'\n', lines[i])
1461 1462
1463 - def test_web_of_motion_13(self):
1464 """Check the operation of the structure.web_of_motion user function using structural models 1 and 3 (of 3).""" 1465 1466 # Load the file. 1467 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1468 self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path) 1469 1470 # Run the structure.web_of_motion user function and collect the results in a dummy file object. 1471 file = DummyFileObject() 1472 self.interpreter.structure.web_of_motion(file=file, models=[1, 3]) 1473 1474 # The result, without remarks. 1475 result = [ 1476 "ATOM 1 N LEU A 4 9.464 -9.232 27.573 1.00 0.00 N ", 1477 "ATOM 2 N LEU A 4 7.761 -6.392 27.161 1.00 0.00 N ", 1478 "ATOM 3 H LEU A 4 8.575 -8.953 27.963 1.00 0.00 H ", 1479 "ATOM 4 H LEU A 4 7.278 -6.195 28.026 1.00 0.00 H ", 1480 "ATOM 5 CA LEU A 4 10.302 -8.195 26.930 1.00 0.00 C ", 1481 "ATOM 6 CA LEU A 4 9.256 -6.332 27.183 1.00 0.00 C ", 1482 "ATOM 7 CB LEU A 4 9.494 -7.221 26.051 1.00 0.00 C ", 1483 "ATOM 8 CB LEU A 4 9.799 -5.331 26.144 1.00 0.00 C ", 1484 "ATOM 9 CG LEU A 4 10.107 -5.862 25.665 1.00 0.00 C ", 1485 "ATOM 10 CG LEU A 4 10.293 -5.882 24.803 1.00 0.00 C ", 1486 "ATOM 11 CD1 LEU A 4 11.182 -6.007 24.608 1.00 0.00 C ", 1487 "ATOM 12 CD1 LEU A 4 9.404 -6.984 24.274 1.00 0.00 C ", 1488 "ATOM 13 CD2 LEU A 4 9.036 -4.875 25.171 1.00 0.00 C ", 1489 "ATOM 14 CD2 LEU A 4 10.355 -4.772 23.792 1.00 0.00 C ", 1490 "ATOM 15 C LEU A 4 10.999 -7.436 28.046 1.00 0.00 C ", 1491 "ATOM 16 C LEU A 4 9.816 -6.033 28.572 1.00 0.00 C ", 1492 "TER 17 LEU A 4 ", 1493 "CONECT 1 2 ", 1494 "CONECT 2 1 ", 1495 "CONECT 3 4 ", 1496 "CONECT 4 3 ", 1497 "CONECT 5 6 ", 1498 "CONECT 6 5 ", 1499 "CONECT 7 8 ", 1500 "CONECT 8 7 ", 1501 "CONECT 9 10 ", 1502 "CONECT 10 9 ", 1503 "CONECT 11 12 ", 1504 "CONECT 12 11 ", 1505 "CONECT 13 14 ", 1506 "CONECT 14 13 ", 1507 "CONECT 15 16 ", 1508 "CONECT 16 15 ", 1509 "MASTER 0 0 0 0 0 0 0 0 16 1 16 0 ", 1510 "END " 1511 ] 1512 1513 # Check the created PDB file. 1514 lines = file.readlines() 1515 self.strip_remarks(lines) 1516 for i in range(len(lines)): 1517 self.assertEqual(result[i]+'\n', lines[i])
1518 1519
1520 - def test_web_of_motion_all(self):
1521 """Check the operation of the structure.web_of_motion user function using all structural models.""" 1522 1523 # Load the file. 1524 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1525 self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path) 1526 1527 # Run the structure.web_of_motion user function and collect the results in a dummy file object. 1528 file = DummyFileObject() 1529 self.interpreter.structure.web_of_motion(file=file) 1530 1531 # The result, without remarks. 1532 result = [ 1533 "ATOM 1 N LEU A 4 9.464 -9.232 27.573 1.00 0.00 N ", 1534 "ATOM 2 N LEU A 4 9.211 -9.425 26.970 1.00 0.00 N ", 1535 "ATOM 3 N LEU A 4 7.761 -6.392 27.161 1.00 0.00 N ", 1536 "ATOM 4 H LEU A 4 8.575 -8.953 27.963 1.00 0.00 H ", 1537 "ATOM 5 H LEU A 4 9.085 -9.743 27.919 1.00 0.00 H ", 1538 "ATOM 6 H LEU A 4 7.278 -6.195 28.026 1.00 0.00 H ", 1539 "ATOM 7 CA LEU A 4 10.302 -8.195 26.930 1.00 0.00 C ", 1540 "ATOM 8 CA LEU A 4 10.077 -8.221 26.720 1.00 0.00 C ", 1541 "ATOM 9 CA LEU A 4 9.256 -6.332 27.183 1.00 0.00 C ", 1542 "ATOM 10 CB LEU A 4 9.494 -7.221 26.051 1.00 0.00 C ", 1543 "ATOM 11 CB LEU A 4 9.297 -7.096 26.024 1.00 0.00 C ", 1544 "ATOM 12 CB LEU A 4 9.799 -5.331 26.144 1.00 0.00 C ", 1545 "ATOM 13 CG LEU A 4 10.107 -5.862 25.665 1.00 0.00 C ", 1546 "ATOM 14 CG LEU A 4 10.061 -5.803 25.679 1.00 0.00 C ", 1547 "ATOM 15 CG LEU A 4 10.293 -5.882 24.803 1.00 0.00 C ", 1548 "ATOM 16 CD1 LEU A 4 11.182 -6.007 24.608 1.00 0.00 C ", 1549 "ATOM 17 CD1 LEU A 4 11.029 -6.002 24.507 1.00 0.00 C ", 1550 "ATOM 18 CD1 LEU A 4 9.404 -6.984 24.274 1.00 0.00 C ", 1551 "ATOM 19 CD2 LEU A 4 9.036 -4.875 25.171 1.00 0.00 C ", 1552 "ATOM 20 CD2 LEU A 4 9.120 -4.618 25.384 1.00 0.00 C ", 1553 "ATOM 21 CD2 LEU A 4 10.355 -4.772 23.792 1.00 0.00 C ", 1554 "ATOM 22 C LEU A 4 10.999 -7.436 28.046 1.00 0.00 C ", 1555 "ATOM 23 C LEU A 4 10.625 -7.721 28.047 1.00 0.00 C ", 1556 "ATOM 24 C LEU A 4 9.816 -6.033 28.572 1.00 0.00 C ", 1557 "TER 25 LEU A 4 ", 1558 "CONECT 1 2 3 ", 1559 "CONECT 2 1 3 ", 1560 "CONECT 3 1 2 ", 1561 "CONECT 4 5 6 ", 1562 "CONECT 5 4 6 ", 1563 "CONECT 6 4 5 ", 1564 "CONECT 7 8 9 ", 1565 "CONECT 8 7 9 ", 1566 "CONECT 9 7 8 ", 1567 "CONECT 10 11 12 ", 1568 "CONECT 11 10 12 ", 1569 "CONECT 12 10 11 ", 1570 "CONECT 13 14 15 ", 1571 "CONECT 14 13 15 ", 1572 "CONECT 15 13 14 ", 1573 "CONECT 16 17 18 ", 1574 "CONECT 17 16 18 ", 1575 "CONECT 18 16 17 ", 1576 "CONECT 19 20 21 ", 1577 "CONECT 20 19 21 ", 1578 "CONECT 21 19 20 ", 1579 "CONECT 22 23 24 ", 1580 "CONECT 23 22 24 ", 1581 "CONECT 24 22 23 ", 1582 "MASTER 0 0 0 0 0 0 0 0 24 1 24 0 ", 1583 "END " 1584 ] 1585 1586 # Check the created PDB file. 1587 lines = file.readlines() 1588 self.strip_remarks(lines) 1589 for i in range(len(lines)): 1590 self.assertEqual(result[i]+'\n', lines[i])
1591