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-2013 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 import Relax_data_store; ds = Relax_data_store() 
  30  from generic_fns.mol_res_spin import count_spins, return_spin 
  31  from maths_fns.rotation_matrix import euler_to_R_zyz 
  32  from relax_errors import RelaxError 
  33  from relax_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 __init__(self, methodName='runTest'):
42 """Skip scientific Python tests if not installed. 43 44 @keyword methodName: The name of the test. 45 @type methodName: str 46 """ 47 48 # Execute the base class method. 49 super(Structure, self).__init__(methodName)
50 51
52 - def setUp(self):
53 """Set up for all the functional tests.""" 54 55 # Create the data pipe. 56 self.interpreter.pipe.create('mf', 'mf')
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 """Test the U{bug #20469<https://web.archive.org/web/https://gna.org/bugs/?20469>}, the ScientificPython parser failure with X-ray records.""" 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. 86 self.interpreter.structure.read_pdb('1RTE_trunc.pdb', dir=path, parser='scientific')
87 88
90 """Catch U{bug #20470<https://web.archive.org/web/https://gna.org/bugs/?20470>}, the alternate location indicator problem.""" 91 92 # Path of the structure file. 93 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 94 95 # Load the file, load the spins, and attach the protons. 96 self.interpreter.structure.read_pdb('1OGT_trunc.pdb', dir=path, alt_loc='A') 97 self.interpreter.structure.load_spins(spin_id='@N', ave_pos=True) 98 self.interpreter.sequence.attach_protons()
99 100
101 - def test_delete_empty(self):
102 """Test the deletion of non-existent structural data.""" 103 104 # Delete all structural data. 105 self.interpreter.structure.delete()
106 107
108 - def test_delete_multi_pipe(self):
109 """Test the deletion of structural data in only one pipe.""" 110 111 # Create a structure with a single atom. 112 self.interpreter.structure.add_atom(atom_name='PIV', res_name='M1', res_num=1, pos=[0., 1., 2.], element='S') 113 114 # Create a new data pipe. 115 self.interpreter.pipe.create('new', 'N-state') 116 117 # Create a structure with a single atom. 118 self.interpreter.structure.add_atom(atom_name='PIV', res_name='M1', res_num=2, pos=[4., 5., 6.], element='S') 119 120 # Delete all structural data. 121 self.interpreter.structure.delete() 122 123 # Checks. 124 self.assert_(hasattr(cdp, 'structure')) 125 self.assertEqual(len(cdp.structure.structural_data), 0) 126 self.interpreter.pipe.switch('mf') 127 self.assert_(hasattr(cdp, 'structure')) 128 self.assertEqual(len(cdp.structure.structural_data), 1)
129 130
131 - def test_displacement(self):
132 """Test of the structure.displacement user function.""" 133 134 # Path of the structure file. 135 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 136 137 # Load the file as two models. 138 self.interpreter.structure.read_pdb('Ap4Aase_res1-12.pdb', dir=path, set_model_num=1) 139 self.interpreter.structure.read_pdb('Ap4Aase_res1-12.pdb', dir=path, set_model_num=2) 140 141 # A rotation. 142 R = zeros((3, 3), float64) 143 euler_to_R_zyz(1.3, 0.4, 4.5, R) 144 145 # Rotate the second model. 146 self.interpreter.structure.rotate(R, model=2) 147 148 # Calculate the displacement. 149 self.interpreter.structure.displacement() 150 151 # Shift a third structure back using the calculated displacement. 152 self.interpreter.structure.read_pdb('Ap4Aase_res1-12.pdb', dir=path, set_model_num=3) 153 self.interpreter.structure.rotate(R, model=3) 154 155 # The data to check. 156 models = [1, 2] 157 trans_vect = [ 158 [[0.0, 0.0, 0.0], 159 [ 2.270857972754659, -1.811667138656451, 1.878400649688508]], 160 [[ -2.270857972754659, 1.811667138656451, -1.878400649688508], 161 [0.0, 0.0, 0.0]] 162 ] 163 dist = [ 164 [0.0000000000000000, 3.4593818457148173], 165 [3.4593818457148173, 0.0000000000000000] 166 ] 167 rot_axis = [ 168 [None, 169 [ 0.646165066909452, 0.018875759848125, -0.762964227206007]], 170 [[ -0.646165066909452, -0.018875759848125, 0.762964227206007], 171 None] 172 ] 173 angle = [ 174 [0.0000000000000000, 0.6247677290742989], 175 [0.6247677290742989, 0.0000000000000000] 176 ] 177 178 # Test the results. 179 self.assert_(hasattr(cdp.structure, 'displacements')) 180 for i in range(len(models)): 181 for j in range(len(models)): 182 # Check the translation. 183 self.assertAlmostEqual(cdp.structure.displacements._translation_distance[models[i]][models[j]], dist[i][j]) 184 for k in range(3): 185 self.assertAlmostEqual(cdp.structure.displacements._translation_vector[models[i]][models[j]][k], trans_vect[i][j][k]) 186 187 # Check the rotation. 188 self.assertAlmostEqual(cdp.structure.displacements._rotation_angle[models[i]][models[j]], angle[i][j]) 189 if rot_axis[i][j] != None: 190 for k in range(3): 191 self.assertAlmostEqual(cdp.structure.displacements._rotation_axis[models[i]][models[j]][k], rot_axis[i][j][k]) 192 193 # Save the results. 194 self.tmpfile = mktemp() 195 self.interpreter.state.save(self.tmpfile, dir=None, force=True) 196 197 # Reset relax. 198 self.interpreter.reset() 199 200 # Load the results. 201 self.interpreter.state.load(self.tmpfile) 202 203 # Test the re-loaded data. 204 self.assert_(hasattr(cdp.structure, 'displacements')) 205 for i in range(len(models)): 206 for j in range(len(models)): 207 # Check the translation. 208 self.assertAlmostEqual(cdp.structure.displacements._translation_distance[models[i]][models[j]], dist[i][j]) 209 for k in range(3): 210 self.assertAlmostEqual(cdp.structure.displacements._translation_vector[models[i]][models[j]][k], trans_vect[i][j][k]) 211 212 # Check the rotation. 213 self.assertAlmostEqual(cdp.structure.displacements._rotation_angle[models[i]][models[j]], angle[i][j]) 214 if rot_axis[i][j] != None: 215 for k in range(3): 216 self.assertAlmostEqual(cdp.structure.displacements._rotation_axis[models[i]][models[j]][k], rot_axis[i][j][k])
217 218
219 - def test_load_spins_mol_cat(self):
220 """Test the loading of spins from different molecules into one molecule container.""" 221 222 # Path of the files. 223 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 224 225 # Read the PDBs. 226 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, set_mol_name='L1', parser='internal') 227 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=path, set_mol_name='L2', parser='internal') 228 229 # Load a few protons. 230 self.interpreter.structure.load_spins('#L1:900@C1', mol_name_target='Lactose') 231 self.interpreter.structure.load_spins('#L2:900@C2', mol_name_target='Lactose') 232 233 # Check the spin data. 234 self.assertEqual(len(cdp.mol), 1) 235 self.assertEqual(cdp.mol[0].name, 'Lactose') 236 self.assertEqual(len(cdp.mol[0].res), 1) 237 self.assertEqual(cdp.mol[0].res[0].name, 'UNK') 238 self.assertEqual(cdp.mol[0].res[0].num, 900) 239 self.assertEqual(len(cdp.mol[0].res[0].spin), 2) 240 self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'C1') 241 self.assertEqual(cdp.mol[0].res[0].spin[0].num, 1) 242 self.assertEqual(cdp.mol[0].res[0].spin[1].name, 'C2') 243 self.assertEqual(cdp.mol[0].res[0].spin[1].num, 2)
244 245
246 - def test_load_internal_results(self):
247 """Load the PDB file using the information in a results file (using the internal structural object).""" 248 249 # Path of the files. 250 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 251 252 # Read the results file. 253 self.interpreter.results.read(file='str_internal', dir=path) 254 255 # Test the structure metadata. 256 self.assert_(hasattr(cdp, 'structure')) 257 self.assert_(hasattr(cdp.structure, 'structural_data')) 258 self.assert_(len(cdp.structure.structural_data)) 259 self.assert_(len(cdp.structure.structural_data[0].mol)) 260 261 mol = cdp.structure.structural_data[0].mol[0] 262 self.assertEqual(mol.file_name, 'Ap4Aase_res1-12.pdb') 263 self.assertEqual(mol.file_path, '') 264 self.assertEqual(mol.file_model, 1) 265 self.assertEqual(mol.file_mol_num, 1) 266 267 # The real atomic data. 268 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'] 269 bonded = [[]]*174 270 chain_id = [None]*174 271 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'] 272 pdb_record = ['ATOM']*174 273 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'] 274 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] 275 seg_id = [None]*174 276 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] 277 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] 278 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] 279 280 # Test the atomic data. 281 mol = cdp.structure.structural_data[0].mol[0] 282 for i in range(len(mol.atom_name)): 283 self.assertEqual(mol.atom_name[i], atom_name[i]) 284 self.assertEqual(mol.bonded[i], bonded[i]) 285 self.assertEqual(mol.chain_id[i], chain_id[i]) 286 self.assertEqual(mol.element[i], element[i]) 287 self.assertEqual(mol.pdb_record[i], pdb_record[i]) 288 self.assertEqual(mol.res_name[i], res_name[i]) 289 self.assertEqual(mol.res_num[i], res_num[i]) 290 self.assertEqual(mol.seg_id[i], seg_id[i]) 291 self.assertEqual(mol.x[i], x[i]) 292 self.assertEqual(mol.y[i], y[i]) 293 self.assertEqual(mol.z[i], z[i])
294 295
297 """Load the PDB file using the information in a results file (using the internal structural object).""" 298 299 # Path of the files. 300 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 301 302 # Read the results file. 303 self.interpreter.results.read(file=path+sep+'str_internal')
304 305
307 """Load the PDB file using the information in a results file (using the Scientific python structural object).""" 308 309 # Path of the files. 310 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 311 312 # Read the results file. 313 self.interpreter.results.read(file='str_scientific', dir=path) 314 315 # Test the structure metadata. 316 self.assert_(hasattr(cdp, 'structure')) 317 self.assert_(hasattr(cdp.structure, 'structural_data')) 318 self.assert_(len(cdp.structure.structural_data)) 319 self.assert_(len(cdp.structure.structural_data[0].mol)) 320 321 mol = cdp.structure.structural_data[0].mol[0] 322 self.assertEqual(mol.file_name, 'Ap4Aase_res1-12.pdb') 323 self.assertEqual(mol.file_path, 'test_suite/shared_data/structures') 324 self.assertEqual(mol.file_model, 1) 325 self.assertEqual(mol.file_mol_num, 1) 326 327 # The real atomic data. 328 res_list = ['GLY', 'PRO', 'LEU', 'GLY', 'SER', 'MET', 'ASP', 'SER', 'PRO', 'PRO', 'GLU', 'GLY'] 329 330 # Loop over the residues. 331 i = 0 332 for res_name in cdp.structure.atom_loop(atom_id='@N', res_name_flag=True): 333 # Check the residue data. 334 self.assertEqual(res_name, res_list[i]) 335 336 # Increment the residue counter. 337 i = i + 1
338 339
340 - def test_metadata_xml(self):
341 """Test the storage and loading of metadata into an XML state file.""" 342 343 # Load the file. 344 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 345 self.interpreter.structure.read_pdb('1UBQ.pdb', dir=path) 346 347 # Delete a big chunk of the molecule. 348 self.interpreter.structure.delete(":35-76") 349 350 # Delete all waters. 351 self.interpreter.structure.delete(":HOH") 352 353 # Write out the results file. 354 self.tmpfile = mktemp() + '.bz2' 355 self.interpreter.results.write(self.tmpfile, dir=None) 356 357 # Create a new data pipe and load the results. 358 self.interpreter.pipe.create('xml text', 'mf') 359 self.interpreter.results.read(self.tmpfile) 360 361 # What the data should look like. 362 helices = [ 363 ['H1', 'A', 'ILE', 23, 'A', 'GLU', 34, 1, 12] 364 ] 365 sheets = [ 366 [1, 'BET', 5, 'GLY', 'A', 10, None, 'VAL', 'A', 17, None, 0, None, None, None, None, None, None, None, None, None, None], 367 [2, 'BET', 5, 'MET', 'A', 1, None, 'THR', 'A', 7, None, -1, None, None, None, None, None, None, None, None, None, None] 368 ] 369 370 # Check the helix data. 371 self.assert_(hasattr(cdp.structure, 'helices')) 372 self.assertEqual(len(cdp.structure.helices), 1) 373 self.assertEqual(cdp.structure.helices[0], helices[0]) 374 375 # Check the sheet data. 376 self.assert_(hasattr(cdp.structure, 'sheets')) 377 self.assertEqual(len(cdp.structure.sheets), 2) 378 self.assertEqual(cdp.structure.sheets[0], sheets[0]) 379 self.assertEqual(cdp.structure.sheets[1], sheets[1])
380 381
382 - def test_read_merge(self):
383 """Test the merging of two molecules into one.""" 384 385 # Path of the files. 386 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 387 388 # Read the PDB files. 389 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-6.pdb', dir=path, set_mol_name='Ap4Aase', set_model_num=1) 390 self.interpreter.structure.read_pdb(file='Ap4Aase_res7-12.pdb', dir=path, set_mol_name='Ap4Aase', set_model_num=1, merge=True) 391 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=path, set_mol_name='Ap4Aase', set_model_num=2) 392 393 # Check that everything is ok. 394 cdp.structure.validate_models()
395 396
397 - def test_read_not_pdb(self):
398 """Test the reading of a file by structure.read_pdb that is not a PDB.""" 399 400 # Path of the files. 401 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'saved_states' 402 403 # Read the non-PDB file. 404 self.interpreter.structure.read_pdb(file='basic_single_pipe.bz2', dir=path, parser='internal')
405 406
407 - def test_read_pdb_internal1(self):
408 """Load the '1F35_N_H_molmol.pdb' PDB file (using the internal structural object PDB reader).""" 409 410 # Path of the files. 411 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 412 413 # Read the PDB. 414 self.interpreter.structure.read_pdb(file='1F35_N_H_molmol.pdb', dir=path, parser='internal') 415 416 # Test the molecule name. 417 self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name, '1F35_N_H_molmol_mol1') 418 419 # Load a single atom and test it. 420 self.interpreter.structure.load_spins('#1F35_N_H_molmol_mol1:3@N') 421 self.assertEqual(count_spins(), 1) 422 423 # Try loading a few protons. 424 self.interpreter.structure.load_spins('@*H*') 425 426 # And now all the rest of the atoms. 427 self.interpreter.structure.load_spins() 428 429 # Extract a N-Ca vector. 430 self.interpreter.dipole_pair.define(spin_id1='@CA', spin_id2='#1F35_N_H_molmol_mol1:3@N') 431 self.interpreter.dipole_pair.unit_vectors() 432 print(cdp.interatomic[0]) 433 self.assert_(hasattr(cdp.interatomic[0], 'vector'))
434 435
436 - def test_read_pdb_internal2(self):
437 """Load the 'Ap4Aase_res1-12.pdb' PDB file (using the internal structural object PDB reader).""" 438 439 # Path of the files. 440 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 441 442 # Read the PDB. 443 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=path, parser='internal') 444 445 # Try loading a few protons. 446 self.interpreter.structure.load_spins('@*H*') 447 448 # And now all the rest of the atoms. 449 self.interpreter.structure.load_spins()
450 451
452 - def test_read_pdb_internal3(self):
453 """Load the 'gromacs.pdb' PDB file (using the internal structural object PDB reader).""" 454 455 # Path of the files. 456 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'phthalic_acid' 457 458 # Read the PDB. 459 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, parser='internal') 460 461 # Try loading a few protons, without positions averaging across models. 462 self.interpreter.structure.load_spins('@*H*', ave_pos=False) 463 464 # A test. 465 self.assertEqual(len(cdp.mol[0].res[0].spin[0].pos), 2) 466 467 # And now all the rest of the atoms. 468 self.interpreter.structure.load_spins()
469 470
471 - def test_read_pdb_internal4(self):
472 """Load the 'tylers_peptide_trunc.pdb' PDB file (using the internal structural object PDB reader).""" 473 474 # Path of the files. 475 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 476 477 # Read the PDB. 478 self.interpreter.structure.read_pdb(file='tylers_peptide_trunc.pdb', dir=path, parser='internal') 479 480 # Try loading a few protons. 481 self.interpreter.structure.load_spins('@*H*') 482 483 # And now all the rest of the atoms. 484 self.interpreter.structure.load_spins()
485 486
487 - def test_read_pdb_internal5(self):
488 """Load the 'lactose_MCMM4_S1_1.pdb' PDB file (using the internal structural object PDB reader).""" 489 490 # Path of the files. 491 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 492 493 # Read the PDB. 494 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='internal') 495 496 # Try loading a few protons. 497 self.interpreter.structure.load_spins('@*H*') 498 499 # And now all the rest of the atoms. 500 self.interpreter.structure.load_spins()
501 502
503 - def test_read_pdb_internal6(self):
504 """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).""" 505 506 # Path of the files. 507 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 508 509 # Read the PDB twice. 510 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='internal') 511 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=path, parser='internal') 512 513 # Try loading a few protons. 514 self.interpreter.structure.load_spins('@*H*') 515 516 # And now all the rest of the atoms. 517 self.interpreter.structure.load_spins()
518 519
520 - def test_read_pdb_internal7(self):
521 """Load the 'lactose_MCMM4_S1_1.pdb' PDB file twice as 2 separate structures (using the internal structural object PDB reader).""" 522 523 # Path of the files. 524 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 525 526 # Read the PDB twice. 527 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='internal') 528 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='internal') 529 530 # Try loading a few protons. 531 self.interpreter.structure.load_spins('@*H*') 532 533 # And now all the rest of the atoms. 534 self.interpreter.structure.load_spins()
535 536
538 """Load a few 'lactose_MCMM4_S1_*.pdb' PDB files as models (using the internal structural object PDB reader).""" 539 540 # Path of the files. 541 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 542 543 # Files. 544 files = ['lactose_MCMM4_S1_1.pdb', 545 'lactose_MCMM4_S1_2.pdb', 546 'lactose_MCMM4_S1_3.pdb'] 547 548 # Read the PDBs. 549 self.interpreter.structure.read_pdb(file=files[0], dir=path, parser='internal', set_model_num=1) 550 self.interpreter.structure.read_pdb(file=files[1], dir=path, parser='internal', set_model_num=1) 551 self.interpreter.structure.read_pdb(file=files[2], dir=path, parser='internal', set_model_num=1) 552 553 # Try loading a few protons. 554 self.interpreter.structure.load_spins('@*H*') 555 556 # And now all the rest of the atoms. 557 self.interpreter.structure.load_spins() 558 559 # Test the structural data. 560 self.assert_(hasattr(cdp, 'structure')) 561 self.assert_(hasattr(cdp.structure, 'structural_data')) 562 self.assertEqual(len(cdp.structure.structural_data), 1) 563 self.assertEqual(len(cdp.structure.structural_data[0].mol), 3) 564 565 i = 0 566 for mol in cdp.structure.structural_data[0].mol: 567 self.assertEqual(mol.file_name, files[i]) 568 self.assertEqual(mol.file_path, path) 569 self.assertEqual(mol.file_model, 1) 570 self.assertEqual(mol.file_mol_num, 1) 571 i = i + 1
572 573
575 """Load the 2 models of the 'gromacs.pdb' PDB file as separate molecules of the same model (using the internal structural object PDB reader).""" 576 577 # Path of the files. 578 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'phthalic_acid' 579 580 # Read the PDB models. 581 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, parser='internal', read_model=1, set_model_num=1) 582 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, parser='internal', read_model=2, set_model_num=1) 583 584 # Try loading a few protons. 585 self.interpreter.structure.load_spins('@*H*') 586 587 # And now all the rest of the atoms. 588 self.interpreter.structure.load_spins() 589 590 # Test the structural data. 591 self.assert_(hasattr(cdp, 'structure')) 592 self.assert_(hasattr(cdp.structure, 'structural_data')) 593 self.assertEqual(len(cdp.structure.structural_data), 1) 594 self.assertEqual(len(cdp.structure.structural_data[0].mol), 2) 595 596 i = 0 597 for mol in cdp.structure.structural_data[0].mol: 598 self.assertEqual(mol.file_name, 'gromacs.pdb') 599 self.assertEqual(mol.file_path, path) 600 self.assertEqual(mol.file_model, i+1) 601 self.assertEqual(mol.file_mol_num, 1) 602 i = i + 1
603 604
606 """Test the packing of models and molecules using 'gromacs.pdb' and 'lactose_MCMM4_S1_*.pdb' (using the internal structural object PDB reader).""" 607 608 # Path of the files. 609 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 610 611 # Read the PDB models. 612 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path+sep+'phthalic_acid', parser='internal') 613 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_1.pdb', dir=path, parser='internal', set_model_num=1, set_mol_name='lactose_MCMM4_S1') 614 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_2.pdb', dir=path, parser='internal', set_model_num=2, set_mol_name='lactose_MCMM4_S1') 615 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_3.pdb', dir=path, parser='internal', set_model_num=1, set_mol_name='lactose_MCMM4_S1b') 616 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_4.pdb', dir=path, parser='internal', set_model_num=2, set_mol_name='lactose_MCMM4_S1b') 617 618 # Try loading a few protons. 619 self.interpreter.structure.load_spins('@*H*') 620 621 # And now all the rest of the atoms. 622 self.interpreter.structure.load_spins() 623 624 # Test the structural data. 625 self.assert_(hasattr(cdp, 'structure')) 626 self.assert_(hasattr(cdp.structure, 'structural_data')) 627 self.assertEqual(len(cdp.structure.structural_data), 2) 628 self.assertEqual(len(cdp.structure.structural_data[0].mol), 3) 629 self.assertEqual(len(cdp.structure.structural_data[1].mol), 3) 630 631 files = [['gromacs.pdb', 'lactose_MCMM4_S1_1.pdb', 'lactose_MCMM4_S1_3.pdb'], 632 ['gromacs.pdb', 'lactose_MCMM4_S1_2.pdb', 'lactose_MCMM4_S1_4.pdb']] 633 paths = [[path+sep+'phthalic_acid', path+sep+'lactose', path+sep+'lactose'], 634 [path+sep+'phthalic_acid', path+sep+'lactose', path+sep+'lactose']] 635 models = [[1, 1, 1], [2, 1, 1]] 636 637 for i in range(len(cdp.structure.structural_data)): 638 for j in range(len(cdp.structure.structural_data[i].mol)): 639 mol = cdp.structure.structural_data[i].mol[j] 640 self.assertEqual(mol.file_name, files[i][j]) 641 self.assertEqual(mol.file_path, paths[i][j]) 642 self.assertEqual(mol.file_model, models[i][j]) 643 self.assertEqual(mol.file_mol_num, 1)
644 645
646 - def test_read_pdb_scientific1(self):
647 """Load the '1F35_N_H_molmol.pdb' PDB file (using the Scientific python structural object PDB reader).""" 648 649 # Path of the files. 650 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 651 652 # Read the PDB. 653 self.interpreter.structure.read_pdb(file='1F35_N_H_molmol.pdb', dir=path, parser='scientific') 654 655 # Load a single atom and test it. 656 self.interpreter.structure.load_spins('#1F35_N_H_molmol_mol1:3@N') 657 self.assertEqual(count_spins(), 1) 658 659 # Try loading a few protons. 660 self.interpreter.structure.load_spins('@*H*') 661 662 # And now all the rest of the atoms. 663 self.interpreter.structure.load_spins() 664 665 # Extract a N-Ca vector. 666 self.interpreter.dipole_pair.define(spin_id1='@CA', spin_id2='#1F35_N_H_molmol_mol1:3@N') 667 self.interpreter.dipole_pair.unit_vectors() 668 print(cdp.interatomic[0]) 669 self.assert_(hasattr(cdp.interatomic[0], 'vector'))
670 671
672 - def test_read_pdb_scientific2(self):
673 """Load the 'Ap4Aase_res1-12.pdb' PDB file (using the Scientific python structural object PDB reader).""" 674 675 # Path of the files. 676 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 677 678 # Read the PDB. 679 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=path, parser='scientific') 680 681 # Try loading a few protons. 682 self.interpreter.structure.load_spins('@*H*') 683 684 # And now all the rest of the atoms. 685 self.interpreter.structure.load_spins()
686 687
688 - def test_read_pdb_scientific3(self):
689 """Load the 'gromacs.pdb' PDB file (using the Scientific python structural object PDB reader).""" 690 691 # Path of the files. 692 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'phthalic_acid' 693 694 # Read the PDB. 695 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, parser='scientific') 696 697 # Try loading a few protons. 698 self.interpreter.structure.load_spins('@*H*', ave_pos=False) 699 700 # A test. 701 self.assertEqual(len(cdp.mol[0].res[0].spin[0].pos), 2) 702 703 # And now all the rest of the atoms. 704 self.interpreter.structure.load_spins()
705 706
707 - def test_read_pdb_scientific4(self):
708 """Load the 'tylers_peptide_trunc.pdb' PDB file (using the Scientific python structural object PDB reader).""" 709 710 # Path of the files. 711 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 712 713 # Read the PDB. 714 self.interpreter.structure.read_pdb(file='tylers_peptide_trunc.pdb', dir=path, parser='scientific') 715 716 # Try loading a few protons. 717 self.interpreter.structure.load_spins('@*H*') 718 719 # And now all the rest of the atoms. 720 self.interpreter.structure.load_spins()
721 722
723 - def test_read_pdb_scientific5(self):
724 """Load the 'lactose_MCMM4_S1_1.pdb' PDB file (using the Scientific python structural object PDB reader).""" 725 726 # Path of the files. 727 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 728 729 # Read the PDB. 730 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='scientific') 731 732 # Try loading a few protons. 733 self.interpreter.structure.load_spins('@*H*') 734 735 # And now all the rest of the atoms. 736 self.interpreter.structure.load_spins()
737 738
739 - def test_read_pdb_scientific6(self):
740 """Load the 'lactose_MCMM4_S1_1.pdb' and 'lactose_MCMM4_S1_2.pdb' PDB files as 2 separate structures (using the Scientific python structural object PDB reader).""" 741 742 # Path of the files. 743 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 744 745 # Read the PDB twice. 746 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='scientific') 747 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=path, parser='scientific') 748 749 # Try loading a few protons. 750 self.interpreter.structure.load_spins('@*H*') 751 752 # And now all the rest of the atoms. 753 self.interpreter.structure.load_spins()
754 755
756 - def test_read_pdb_scientific7(self):
757 """Load the 'lactose_MCMM4_S1_1.pdb' PDB file twice as 2 separate structures (using the Scientific python structural object PDB reader).""" 758 759 # Path of the files. 760 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 761 762 # Read the PDB twice. 763 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='scientific') 764 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='scientific') 765 766 # Try loading a few protons. 767 self.interpreter.structure.load_spins('@*H*') 768 769 # And now all the rest of the atoms. 770 self.interpreter.structure.load_spins()
771 772
774 """Load a few 'lactose_MCMM4_S1_*.pdb' PDB files as models (using the Scientific python structural object PDB reader).""" 775 776 # Path of the files. 777 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 778 779 # Files. 780 files = ['lactose_MCMM4_S1_1.pdb', 781 'lactose_MCMM4_S1_2.pdb', 782 'lactose_MCMM4_S1_3.pdb'] 783 784 # Read the PDBs. 785 self.interpreter.structure.read_pdb(file=files[0], dir=path, parser='scientific', set_model_num=1) 786 self.interpreter.structure.read_pdb(file=files[1], dir=path, parser='scientific', set_model_num=1) 787 self.interpreter.structure.read_pdb(file=files[2], dir=path, parser='scientific', set_model_num=1) 788 789 # Try loading a few protons. 790 self.interpreter.structure.load_spins('@*H*') 791 792 # And now all the rest of the atoms. 793 self.interpreter.structure.load_spins() 794 795 # Test the structural data. 796 self.assert_(hasattr(cdp, 'structure')) 797 self.assert_(hasattr(cdp.structure, 'structural_data')) 798 self.assertEqual(len(cdp.structure.structural_data), 1) 799 self.assertEqual(len(cdp.structure.structural_data[0].mol), 6) 800 801 i = 0 802 for mol in cdp.structure.structural_data[0].mol: 803 self.assertEqual(mol.file_name, files[int(i/2)]) 804 self.assertEqual(mol.file_path, path) 805 self.assertEqual(mol.file_model, 1) 806 self.assertEqual(mol.file_mol_num, i%2+1) # Odd i, num=1, even i, num=2. 807 i = i + 1
808 809
811 """Load the 2 models of the 'gromacs.pdb' PDB file as separate molecules of the same model (using the Scientific python structural object PDB reader).""" 812 813 # Path of the files. 814 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'phthalic_acid' 815 816 # Read the PDB models. 817 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, parser='scientific', read_model=1, set_model_num=1) 818 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, parser='scientific', read_model=2, set_model_num=1) 819 820 # Try loading a few protons. 821 self.interpreter.structure.load_spins('@*H*') 822 823 # And now all the rest of the atoms. 824 self.interpreter.structure.load_spins() 825 826 # Test the structural data. 827 self.assert_(hasattr(cdp, 'structure')) 828 self.assert_(hasattr(cdp.structure, 'structural_data')) 829 self.assertEqual(len(cdp.structure.structural_data), 1) 830 self.assertEqual(len(cdp.structure.structural_data[0].mol), 2) 831 832 i = 0 833 for mol in cdp.structure.structural_data[0].mol: 834 self.assertEqual(mol.file_name, 'gromacs.pdb') 835 self.assertEqual(mol.file_path, path) 836 self.assertEqual(mol.file_model, i+1) 837 self.assertEqual(mol.file_mol_num, 1) 838 i = i + 1
839 840
842 """Test the packing of models and molecules using 'gromacs.pdb' and 'lactose_MCMM4_S1_*.pdb' (using the Scientific python structural object PDB reader).""" 843 844 # Path of the files. 845 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 846 847 # Read the PDB models. 848 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path+sep+'phthalic_acid', parser='scientific') 849 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_1.pdb', dir=path, parser='scientific', read_mol=1, set_model_num=1, set_mol_name='lactose_MCMM4_S1') 850 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_2.pdb', dir=path, parser='scientific', read_mol=1, set_model_num=2, set_mol_name='lactose_MCMM4_S1') 851 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_3.pdb', dir=path, parser='scientific', read_mol=1, set_model_num=1, set_mol_name='lactose_MCMM4_S1b') 852 self.interpreter.structure.read_pdb(file='lactose'+sep+'lactose_MCMM4_S1_4.pdb', dir=path, parser='scientific', read_mol=1, set_model_num=2, set_mol_name='lactose_MCMM4_S1b') 853 854 # Try loading a few protons. 855 self.interpreter.structure.load_spins('@*H*') 856 857 # And now all the rest of the atoms. 858 self.interpreter.structure.load_spins() 859 860 # Test the structural data. 861 self.assert_(hasattr(cdp, 'structure')) 862 self.assert_(hasattr(cdp.structure, 'structural_data')) 863 self.assertEqual(len(cdp.structure.structural_data), 2) 864 self.assertEqual(len(cdp.structure.structural_data[0].mol), 3) 865 self.assertEqual(len(cdp.structure.structural_data[1].mol), 3) 866 867 files = [['gromacs.pdb', 'lactose_MCMM4_S1_1.pdb', 'lactose_MCMM4_S1_3.pdb'], 868 ['gromacs.pdb', 'lactose_MCMM4_S1_2.pdb', 'lactose_MCMM4_S1_4.pdb']] 869 paths = [[path+sep+'phthalic_acid', path+sep+'lactose', path+sep+'lactose'], 870 [path+sep+'phthalic_acid', path+sep+'lactose', path+sep+'lactose']] 871 models = [[1, 1, 1], [2, 1, 1]] 872 873 for i in range(len(cdp.structure.structural_data)): 874 for j in range(len(cdp.structure.structural_data[i].mol)): 875 mol = cdp.structure.structural_data[i].mol[j] 876 self.assertEqual(mol.file_name, files[i][j]) 877 self.assertEqual(mol.file_path, paths[i][j]) 878 self.assertEqual(mol.file_model, models[i][j]) 879 self.assertEqual(mol.file_mol_num, 1)
880 881
882 - def test_read_pdb_1UBQ(self):
883 """Test the reading of the complete 1UBQ PDB file.""" 884 885 # Load the file. 886 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 887 self.interpreter.structure.read_pdb('1UBQ.pdb', dir=path) 888 889 # Check the data. 890 self.assert_(hasattr(cdp, 'structure')) 891 self.assert_(hasattr(cdp.structure, 'structural_data')) 892 self.assertEqual(len(cdp.structure.structural_data), 1) 893 self.assertEqual(len(cdp.structure.structural_data[0].mol), 1) 894 895 # Check the first atom. 896 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_num[0], 1) 897 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_name[0], 'N') 898 self.assertEqual(cdp.structure.structural_data[0].mol[0].chain_id[0], 'A') 899 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_name[0], 'MET') 900 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_num[0], 1) 901 self.assertEqual(cdp.structure.structural_data[0].mol[0].x[0], 27.340) 902 self.assertEqual(cdp.structure.structural_data[0].mol[0].y[0], 24.430) 903 self.assertEqual(cdp.structure.structural_data[0].mol[0].z[0], 2.614) 904 self.assertEqual(cdp.structure.structural_data[0].mol[0].element[0], 'N') 905 906 # Check the last atom (from the last water HETATM record). 907 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_num[-1], 661) 908 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_name[-1], 'O') 909 self.assertEqual(cdp.structure.structural_data[0].mol[0].chain_id[-1], None) 910 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_name[-1], 'HOH') 911 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_num[-1], 58) 912 self.assertEqual(cdp.structure.structural_data[0].mol[0].x[-1], 37.667) 913 self.assertEqual(cdp.structure.structural_data[0].mol[0].y[-1], 43.421) 914 self.assertEqual(cdp.structure.structural_data[0].mol[0].z[-1], 17.000) 915 self.assertEqual(cdp.structure.structural_data[0].mol[0].element[-1], 'O')
916 917
918 - def test_read_write_pdb_1UBQ(self):
919 """Test the reading and writing of the 1UBQ PDB file.""" 920 921 # Load the file. 922 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 923 self.interpreter.structure.read_pdb('1UBQ.pdb', dir=path) 924 925 # Delete a big chunk of the molecule. 926 self.interpreter.structure.delete(":35-76") 927 928 # Delete all waters. 929 self.interpreter.structure.delete(":HOH") 930 931 # Write out the file. 932 self.tmpfile = mktemp() + '.pdb' 933 self.interpreter.structure.write_pdb(self.tmpfile) 934 935 # Read the contents of the file. 936 file = open(self.tmpfile) 937 lines = file.readlines() 938 file.close() 939 940 # What the contents should be. 941 real_data = [ 942 "REMARK 4 THIS FILE COMPLIES WITH FORMAT V. 3.30, JUL-2011. \n", 943 "REMARK 40 CREATED BY RELAX (HTTP://NMR-RELAX.COM). \n", 944 "HELIX 1 H1 ILE A 23 GLU A 34 1 12 \n", 945 "SHEET 1 BET 5 GLY A 10 VAL A 17 0 \n", 946 "SHEET 2 BET 5 MET A 1 THR A 7 -1 \n", 947 "ATOM 1 N MET A 1 27.340 24.430 2.614 1.00 0.00 N \n", 948 "ATOM 2 CA MET A 1 26.266 25.413 2.842 1.00 0.00 C \n", 949 "ATOM 3 C MET A 1 26.913 26.639 3.531 1.00 0.00 C \n", 950 "ATOM 4 O MET A 1 27.886 26.463 4.263 1.00 0.00 O \n", 951 "ATOM 5 CB MET A 1 25.112 24.880 3.649 1.00 0.00 C \n", 952 "ATOM 6 CG MET A 1 25.353 24.860 5.134 1.00 0.00 C \n", 953 "ATOM 7 SD MET A 1 23.930 23.959 5.904 1.00 0.00 S \n", 954 "ATOM 8 CE MET A 1 24.447 23.984 7.620 1.00 0.00 C \n", 955 "ATOM 9 N GLN A 2 26.335 27.770 3.258 1.00 0.00 N \n", 956 "ATOM 10 CA GLN A 2 26.850 29.021 3.898 1.00 0.00 C \n", 957 "ATOM 11 C GLN A 2 26.100 29.253 5.202 1.00 0.00 C \n", 958 "ATOM 12 O GLN A 2 24.865 29.024 5.330 1.00 0.00 O \n", 959 "ATOM 13 CB GLN A 2 26.733 30.148 2.905 1.00 0.00 C \n", 960 "ATOM 14 CG GLN A 2 26.882 31.546 3.409 1.00 0.00 C \n", 961 "ATOM 15 CD GLN A 2 26.786 32.562 2.270 1.00 0.00 C \n", 962 "ATOM 16 OE1 GLN A 2 27.783 33.160 1.870 1.00 0.00 O \n", 963 "ATOM 17 NE2 GLN A 2 25.562 32.733 1.806 1.00 0.00 N \n", 964 "ATOM 18 N ILE A 3 26.849 29.656 6.217 1.00 0.00 N \n", 965 "ATOM 19 CA ILE A 3 26.235 30.058 7.497 1.00 0.00 C \n", 966 "ATOM 20 C ILE A 3 26.882 31.428 7.862 1.00 0.00 C \n", 967 "ATOM 21 O ILE A 3 27.906 31.711 7.264 1.00 0.00 O \n", 968 "ATOM 22 CB ILE A 3 26.344 29.050 8.645 1.00 0.00 C \n", 969 "ATOM 23 CG1 ILE A 3 27.810 28.748 8.999 1.00 0.00 C \n", 970 "ATOM 24 CG2 ILE A 3 25.491 27.771 8.287 1.00 0.00 C \n", 971 "ATOM 25 CD1 ILE A 3 27.967 28.087 10.417 1.00 0.00 C \n", 972 "ATOM 26 N PHE A 4 26.214 32.097 8.771 1.00 0.00 N \n", 973 "ATOM 27 CA PHE A 4 26.772 33.436 9.197 1.00 0.00 C \n", 974 "ATOM 28 C PHE A 4 27.151 33.362 10.650 1.00 0.00 C \n", 975 "ATOM 29 O PHE A 4 26.350 32.778 11.395 1.00 0.00 O \n", 976 "ATOM 30 CB PHE A 4 25.695 34.498 8.946 1.00 0.00 C \n", 977 "ATOM 31 CG PHE A 4 25.288 34.609 7.499 1.00 0.00 C \n", 978 "ATOM 32 CD1 PHE A 4 24.147 33.966 7.038 1.00 0.00 C \n", 979 "ATOM 33 CD2 PHE A 4 26.136 35.346 6.640 1.00 0.00 C \n", 980 "ATOM 34 CE1 PHE A 4 23.812 34.031 5.677 1.00 0.00 C \n", 981 "ATOM 35 CE2 PHE A 4 25.810 35.392 5.267 1.00 0.00 C \n", 982 "ATOM 36 CZ PHE A 4 24.620 34.778 4.853 1.00 0.00 C \n", 983 "ATOM 37 N VAL A 5 28.260 33.943 11.096 1.00 0.00 N \n", 984 "ATOM 38 CA VAL A 5 28.605 33.965 12.503 1.00 0.00 C \n", 985 "ATOM 39 C VAL A 5 28.638 35.461 12.900 1.00 0.00 C \n", 986 "ATOM 40 O VAL A 5 29.522 36.103 12.320 1.00 0.00 O \n", 987 "ATOM 41 CB VAL A 5 29.963 33.317 12.814 1.00 0.00 C \n", 988 "ATOM 42 CG1 VAL A 5 30.211 33.394 14.304 1.00 0.00 C \n", 989 "ATOM 43 CG2 VAL A 5 29.957 31.838 12.352 1.00 0.00 C \n", 990 "ATOM 44 N LYS A 6 27.751 35.867 13.740 1.00 0.00 N \n", 991 "ATOM 45 CA LYS A 6 27.691 37.315 14.143 1.00 0.00 C \n", 992 "ATOM 46 C LYS A 6 28.469 37.475 15.420 1.00 0.00 C \n", 993 "ATOM 47 O LYS A 6 28.213 36.753 16.411 1.00 0.00 O \n", 994 "ATOM 48 CB LYS A 6 26.219 37.684 14.307 1.00 0.00 C \n", 995 "ATOM 49 CG LYS A 6 25.884 39.139 14.615 1.00 0.00 C \n", 996 "ATOM 50 CD LYS A 6 24.348 39.296 14.642 1.00 0.00 C \n", 997 "ATOM 51 CE LYS A 6 23.865 40.723 14.749 1.00 0.00 C \n", 998 "ATOM 52 NZ LYS A 6 22.375 40.720 14.907 1.00 0.00 N \n", 999 "ATOM 53 N THR A 7 29.426 38.430 15.446 1.00 0.00 N \n", 1000 "ATOM 54 CA THR A 7 30.225 38.643 16.662 1.00 0.00 C \n", 1001 "ATOM 55 C THR A 7 29.664 39.839 17.434 1.00 0.00 C \n", 1002 "ATOM 56 O THR A 7 28.850 40.565 16.859 1.00 0.00 O \n", 1003 "ATOM 57 CB THR A 7 31.744 38.879 16.299 1.00 0.00 C \n", 1004 "ATOM 58 OG1 THR A 7 31.737 40.257 15.824 1.00 0.00 O \n", 1005 "ATOM 59 CG2 THR A 7 32.260 37.969 15.171 1.00 0.00 C \n", 1006 "ATOM 60 N LEU A 8 30.132 40.069 18.642 1.00 0.00 N \n", 1007 "ATOM 61 CA LEU A 8 29.607 41.180 19.467 1.00 0.00 C \n", 1008 "ATOM 62 C LEU A 8 30.075 42.538 18.984 1.00 0.00 C \n", 1009 "ATOM 63 O LEU A 8 29.586 43.570 19.483 1.00 0.00 O \n", 1010 "ATOM 64 CB LEU A 8 29.919 40.890 20.938 1.00 0.00 C \n", 1011 "ATOM 65 CG LEU A 8 29.183 39.722 21.581 1.00 0.00 C \n", 1012 "ATOM 66 CD1 LEU A 8 29.308 39.750 23.095 1.00 0.00 C \n", 1013 "ATOM 67 CD2 LEU A 8 27.700 39.721 21.228 1.00 0.00 C \n", 1014 "ATOM 68 N THR A 9 30.991 42.571 17.998 1.00 0.00 N \n", 1015 "ATOM 69 CA THR A 9 31.422 43.940 17.553 1.00 0.00 C \n", 1016 "ATOM 70 C THR A 9 30.755 44.351 16.277 1.00 0.00 C \n", 1017 "ATOM 71 O THR A 9 31.207 45.268 15.566 1.00 0.00 O \n", 1018 "ATOM 72 CB THR A 9 32.979 43.918 17.445 1.00 0.00 C \n", 1019 "ATOM 73 OG1 THR A 9 33.174 43.067 16.265 1.00 0.00 O \n", 1020 "ATOM 74 CG2 THR A 9 33.657 43.319 18.672 1.00 0.00 C \n", 1021 "ATOM 75 N GLY A 10 29.721 43.673 15.885 1.00 0.00 N \n", 1022 "ATOM 76 CA GLY A 10 28.978 43.960 14.678 1.00 0.00 C \n", 1023 "ATOM 77 C GLY A 10 29.604 43.507 13.393 1.00 0.00 C \n", 1024 "ATOM 78 O GLY A 10 29.219 43.981 12.301 1.00 0.00 O \n", 1025 "ATOM 79 N LYS A 11 30.563 42.623 13.495 1.00 0.00 N \n", 1026 "ATOM 80 CA LYS A 11 31.191 42.012 12.331 1.00 0.00 C \n", 1027 "ATOM 81 C LYS A 11 30.459 40.666 12.130 1.00 0.00 C \n", 1028 "ATOM 82 O LYS A 11 30.253 39.991 13.133 1.00 0.00 O \n", 1029 "ATOM 83 CB LYS A 11 32.672 41.717 12.505 1.00 0.00 C \n", 1030 "ATOM 84 CG LYS A 11 33.280 41.086 11.227 1.00 0.00 C \n", 1031 "ATOM 85 CD LYS A 11 34.762 40.799 11.470 1.00 0.00 C \n", 1032 "ATOM 86 CE LYS A 11 35.614 40.847 10.240 1.00 0.00 C \n", 1033 "ATOM 87 NZ LYS A 11 35.100 40.073 9.101 1.00 0.00 N \n", 1034 "ATOM 88 N THR A 12 30.163 40.338 10.886 1.00 0.00 N \n", 1035 "ATOM 89 CA THR A 12 29.542 39.020 10.653 1.00 0.00 C \n", 1036 "ATOM 90 C THR A 12 30.494 38.261 9.729 1.00 0.00 C \n", 1037 "ATOM 91 O THR A 12 30.849 38.850 8.706 1.00 0.00 O \n", 1038 "ATOM 92 CB THR A 12 28.113 39.049 10.015 1.00 0.00 C \n", 1039 "ATOM 93 OG1 THR A 12 27.280 39.722 10.996 1.00 0.00 O \n", 1040 "ATOM 94 CG2 THR A 12 27.588 37.635 9.715 1.00 0.00 C \n", 1041 "ATOM 95 N ILE A 13 30.795 37.015 10.095 1.00 0.00 N \n", 1042 "ATOM 96 CA ILE A 13 31.720 36.289 9.176 1.00 0.00 C \n", 1043 "ATOM 97 C ILE A 13 30.955 35.211 8.459 1.00 0.00 C \n", 1044 "ATOM 98 O ILE A 13 30.025 34.618 9.040 1.00 0.00 O \n", 1045 "ATOM 99 CB ILE A 13 32.995 35.883 9.934 1.00 0.00 C \n", 1046 "ATOM 100 CG1 ILE A 13 33.306 34.381 9.840 1.00 0.00 C \n", 1047 "ATOM 101 CG2 ILE A 13 33.109 36.381 11.435 1.00 0.00 C \n", 1048 "ATOM 102 CD1 ILE A 13 34.535 34.028 10.720 1.00 0.00 C \n", 1049 "ATOM 103 N THR A 14 31.244 34.986 7.197 1.00 0.00 N \n", 1050 "ATOM 104 CA THR A 14 30.505 33.884 6.512 1.00 0.00 C \n", 1051 "ATOM 105 C THR A 14 31.409 32.680 6.446 1.00 0.00 C \n", 1052 "ATOM 106 O THR A 14 32.619 32.812 6.125 1.00 0.00 O \n", 1053 "ATOM 107 CB THR A 14 30.091 34.393 5.078 1.00 0.00 C \n", 1054 "ATOM 108 OG1 THR A 14 31.440 34.513 4.487 1.00 0.00 O \n", 1055 "ATOM 109 CG2 THR A 14 29.420 35.756 5.119 1.00 0.00 C \n", 1056 "ATOM 110 N LEU A 15 30.884 31.485 6.666 1.00 0.00 N \n", 1057 "ATOM 111 CA LEU A 15 31.677 30.275 6.639 1.00 0.00 C \n", 1058 "ATOM 112 C LEU A 15 31.022 29.288 5.665 1.00 0.00 C \n", 1059 "ATOM 113 O LEU A 15 29.809 29.395 5.545 1.00 0.00 O \n", 1060 "ATOM 114 CB LEU A 15 31.562 29.686 8.045 1.00 0.00 C \n", 1061 "ATOM 115 CG LEU A 15 32.631 29.444 9.060 1.00 0.00 C \n", 1062 "ATOM 116 CD1 LEU A 15 33.814 30.390 9.030 1.00 0.00 C \n", 1063 "ATOM 117 CD2 LEU A 15 31.945 29.449 10.436 1.00 0.00 C \n", 1064 "ATOM 118 N GLU A 16 31.834 28.412 5.125 1.00 0.00 N \n", 1065 "ATOM 119 CA GLU A 16 31.220 27.341 4.275 1.00 0.00 C \n", 1066 "ATOM 120 C GLU A 16 31.440 26.079 5.080 1.00 0.00 C \n", 1067 "ATOM 121 O GLU A 16 32.576 25.802 5.461 1.00 0.00 O \n", 1068 "ATOM 122 CB GLU A 16 31.827 27.262 2.894 1.00 0.00 C \n", 1069 "ATOM 123 CG GLU A 16 31.363 28.410 1.962 1.00 0.00 C \n", 1070 "ATOM 124 CD GLU A 16 31.671 28.291 0.498 1.00 0.00 C \n", 1071 "ATOM 125 OE1 GLU A 16 30.869 28.621 -0.366 1.00 0.00 O \n", 1072 "ATOM 126 OE2 GLU A 16 32.835 27.861 0.278 1.00 0.00 O \n", 1073 "ATOM 127 N VAL A 17 30.310 25.458 5.384 1.00 0.00 N \n", 1074 "ATOM 128 CA VAL A 17 30.288 24.245 6.193 1.00 0.00 C \n", 1075 "ATOM 129 C VAL A 17 29.279 23.227 5.641 1.00 0.00 C \n", 1076 "ATOM 130 O VAL A 17 28.478 23.522 4.725 1.00 0.00 O \n", 1077 "ATOM 131 CB VAL A 17 29.903 24.590 7.665 1.00 0.00 C \n", 1078 "ATOM 132 CG1 VAL A 17 30.862 25.496 8.389 1.00 0.00 C \n", 1079 "ATOM 133 CG2 VAL A 17 28.476 25.135 7.705 1.00 0.00 C \n", 1080 "ATOM 134 N GLU A 18 29.380 22.057 6.232 1.00 0.00 N \n", 1081 "ATOM 135 CA GLU A 18 28.468 20.940 5.980 1.00 0.00 C \n", 1082 "ATOM 136 C GLU A 18 27.819 20.609 7.316 1.00 0.00 C \n", 1083 "ATOM 137 O GLU A 18 28.449 20.674 8.360 1.00 0.00 O \n", 1084 "ATOM 138 CB GLU A 18 29.213 19.697 5.506 1.00 0.00 C \n", 1085 "ATOM 139 CG GLU A 18 29.728 19.755 4.060 1.00 0.00 C \n", 1086 "ATOM 140 CD GLU A 18 28.754 20.061 2.978 1.00 0.00 C \n", 1087 "ATOM 141 OE1 GLU A 18 27.546 19.992 2.985 1.00 0.00 O \n", 1088 "ATOM 142 OE2 GLU A 18 29.336 20.423 1.904 1.00 0.00 O \n", 1089 "ATOM 143 N PRO A 19 26.559 20.220 7.288 1.00 0.00 N \n", 1090 "ATOM 144 CA PRO A 19 25.829 19.825 8.494 1.00 0.00 C \n", 1091 "ATOM 145 C PRO A 19 26.541 18.732 9.251 1.00 0.00 C \n", 1092 "ATOM 146 O PRO A 19 26.333 18.536 10.457 1.00 0.00 O \n", 1093 "ATOM 147 CB PRO A 19 24.469 19.332 7.952 1.00 0.00 C \n", 1094 "ATOM 148 CG PRO A 19 24.299 20.134 6.704 1.00 0.00 C \n", 1095 "ATOM 149 CD PRO A 19 25.714 20.108 6.073 1.00 0.00 C \n", 1096 "ATOM 150 N SER A 20 27.361 17.959 8.559 1.00 0.00 N \n", 1097 "ATOM 151 CA SER A 20 28.054 16.835 9.210 1.00 0.00 C \n", 1098 "ATOM 152 C SER A 20 29.258 17.318 9.984 1.00 0.00 C \n", 1099 "ATOM 153 O SER A 20 29.930 16.477 10.606 1.00 0.00 O \n", 1100 "ATOM 154 CB SER A 20 28.523 15.820 8.182 1.00 0.00 C \n", 1101 "ATOM 155 OG SER A 20 28.946 16.445 6.967 1.00 0.00 O \n", 1102 "ATOM 156 N ASP A 21 29.599 18.599 9.828 1.00 0.00 N \n", 1103 "ATOM 157 CA ASP A 21 30.796 19.083 10.566 1.00 0.00 C \n", 1104 "ATOM 158 C ASP A 21 30.491 19.162 12.040 1.00 0.00 C \n", 1105 "ATOM 159 O ASP A 21 29.367 19.523 12.441 1.00 0.00 O \n", 1106 "ATOM 160 CB ASP A 21 31.155 20.515 10.048 1.00 0.00 C \n", 1107 "ATOM 161 CG ASP A 21 31.923 20.436 8.755 1.00 0.00 C \n", 1108 "ATOM 162 OD1 ASP A 21 32.493 19.374 8.456 1.00 0.00 O \n", 1109 "ATOM 163 OD2 ASP A 21 31.838 21.402 7.968 1.00 0.00 O \n", 1110 "ATOM 164 N THR A 22 31.510 18.936 12.852 1.00 0.00 N \n", 1111 "ATOM 165 CA THR A 22 31.398 19.064 14.286 1.00 0.00 C \n", 1112 "ATOM 166 C THR A 22 31.593 20.553 14.655 1.00 0.00 C \n", 1113 "ATOM 167 O THR A 22 32.159 21.311 13.861 1.00 0.00 O \n", 1114 "ATOM 168 CB THR A 22 32.492 18.193 14.995 1.00 0.00 C \n", 1115 "ATOM 169 OG1 THR A 22 33.778 18.739 14.516 1.00 0.00 O \n", 1116 "ATOM 170 CG2 THR A 22 32.352 16.700 14.630 1.00 0.00 C \n", 1117 "ATOM 171 N ILE A 23 31.113 20.863 15.860 1.00 0.00 N \n", 1118 "ATOM 172 CA ILE A 23 31.288 22.201 16.417 1.00 0.00 C \n", 1119 "ATOM 173 C ILE A 23 32.776 22.519 16.577 1.00 0.00 C \n", 1120 "ATOM 174 O ILE A 23 33.233 23.659 16.384 1.00 0.00 O \n", 1121 "ATOM 175 CB ILE A 23 30.520 22.300 17.764 1.00 0.00 C \n", 1122 "ATOM 176 CG1 ILE A 23 29.006 22.043 17.442 1.00 0.00 C \n", 1123 "ATOM 177 CG2 ILE A 23 30.832 23.699 18.358 1.00 0.00 C \n", 1124 "ATOM 178 CD1 ILE A 23 28.407 22.948 16.366 1.00 0.00 C \n", 1125 "ATOM 179 N GLU A 24 33.548 21.526 16.950 1.00 0.00 N \n", 1126 "ATOM 180 CA GLU A 24 35.031 21.722 17.069 1.00 0.00 C \n", 1127 "ATOM 181 C GLU A 24 35.615 22.190 15.759 1.00 0.00 C \n", 1128 "ATOM 182 O GLU A 24 36.532 23.046 15.724 1.00 0.00 O \n", 1129 "ATOM 183 CB GLU A 24 35.667 20.383 17.447 1.00 0.00 C \n", 1130 "ATOM 184 CG GLU A 24 37.128 20.293 17.872 1.00 0.00 C \n", 1131 "ATOM 185 CD GLU A 24 37.561 18.851 18.082 1.00 0.00 C \n", 1132 "ATOM 186 OE1 GLU A 24 37.758 18.024 17.195 1.00 0.00 O \n", 1133 "ATOM 187 OE2 GLU A 24 37.628 18.599 19.313 1.00 0.00 O \n", 1134 "ATOM 188 N ASN A 25 35.139 21.624 14.662 1.00 0.00 N \n", 1135 "ATOM 189 CA ASN A 25 35.590 21.945 13.302 1.00 0.00 C \n", 1136 "ATOM 190 C ASN A 25 35.238 23.382 12.920 1.00 0.00 C \n", 1137 "ATOM 191 O ASN A 25 36.066 24.109 12.333 1.00 0.00 O \n", 1138 "ATOM 192 CB ASN A 25 35.064 20.957 12.255 1.00 0.00 C \n", 1139 "ATOM 193 CG ASN A 25 35.541 21.418 10.871 1.00 0.00 C \n", 1140 "ATOM 194 OD1 ASN A 25 36.772 21.623 10.676 1.00 0.00 O \n", 1141 "ATOM 195 ND2 ASN A 25 34.628 21.595 9.920 1.00 0.00 N \n", 1142 "ATOM 196 N VAL A 26 34.007 23.745 13.250 1.00 0.00 N \n", 1143 "ATOM 197 CA VAL A 26 33.533 25.097 12.978 1.00 0.00 C \n", 1144 "ATOM 198 C VAL A 26 34.441 26.099 13.684 1.00 0.00 C \n", 1145 "ATOM 199 O VAL A 26 34.883 27.090 13.093 1.00 0.00 O \n", 1146 "ATOM 200 CB VAL A 26 32.060 25.257 13.364 1.00 0.00 C \n", 1147 "ATOM 201 CG1 VAL A 26 31.684 26.749 13.342 1.00 0.00 C \n", 1148 "ATOM 202 CG2 VAL A 26 31.152 24.421 12.477 1.00 0.00 C \n", 1149 "ATOM 203 N LYS A 27 34.734 25.822 14.949 1.00 0.00 N \n", 1150 "ATOM 204 CA LYS A 27 35.596 26.715 15.736 1.00 0.00 C \n", 1151 "ATOM 205 C LYS A 27 36.975 26.826 15.107 1.00 0.00 C \n", 1152 "ATOM 206 O LYS A 27 37.579 27.926 15.159 1.00 0.00 O \n", 1153 "ATOM 207 CB LYS A 27 35.715 26.203 17.172 1.00 0.00 C \n", 1154 "ATOM 208 CG LYS A 27 34.343 26.445 17.898 1.00 0.00 C \n", 1155 "ATOM 209 CD LYS A 27 34.509 26.077 19.360 1.00 0.00 C \n", 1156 "ATOM 210 CE LYS A 27 33.206 26.311 20.122 1.00 0.00 C \n", 1157 "ATOM 211 NZ LYS A 27 33.455 25.910 21.546 1.00 0.00 N \n", 1158 "ATOM 212 N ALA A 28 37.499 25.743 14.571 1.00 0.00 N \n", 1159 "ATOM 213 CA ALA A 28 38.794 25.761 13.880 1.00 0.00 C \n", 1160 "ATOM 214 C ALA A 28 38.728 26.591 12.611 1.00 0.00 C \n", 1161 "ATOM 215 O ALA A 28 39.704 27.346 12.277 1.00 0.00 O \n", 1162 "ATOM 216 CB ALA A 28 39.285 24.336 13.566 1.00 0.00 C \n", 1163 "ATOM 217 N LYS A 29 37.633 26.543 11.867 1.00 0.00 N \n", 1164 "ATOM 218 CA LYS A 29 37.471 27.391 10.668 1.00 0.00 C \n", 1165 "ATOM 219 C LYS A 29 37.441 28.882 11.052 1.00 0.00 C \n", 1166 "ATOM 220 O LYS A 29 38.020 29.772 10.382 1.00 0.00 O \n", 1167 "ATOM 221 CB LYS A 29 36.193 27.058 9.911 1.00 0.00 C \n", 1168 "ATOM 222 CG LYS A 29 36.153 25.620 9.409 1.00 0.00 C \n", 1169 "ATOM 223 CD LYS A 29 34.758 25.280 8.900 1.00 0.00 C \n", 1170 "ATOM 224 CE LYS A 29 34.793 24.264 7.767 1.00 0.00 C \n", 1171 "ATOM 225 NZ LYS A 29 34.914 24.944 6.441 1.00 0.00 N \n", 1172 "ATOM 226 N ILE A 30 36.811 29.170 12.192 1.00 0.00 N \n", 1173 "ATOM 227 CA ILE A 30 36.731 30.570 12.645 1.00 0.00 C \n", 1174 "ATOM 228 C ILE A 30 38.148 30.981 13.069 1.00 0.00 C \n", 1175 "ATOM 229 O ILE A 30 38.544 32.150 12.856 1.00 0.00 O \n", 1176 "ATOM 230 CB ILE A 30 35.708 30.776 13.806 1.00 0.00 C \n", 1177 "ATOM 231 CG1 ILE A 30 34.228 30.630 13.319 1.00 0.00 C \n", 1178 "ATOM 232 CG2 ILE A 30 35.874 32.138 14.512 1.00 0.00 C \n", 1179 "ATOM 233 CD1 ILE A 30 33.284 30.504 14.552 1.00 0.00 C \n", 1180 "ATOM 234 N GLN A 31 38.883 30.110 13.713 1.00 0.00 N \n", 1181 "ATOM 235 CA GLN A 31 40.269 30.508 14.115 1.00 0.00 C \n", 1182 "ATOM 236 C GLN A 31 41.092 30.808 12.851 1.00 0.00 C \n", 1183 "ATOM 237 O GLN A 31 41.828 31.808 12.681 1.00 0.00 O \n", 1184 "ATOM 238 CB GLN A 31 40.996 29.399 14.865 1.00 0.00 C \n", 1185 "ATOM 239 CG GLN A 31 42.445 29.848 15.182 1.00 0.00 C \n", 1186 "ATOM 240 CD GLN A 31 43.090 28.828 16.095 1.00 0.00 C \n", 1187 "ATOM 241 OE1 GLN A 31 42.770 27.655 15.906 1.00 0.00 O \n", 1188 "ATOM 242 NE2 GLN A 31 43.898 29.252 17.050 1.00 0.00 N \n", 1189 "ATOM 243 N ASP A 32 41.001 29.878 11.931 1.00 0.00 N \n", 1190 "ATOM 244 CA ASP A 32 41.718 30.022 10.643 1.00 0.00 C \n", 1191 "ATOM 245 C ASP A 32 41.399 31.338 9.967 1.00 0.00 C \n", 1192 "ATOM 246 O ASP A 32 42.260 32.036 9.381 1.00 0.00 O \n", 1193 "ATOM 247 CB ASP A 32 41.398 28.780 9.810 1.00 0.00 C \n", 1194 "ATOM 248 CG ASP A 32 42.626 28.557 8.928 1.00 0.00 C \n", 1195 "ATOM 249 OD1 ASP A 32 43.666 28.262 9.539 1.00 0.00 O \n", 1196 "ATOM 250 OD2 ASP A 32 42.430 28.812 7.728 1.00 0.00 O \n", 1197 "ATOM 251 N LYS A 33 40.117 31.750 9.988 1.00 0.00 N \n", 1198 "ATOM 252 CA LYS A 33 39.808 32.994 9.233 1.00 0.00 C \n", 1199 "ATOM 253 C LYS A 33 39.837 34.271 9.995 1.00 0.00 C \n", 1200 "ATOM 254 O LYS A 33 40.164 35.323 9.345 1.00 0.00 O \n", 1201 "ATOM 255 CB LYS A 33 38.615 32.801 8.320 1.00 0.00 C \n", 1202 "ATOM 256 CG LYS A 33 37.220 32.822 8.827 1.00 0.00 C \n", 1203 "ATOM 257 CD LYS A 33 36.351 33.613 7.838 1.00 0.00 C \n", 1204 "ATOM 258 CE LYS A 33 36.322 32.944 6.477 1.00 0.00 C \n", 1205 "ATOM 259 NZ LYS A 33 35.768 33.945 5.489 1.00 0.00 N \n", 1206 "ATOM 260 N GLU A 34 39.655 34.335 11.285 1.00 0.00 N \n", 1207 "ATOM 261 CA GLU A 34 39.676 35.547 12.072 1.00 0.00 C \n", 1208 "ATOM 262 C GLU A 34 40.675 35.527 13.200 1.00 0.00 C \n", 1209 "ATOM 263 O GLU A 34 40.814 36.528 13.911 1.00 0.00 O \n", 1210 "ATOM 264 CB GLU A 34 38.290 35.814 12.698 1.00 0.00 C \n", 1211 "ATOM 265 CG GLU A 34 37.156 35.985 11.688 1.00 0.00 C \n", 1212 "ATOM 266 CD GLU A 34 37.192 37.361 11.033 1.00 0.00 C \n", 1213 "ATOM 267 OE1 GLU A 34 37.519 38.360 11.645 1.00 0.00 O \n", 1214 "ATOM 268 OE2 GLU A 34 36.861 37.320 9.822 1.00 0.00 O \n", 1215 "TER 269 GLU A 34 \n", 1216 "MASTER 0 0 0 0 0 0 0 0 268 1 0 0 \n", 1217 "END \n" 1218 ] 1219 1220 # Check the data. 1221 for i in range(len(real_data)): 1222 self.assertEqual(real_data[i], lines[i])
1223 1224
1225 - def test_read_xyz_internal1(self):
1226 """Load the 'Indol_test.xyz' XYZ file (using the internal structural object XYZ reader).""" 1227 1228 # Path of the files. 1229 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1230 1231 # Read the XYZ file. 1232 self.interpreter.structure.read_xyz(file='Indol_test.xyz', dir=path) 1233 1234 # Test the molecule name. 1235 self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name, 'Indol_test_mol1') 1236 1237 # Load a single atom and test it. 1238 self.interpreter.structure.load_spins('#Indol_test_mol1@3') 1239 self.assertEqual(count_spins(), 1) 1240 1241 # Try loading a few protons. 1242 self.interpreter.structure.load_spins('@*H*') 1243 1244 # And now all the rest of the atoms. 1245 self.interpreter.structure.load_spins()
1246 1247
1248 - def test_read_xyz_internal2(self):
1249 """Load the 'SSS-cluster4-new-test.xyz' XYZ file (using the internal structural object XYZ reader).""" 1250 1251 # Path of the files. 1252 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1253 1254 # Read the XYZ file. 1255 self.interpreter.structure.read_xyz(file='SSS-cluster4-new-test.xyz', dir=path, read_model=[1]) 1256 1257 # Test the molecule name. 1258 self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name, 'SSS-cluster4-new-test_mol1') 1259 1260 # Load a single atom and test it. 1261 self.interpreter.structure.load_spins('#SSS-cluster4-new-test_mol1@2') 1262 self.assertEqual(count_spins(), 1) 1263 1264 # Test the spin coordinates. 1265 a=return_spin('#SSS-cluster4-new-test_mol1@2') 1266 self.assertAlmostEqual(a.pos[0], -12.398) 1267 self.assertAlmostEqual(a.pos[1], -15.992) 1268 self.assertAlmostEqual(a.pos[2], 11.448) 1269 1270 # Try loading a few protons. 1271 #self.interpreter.structure.load_spins('@H') 1272 1273 # And now all the rest of the atoms. 1274 self.interpreter.structure.load_spins() 1275 1276 # Extract a vector between first two spins. 1277 self.interpreter.dipole_pair.define(spin_id1='@2', spin_id2='@10') 1278 self.interpreter.dipole_pair.unit_vectors() 1279 self.assertAlmostEqual(cdp.interatomic[0].vector[0], -0.4102707) 1280 self.assertAlmostEqual(cdp.interatomic[0].vector[1], 0.62128879) 1281 self.assertAlmostEqual(cdp.interatomic[0].vector[2], -0.6675913)
1282 1283
1284 - def test_read_xyz_strychnine(self):
1285 """Load the 'strychnine.xyz' XYZ file (using the internal structural object XYZ reader).""" 1286 1287 # Path of the files. 1288 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1289 1290 # Read the XYZ file. 1291 self.interpreter.structure.read_xyz(file='strychnine.xyz', dir=path, set_mol_name='strychnine') 1292 1293 # Test the molecule data. 1294 self.assertEqual(len(cdp.structure.structural_data), 1) 1295 self.assertEqual(len(cdp.structure.structural_data[0].mol), 1) 1296 1297 # Load the carbon atoms and test it. 1298 self.interpreter.structure.load_spins('@C') 1299 self.assertEqual(count_spins(), 21) 1300 1301 # Load the protons. 1302 self.interpreter.structure.load_spins('@H') 1303 self.assertEqual(count_spins(), 43) 1304 1305 # And now all the rest of the atoms. 1306 self.interpreter.structure.load_spins()
1307 1308
1309 - def test_rmsd(self):
1310 """Test the structure.rmsd user function.""" 1311 1312 # Set up 3 models. 1313 self.interpreter.structure.add_model(model_num=1) 1314 self.interpreter.structure.add_model(model_num=2) 1315 self.interpreter.structure.add_model(model_num=4) 1316 1317 # Check that the models were correctly created. 1318 self.assert_(hasattr(cdp, 'structure')) 1319 self.assert_(hasattr(cdp.structure, 'structural_data')) 1320 self.assertEqual(len(cdp.structure.structural_data), 3) 1321 1322 # Create a structure with some atoms. 1323 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') 1324 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') 1325 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') 1326 1327 # Check the internal atomic info. 1328 self.assertEqual(cdp.structure.structural_data[0].mol[0].x, [1., 1., 1.]) 1329 self.assertEqual(cdp.structure.structural_data[0].mol[0].y, [0., 2., 20.]) 1330 self.assertEqual(cdp.structure.structural_data[0].mol[0].z, [-1., -1., -1.]) 1331 self.assertEqual(cdp.structure.structural_data[1].mol[0].x, [0., 0., 0.]) 1332 self.assertEqual(cdp.structure.structural_data[1].mol[0].y, [0., 2., 20.]) 1333 self.assertEqual(cdp.structure.structural_data[1].mol[0].z, [0., 0., 0.]) 1334 self.assertEqual(cdp.structure.structural_data[2].mol[0].x, [-1., -1., -1.]) 1335 self.assertEqual(cdp.structure.structural_data[2].mol[0].y, [0., 2., 20.]) 1336 self.assertEqual(cdp.structure.structural_data[2].mol[0].z, [1., 1., 1.]) 1337 1338 # Calculate the RMSD. 1339 self.interpreter.structure.rmsd() 1340 1341 # Checks. 1342 self.assert_(hasattr(cdp.structure, 'rmsd')) 1343 self.assertAlmostEqual(cdp.structure.rmsd, 2./3*sqrt(2))
1344 1345
1346 - def test_rmsd_ubi(self):
1347 """Test the structure.rmsd user function on the truncated ubiquitin ensemble.""" 1348 1349 # Load the structure. 1350 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1351 self.interpreter.structure.read_pdb('trunc_ubi_pcs.pdb', dir=path) 1352 1353 # Calculate the RMSD. 1354 self.interpreter.structure.rmsd() 1355 1356 # Checks (the values match the VMD 1.9.1 RMSD numbers). 1357 self.assert_(hasattr(cdp.structure, 'rmsd')) 1358 self.assertAlmostEqual(cdp.structure.rmsd, 0.77282758781333061)
1359 1360
1362 """Test of the structure.superimpose user function, fitting to the first structure.""" 1363 1364 # Path of the structure file. 1365 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order' 1366 1367 # Load the two rotated structures. 1368 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=1, set_mol_name='CaM') 1369 self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, set_model_num=2, set_mol_name='CaM') 1370 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=3, set_mol_name='CaM') 1371 1372 # Superimpose the backbone heavy atoms. 1373 self.interpreter.structure.superimpose(method='fit to first', atom_id='@N,C,CA,O') 1374 1375 # Check that the two structures now have the same atomic coordinates. 1376 model1 = cdp.structure.structural_data[0].mol[0] 1377 model2 = cdp.structure.structural_data[1].mol[0] 1378 model3 = cdp.structure.structural_data[2].mol[0] 1379 for i in range(len(model1.atom_name)): 1380 # Check model 2. 1381 self.assertAlmostEqual(model1.x[i], model2.x[i], 2) 1382 self.assertAlmostEqual(model1.y[i], model2.y[i], 2) 1383 self.assertAlmostEqual(model1.z[i], model2.z[i], 2) 1384 1385 # Check model 3. 1386 self.assertAlmostEqual(model1.x[i], model3.x[i], 2) 1387 self.assertAlmostEqual(model1.y[i], model3.y[i], 2) 1388 self.assertAlmostEqual(model1.z[i], model3.z[i], 2)
1389 1390
1392 """Test of the structure.superimpose user function, fitting to the mean structure.""" 1393 1394 # Path of the structure file. 1395 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order' 1396 1397 # Load the two rotated structures. 1398 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=1, set_mol_name='CaM') 1399 self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, set_model_num=2, set_mol_name='CaM') 1400 1401 # Superimpose the backbone heavy atoms. 1402 self.interpreter.structure.superimpose(method='fit to mean', atom_id='@N,C,CA,O') 1403 1404 # Check that the two structures now have the same atomic coordinates. 1405 model1 = cdp.structure.structural_data[0].mol[0] 1406 model2 = cdp.structure.structural_data[1].mol[0] 1407 for i in range(len(model1.atom_name)): 1408 self.assertAlmostEqual(model1.x[i], model2.x[i], 2) 1409 self.assertAlmostEqual(model1.y[i], model2.y[i], 2) 1410 self.assertAlmostEqual(model1.z[i], model2.z[i], 2)
1411 1412
1414 """Second test of the structure.superimpose user function, fitting to the mean structure.""" 1415 1416 # Path of the structure file. 1417 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order' 1418 1419 # Load the two rotated structures. 1420 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=1, set_mol_name='CaM') 1421 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=2, set_mol_name='CaM') 1422 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=3, set_mol_name='CaM') 1423 1424 # Transpose model 3. 1425 self.interpreter.structure.translate([20.0, 0.0, 0.0], model=3) 1426 1427 # Superimpose the backbone heavy atoms. 1428 self.interpreter.structure.superimpose(models=[2, 3], method='fit to mean', atom_id='@N,C,CA,O') 1429 1430 # Check that the two structures now have the same atomic coordinates as the original, but shifted 10 Angstrom in x. 1431 model1 = cdp.structure.structural_data[0].mol[0] 1432 model2 = cdp.structure.structural_data[1].mol[0] 1433 model3 = cdp.structure.structural_data[2].mol[0] 1434 for i in range(len(model1.atom_name)): 1435 # Check model 2. 1436 self.assertAlmostEqual(model1.x[i] + 10, model2.x[i], 2) 1437 self.assertAlmostEqual(model1.y[i], model2.y[i], 2) 1438 self.assertAlmostEqual(model1.z[i], model2.z[i], 2) 1439 1440 # Check model 3. 1441 self.assertAlmostEqual(model2.x[i], model3.x[i], 2) 1442 self.assertAlmostEqual(model2.y[i], model3.y[i], 2) 1443 self.assertAlmostEqual(model2.z[i], model3.z[i], 2)
1444 1445
1446 - def test_web_of_motion_12(self):
1447 """Check the operation of the structure.web_of_motion user function using structural models 1 and 2 (of 3).""" 1448 1449 # Load the file. 1450 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1451 self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path) 1452 1453 # Run the structure.web_of_motion user function and collect the results in a dummy file object. 1454 file = DummyFileObject() 1455 self.interpreter.structure.web_of_motion(file=file, models=[1, 2]) 1456 1457 # The result. 1458 result = [ 1459 "REMARK 4 THIS FILE COMPLIES WITH FORMAT V. 3.30, JUL-2011. ", 1460 "REMARK 40 CREATED BY RELAX (HTTP://NMR-RELAX.COM). ", 1461 "ATOM 1 N LEU 4 9.464 -9.232 27.573 1.00 0.00 N ", 1462 "ATOM 2 N LEU 4 9.211 -9.425 26.970 1.00 0.00 N ", 1463 "ATOM 3 H LEU 4 8.575 -8.953 27.963 1.00 0.00 H ", 1464 "ATOM 4 H LEU 4 9.085 -9.743 27.919 1.00 0.00 H ", 1465 "ATOM 5 CA LEU 4 10.302 -8.195 26.930 1.00 0.00 C ", 1466 "ATOM 6 CA LEU 4 10.077 -8.221 26.720 1.00 0.00 C ", 1467 "ATOM 7 CB LEU 4 9.494 -7.221 26.051 1.00 0.00 C ", 1468 "ATOM 8 CB LEU 4 9.297 -7.096 26.024 1.00 0.00 C ", 1469 "ATOM 9 CG LEU 4 10.107 -5.862 25.665 1.00 0.00 C ", 1470 "ATOM 10 CG LEU 4 10.061 -5.803 25.679 1.00 0.00 C ", 1471 "ATOM 11 CD1 LEU 4 11.182 -6.007 24.608 1.00 0.00 C ", 1472 "ATOM 12 CD1 LEU 4 11.029 -6.002 24.507 1.00 0.00 C ", 1473 "ATOM 13 CD2 LEU 4 9.036 -4.875 25.171 1.00 0.00 C ", 1474 "ATOM 14 CD2 LEU 4 9.120 -4.618 25.384 1.00 0.00 C ", 1475 "ATOM 15 C LEU 4 10.999 -7.436 28.046 1.00 0.00 C ", 1476 "ATOM 16 C LEU 4 10.625 -7.721 28.047 1.00 0.00 C ", 1477 "TER 17 LEU 4 ", 1478 "CONECT 1 2 ", 1479 "CONECT 2 1 ", 1480 "CONECT 3 4 ", 1481 "CONECT 4 3 ", 1482 "CONECT 5 6 ", 1483 "CONECT 6 5 ", 1484 "CONECT 7 8 ", 1485 "CONECT 8 7 ", 1486 "CONECT 9 10 ", 1487 "CONECT 10 9 ", 1488 "CONECT 11 12 ", 1489 "CONECT 12 11 ", 1490 "CONECT 13 14 ", 1491 "CONECT 14 13 ", 1492 "CONECT 15 16 ", 1493 "CONECT 16 15 ", 1494 "MASTER 0 0 0 0 0 0 0 0 16 1 16 0 ", 1495 "END " 1496 ] 1497 1498 # Check the created PDB file. 1499 lines = file.readlines() 1500 for i in range(len(lines)): 1501 self.assertEqual(result[i]+'\n', lines[i])
1502 1503
1504 - def test_web_of_motion_13(self):
1505 """Check the operation of the structure.web_of_motion user function using structural models 1 and 3 (of 3).""" 1506 1507 # Load the file. 1508 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1509 self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path) 1510 1511 # Run the structure.web_of_motion user function and collect the results in a dummy file object. 1512 file = DummyFileObject() 1513 self.interpreter.structure.web_of_motion(file=file, models=[1, 3]) 1514 1515 # The result. 1516 result = [ 1517 "REMARK 4 THIS FILE COMPLIES WITH FORMAT V. 3.30, JUL-2011. ", 1518 "REMARK 40 CREATED BY RELAX (HTTP://NMR-RELAX.COM). ", 1519 "ATOM 1 N LEU 4 9.464 -9.232 27.573 1.00 0.00 N ", 1520 "ATOM 2 N LEU 4 7.761 -6.392 27.161 1.00 0.00 N ", 1521 "ATOM 3 H LEU 4 8.575 -8.953 27.963 1.00 0.00 H ", 1522 "ATOM 4 H LEU 4 7.278 -6.195 28.026 1.00 0.00 H ", 1523 "ATOM 5 CA LEU 4 10.302 -8.195 26.930 1.00 0.00 C ", 1524 "ATOM 6 CA LEU 4 9.256 -6.332 27.183 1.00 0.00 C ", 1525 "ATOM 7 CB LEU 4 9.494 -7.221 26.051 1.00 0.00 C ", 1526 "ATOM 8 CB LEU 4 9.799 -5.331 26.144 1.00 0.00 C ", 1527 "ATOM 9 CG LEU 4 10.107 -5.862 25.665 1.00 0.00 C ", 1528 "ATOM 10 CG LEU 4 10.293 -5.882 24.803 1.00 0.00 C ", 1529 "ATOM 11 CD1 LEU 4 11.182 -6.007 24.608 1.00 0.00 C ", 1530 "ATOM 12 CD1 LEU 4 9.404 -6.984 24.274 1.00 0.00 C ", 1531 "ATOM 13 CD2 LEU 4 9.036 -4.875 25.171 1.00 0.00 C ", 1532 "ATOM 14 CD2 LEU 4 10.355 -4.772 23.792 1.00 0.00 C ", 1533 "ATOM 15 C LEU 4 10.999 -7.436 28.046 1.00 0.00 C ", 1534 "ATOM 16 C LEU 4 9.816 -6.033 28.572 1.00 0.00 C ", 1535 "TER 17 LEU 4 ", 1536 "CONECT 1 2 ", 1537 "CONECT 2 1 ", 1538 "CONECT 3 4 ", 1539 "CONECT 4 3 ", 1540 "CONECT 5 6 ", 1541 "CONECT 6 5 ", 1542 "CONECT 7 8 ", 1543 "CONECT 8 7 ", 1544 "CONECT 9 10 ", 1545 "CONECT 10 9 ", 1546 "CONECT 11 12 ", 1547 "CONECT 12 11 ", 1548 "CONECT 13 14 ", 1549 "CONECT 14 13 ", 1550 "CONECT 15 16 ", 1551 "CONECT 16 15 ", 1552 "MASTER 0 0 0 0 0 0 0 0 16 1 16 0 ", 1553 "END " 1554 ] 1555 1556 # Check the created PDB file. 1557 lines = file.readlines() 1558 for i in range(len(lines)): 1559 self.assertEqual(result[i]+'\n', lines[i])
1560 1561
1562 - def test_web_of_motion_all(self):
1563 """Check the operation of the structure.web_of_motion user function using all structural models.""" 1564 1565 # Load the file. 1566 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' 1567 self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path) 1568 1569 # Run the structure.web_of_motion user function and collect the results in a dummy file object. 1570 file = DummyFileObject() 1571 self.interpreter.structure.web_of_motion(file=file) 1572 1573 # The result. 1574 result = [ 1575 "REMARK 4 THIS FILE COMPLIES WITH FORMAT V. 3.30, JUL-2011. ", 1576 "REMARK 40 CREATED BY RELAX (HTTP://NMR-RELAX.COM). ", 1577 "ATOM 1 N LEU 4 9.464 -9.232 27.573 1.00 0.00 N ", 1578 "ATOM 2 N LEU 4 9.211 -9.425 26.970 1.00 0.00 N ", 1579 "ATOM 3 N LEU 4 7.761 -6.392 27.161 1.00 0.00 N ", 1580 "ATOM 4 H LEU 4 8.575 -8.953 27.963 1.00 0.00 H ", 1581 "ATOM 5 H LEU 4 9.085 -9.743 27.919 1.00 0.00 H ", 1582 "ATOM 6 H LEU 4 7.278 -6.195 28.026 1.00 0.00 H ", 1583 "ATOM 7 CA LEU 4 10.302 -8.195 26.930 1.00 0.00 C ", 1584 "ATOM 8 CA LEU 4 10.077 -8.221 26.720 1.00 0.00 C ", 1585 "ATOM 9 CA LEU 4 9.256 -6.332 27.183 1.00 0.00 C ", 1586 "ATOM 10 CB LEU 4 9.494 -7.221 26.051 1.00 0.00 C ", 1587 "ATOM 11 CB LEU 4 9.297 -7.096 26.024 1.00 0.00 C ", 1588 "ATOM 12 CB LEU 4 9.799 -5.331 26.144 1.00 0.00 C ", 1589 "ATOM 13 CG LEU 4 10.107 -5.862 25.665 1.00 0.00 C ", 1590 "ATOM 14 CG LEU 4 10.061 -5.803 25.679 1.00 0.00 C ", 1591 "ATOM 15 CG LEU 4 10.293 -5.882 24.803 1.00 0.00 C ", 1592 "ATOM 16 CD1 LEU 4 11.182 -6.007 24.608 1.00 0.00 C ", 1593 "ATOM 17 CD1 LEU 4 11.029 -6.002 24.507 1.00 0.00 C ", 1594 "ATOM 18 CD1 LEU 4 9.404 -6.984 24.274 1.00 0.00 C ", 1595 "ATOM 19 CD2 LEU 4 9.036 -4.875 25.171 1.00 0.00 C ", 1596 "ATOM 20 CD2 LEU 4 9.120 -4.618 25.384 1.00 0.00 C ", 1597 "ATOM 21 CD2 LEU 4 10.355 -4.772 23.792 1.00 0.00 C ", 1598 "ATOM 22 C LEU 4 10.999 -7.436 28.046 1.00 0.00 C ", 1599 "ATOM 23 C LEU 4 10.625 -7.721 28.047 1.00 0.00 C ", 1600 "ATOM 24 C LEU 4 9.816 -6.033 28.572 1.00 0.00 C ", 1601 "TER 25 LEU 4 ", 1602 "CONECT 1 2 3 ", 1603 "CONECT 2 1 3 ", 1604 "CONECT 3 1 2 ", 1605 "CONECT 4 5 6 ", 1606 "CONECT 5 4 6 ", 1607 "CONECT 6 4 5 ", 1608 "CONECT 7 8 9 ", 1609 "CONECT 8 7 9 ", 1610 "CONECT 9 7 8 ", 1611 "CONECT 10 11 12 ", 1612 "CONECT 11 10 12 ", 1613 "CONECT 12 10 11 ", 1614 "CONECT 13 14 15 ", 1615 "CONECT 14 13 15 ", 1616 "CONECT 15 13 14 ", 1617 "CONECT 16 17 18 ", 1618 "CONECT 17 16 18 ", 1619 "CONECT 18 16 17 ", 1620 "CONECT 19 20 21 ", 1621 "CONECT 20 19 21 ", 1622 "CONECT 21 19 20 ", 1623 "CONECT 22 23 24 ", 1624 "CONECT 23 22 24 ", 1625 "CONECT 24 22 23 ", 1626 "MASTER 0 0 0 0 0 0 0 0 24 1 24 0 ", 1627 "END " 1628 ] 1629 1630 # Check the created PDB file. 1631 lines = file.readlines() 1632 for i in range(len(lines)): 1633 self.assertEqual(result[i]+'\n', lines[i])
1634