1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from math import sqrt
24 from numpy import float64, zeros
25 from os import sep
26 from tempfile import mktemp
27
28
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
39 """Class for testing the structural objects."""
40
46
47
49 """Test that a RelaxError occurs when the alternate location indicator is present but not specified."""
50
51
52 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
53
54
55 self.assertRaises(RelaxError, self.interpreter.structure.read_pdb, '1OGT_trunc.pdb', dir=path)
56
57
59 """Test the bug reported as the U{support request #2998<https://web.archive.org/web/https://gna.org/support/?2998>}, the broken CONECT records."""
60
61
62 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
63
64
65 self.interpreter.structure.read_pdb('1RTE_trunc.pdb', dir=path)
66
67
78
79
96
97
99 """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.
100
101 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.
102 """
103
104
105 self.interpreter.structure.add_model(model_num=1)
106 self.interpreter.structure.add_model(model_num=2)
107
108
109 self.interpreter.structure.add_atom(atom_name='N', res_name='Pro', res_num=2, pos=[1., 2., 3.], element='N')
110
111
112 file = DummyFileObject()
113 self.interpreter.structure.write_pdb(file=file, force=True)
114
115
116 contents = [
117 "REMARK 4 THIS FILE COMPLIES WITH FORMAT V. 3.30, JUL-2011. \n",
118 "REMARK 40 CREATED BY RELAX (HTTP://WWW.NMR-RELAX.COM). \n",
119 "MODEL 1 \n",
120 "ATOM 1 N Pro A 2 1.000 2.000 3.000 1.00 0.00 N \n",
121 "TER 2 Pro A 2 \n",
122 "ENDMDL \n",
123 "MODEL 2 \n",
124 "ATOM 1 N Pro A 2 1.000 2.000 3.000 1.00 0.00 N \n",
125 "TER 2 Pro A 2 \n",
126 "ENDMDL \n",
127 "MASTER 0 0 0 0 0 0 0 0 1 1 0 0 \n",
128 "END \n"
129 ]
130
131
132 lines = file.readlines()
133 for i in range(len(lines)):
134 self.assertEqual(contents[i], lines[i])
135
136
142
143
145 """Test the deletion of structural data in only one pipe."""
146
147
148 self.interpreter.structure.add_atom(atom_name='PIV', res_name='M1', res_num=1, pos=[0., 1., 2.], element='S')
149
150
151 self.interpreter.pipe.create('new', 'N-state')
152
153
154 self.interpreter.structure.add_atom(atom_name='PIV', res_name='M1', res_num=2, pos=[4., 5., 6.], element='S')
155
156
157 self.interpreter.structure.delete()
158
159
160 self.assert_(hasattr(cdp, 'structure'))
161 self.assertEqual(len(cdp.structure.structural_data), 0)
162 self.interpreter.pipe.switch('mf')
163 self.assert_(hasattr(cdp, 'structure'))
164 self.assertEqual(len(cdp.structure.structural_data), 1)
165
166
168 """Test of the structure.displacement user function."""
169
170
171 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
172
173
174 self.interpreter.structure.read_pdb('Ap4Aase_res1-12.pdb', dir=path, set_model_num=1)
175 self.interpreter.structure.read_pdb('Ap4Aase_res1-12.pdb', dir=path, set_model_num=2)
176
177
178 R = zeros((3, 3), float64)
179 euler_to_R_zyz(1.3, 0.4, 4.5, R)
180
181
182 self.interpreter.structure.rotate(R, model=2)
183
184
185 self.interpreter.structure.displacement()
186
187
188 self.interpreter.structure.read_pdb('Ap4Aase_res1-12.pdb', dir=path, set_model_num=3)
189 self.interpreter.structure.rotate(R, model=3)
190
191
192 models = [1, 2]
193 trans_vect = [
194 [[0.0, 0.0, 0.0],
195 [ 2.270857972754659, -1.811667138656451, 1.878400649688508]],
196 [[ -2.270857972754659, 1.811667138656451, -1.878400649688508],
197 [0.0, 0.0, 0.0]]
198 ]
199 dist = [
200 [0.0000000000000000, 3.4593818457148173],
201 [3.4593818457148173, 0.0000000000000000]
202 ]
203 rot_axis = [
204 [None,
205 [ 0.646165066909452, 0.018875759848125, -0.762964227206007]],
206 [[ -0.646165066909452, -0.018875759848125, 0.762964227206007],
207 None]
208 ]
209 angle = [
210 [0.0000000000000000, 0.6247677290742989],
211 [0.6247677290742989, 0.0000000000000000]
212 ]
213
214
215 self.assert_(hasattr(cdp.structure, 'displacements'))
216 for i in range(len(models)):
217 for j in range(len(models)):
218
219 self.assertAlmostEqual(cdp.structure.displacements._translation_distance[models[i]][models[j]], dist[i][j])
220 for k in range(3):
221 self.assertAlmostEqual(cdp.structure.displacements._translation_vector[models[i]][models[j]][k], trans_vect[i][j][k])
222
223
224 self.assertAlmostEqual(cdp.structure.displacements._rotation_angle[models[i]][models[j]], angle[i][j])
225 if rot_axis[i][j] != None:
226 for k in range(3):
227 self.assertAlmostEqual(cdp.structure.displacements._rotation_axis[models[i]][models[j]][k], rot_axis[i][j][k])
228
229
230 self.tmpfile = mktemp()
231 self.interpreter.state.save(self.tmpfile, dir=None, force=True)
232
233
234 self.interpreter.reset()
235
236
237 self.interpreter.state.load(self.tmpfile)
238
239
240 self.assert_(hasattr(cdp.structure, 'displacements'))
241 for i in range(len(models)):
242 for j in range(len(models)):
243
244 self.assertAlmostEqual(cdp.structure.displacements._translation_distance[models[i]][models[j]], dist[i][j])
245 for k in range(3):
246 self.assertAlmostEqual(cdp.structure.displacements._translation_vector[models[i]][models[j]][k], trans_vect[i][j][k])
247
248
249 self.assertAlmostEqual(cdp.structure.displacements._rotation_angle[models[i]][models[j]], angle[i][j])
250 if rot_axis[i][j] != None:
251 for k in range(3):
252 self.assertAlmostEqual(cdp.structure.displacements._rotation_axis[models[i]][models[j]][k], rot_axis[i][j][k])
253
254
256 """Test the loading of spins from different molecules into one molecule container."""
257
258
259 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose'
260
261
262 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, set_mol_name='L1')
263 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=path, set_mol_name='L2')
264
265
266 self.interpreter.structure.load_spins('#L1:900@C1', mol_name_target='Lactose')
267 self.interpreter.structure.load_spins('#L2:900@C2', mol_name_target='Lactose')
268
269
270 self.assertEqual(len(cdp.mol), 1)
271 self.assertEqual(cdp.mol[0].name, 'Lactose')
272 self.assertEqual(len(cdp.mol[0].res), 1)
273 self.assertEqual(cdp.mol[0].res[0].name, 'UNK')
274 self.assertEqual(cdp.mol[0].res[0].num, 900)
275 self.assertEqual(len(cdp.mol[0].res[0].spin), 2)
276 self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'C1')
277 self.assertEqual(cdp.mol[0].res[0].spin[0].num, 1)
278 self.assertEqual(cdp.mol[0].res[0].spin[1].name, 'C2')
279 self.assertEqual(cdp.mol[0].res[0].spin[1].num, 2)
280
281
283 """Load the PDB file using the information in a results file (using the internal structural object)."""
284
285
286 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
287
288
289 self.interpreter.results.read(file='str_internal', dir=path)
290
291
292 self.assert_(hasattr(cdp, 'structure'))
293 self.assert_(hasattr(cdp.structure, 'structural_data'))
294 self.assert_(len(cdp.structure.structural_data))
295 self.assert_(len(cdp.structure.structural_data[0].mol))
296
297 mol = cdp.structure.structural_data[0].mol[0]
298 self.assertEqual(mol.file_name, 'Ap4Aase_res1-12.pdb')
299 self.assertEqual(mol.file_path, '')
300 self.assertEqual(mol.file_model, 1)
301 self.assertEqual(mol.file_mol_num, 1)
302
303
304 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']
305 bonded = [[]]*174
306 chain_id = [None]*174
307 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']
308 pdb_record = ['ATOM']*174
309 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']
310 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]
311 seg_id = [None]*174
312 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]
313 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]
314 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]
315
316
317 mol = cdp.structure.structural_data[0].mol[0]
318 for i in range(len(mol.atom_name)):
319 self.assertEqual(mol.atom_name[i], atom_name[i])
320 self.assertEqual(mol.bonded[i], bonded[i])
321 self.assertEqual(mol.chain_id[i], chain_id[i])
322 self.assertEqual(mol.element[i], element[i])
323 self.assertEqual(mol.pdb_record[i], pdb_record[i])
324 self.assertEqual(mol.res_name[i], res_name[i])
325 self.assertEqual(mol.res_num[i], res_num[i])
326 self.assertEqual(mol.seg_id[i], seg_id[i])
327 self.assertEqual(mol.x[i], x[i])
328 self.assertEqual(mol.y[i], y[i])
329 self.assertEqual(mol.z[i], z[i])
330
331
333 """Load the PDB file using the information in a results file (using the internal structural object)."""
334
335
336 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
337
338
339 self.interpreter.results.read(file=path+sep+'str_internal')
340
341
382
383
385 """Load the structure from the 'strychnine_opt_cdcl3_b3lyp_gaussian.log.bz2' compressed Gaussian log file."""
386
387
388 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
389
390
391 self.interpreter.structure.read_gaussian(file='strychnine_opt_cdcl3_b3lyp_gaussian.log.bz2', dir=path, set_mol_name='strychnine')
392
393
394 self.assertEqual(len(cdp.structure.structural_data), 1)
395 self.assertEqual(len(cdp.structure.structural_data[0].mol), 1)
396
397
398 self.interpreter.structure.load_spins('@C')
399 self.assertEqual(count_spins(), 21)
400
401
402 self.interpreter.structure.load_spins('@H')
403 self.assertEqual(count_spins(), 43)
404
405
406 self.interpreter.structure.load_spins()
407
408
409 data = [
410 [ 5, 'C', -0.258837, -2.073956, -0.558021],
411 [ 6, 'C', -0.824223, -1.406962, -1.808433],
412 [ 7, 'C', -1.741283, -0.250780, -1.378644],
413 [ 8, 'C', -0.819735, 0.828965, -0.783392],
414 [ 9, 'C', 0.003153, 0.334416, 0.415455],
415 [10, 'C', 2.358372, 0.448322, 0.162421],
416 [11, 'C', 3.667689, 0.888405, -0.010558],
417 [12, 'C', 4.632616, -0.056196, -0.360560],
418 [13, 'C', 4.303015, -1.398582, -0.525823],
419 [14, 'C', 2.988069, -1.825141, -0.331972],
420 [15, 'C', 2.015427, -0.899636, 0.012625],
421 [16, 'C', 0.561728, -1.122705, 0.360284],
422 [17, 'C', 0.390886, -1.834862, 1.723978],
423 [18, 'C', -1.067936, -2.282629, 1.709808],
424 [19, 'C', -2.708975, -2.252045, -0.131301],
425 [20, 'C', -2.815469, -0.775379, -0.431910],
426 [21, 'C', -3.718174, 0.023460, 0.134879],
427 [22, 'C', -3.726395, 1.516213, -0.058936],
428 [23, 'C', -1.423939, 2.193179, -0.407936],
429 [24, 'C', -0.372897, 3.059448, 0.332496],
430 [25, 'C', 1.064718, 2.558120, 0.325331],
431 [26, 'H', 0.399932, -2.896344, -0.855386],
432 [27, 'H', -1.364146, -2.140645, -2.409934],
433 [28, 'H', -0.007016, -1.035292, -2.430851],
434 [29, 'H', -2.229948, 0.177326, -2.261725],
435 [30, 'H', -0.101863, 1.055799, -1.581061],
436 [31, 'H', -0.582210, 0.470722, 1.326014],
437 [32, 'H', 3.918694, 1.929549, 0.116264],
438 [33, 'H', 5.656588, 0.267474, -0.505165],
439 [34, 'H', 5.068478, -2.115052, -0.797816],
440 [35, 'H', 2.736463, -2.873299, -0.445917],
441 [36, 'H', 1.059165, -2.698455, 1.760657],
442 [37, 'H', 0.631843, -1.189746, 2.570301],
443 [38, 'H', -1.243126, -3.142405, 2.361743],
444 [39, 'H', -1.719677, -1.470258, 2.058429],
445 [40, 'H', -3.410692, -2.541912, 0.651788],
446 [41, 'H', -2.971493, -2.840572, -1.016009],
447 [42, 'H', -4.455619, -0.395106, 0.813636],
448 [43, 'H', -3.834304, 1.785629, -1.118252],
449 [44, 'H', -4.559845, 1.966160, 0.480526],
450 [45, 'H', -1.736135, 2.699031, -1.329897],
451 [46, 'H', -0.354638, 4.078330, -0.048526],
452 [47, 'H', -0.690723, 3.116119, 1.378208],
453 [ 1, 'O', -2.547545, 2.139059, 0.472310],
454 [ 2, 'O', 2.015408, 3.324289, 0.213156],
455 [ 3, 'N', 1.207610, 1.203922, 0.478894],
456 [ 4, 'N', -1.350394, -2.624460, 0.301178]
457 ]
458
459
460 i = 0
461 for spin in spin_loop():
462 self.assertEqual(spin.num, data[i][0])
463 self.assertEqual(spin.name, data[i][1])
464 self.assertEqual(spin.element, data[i][1])
465 self.assertEqual(spin.pos[0], data[i][2])
466 self.assertEqual(spin.pos[1], data[i][3])
467 self.assertEqual(spin.pos[2], data[i][4])
468
469
470 i += 1
471
472
474 """Test the merging of two molecules into one."""
475
476
477 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
478
479
480 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-6.pdb', dir=path, set_mol_name='Ap4Aase', set_model_num=1)
481 self.interpreter.structure.read_pdb(file='Ap4Aase_res7-12.pdb', dir=path, set_mol_name='Ap4Aase', set_model_num=1, merge=True)
482 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=path, set_mol_name='Ap4Aase', set_model_num=2)
483
484
485 cdp.structure.validate_models()
486
487
489 """Test the reading of a file by structure.read_pdb that is not a PDB."""
490
491
492 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'saved_states'
493
494
495 self.interpreter.structure.read_pdb(file='basic_single_pipe.bz2', dir=path)
496
497
525
526
541
542
560
561
576
577
592
593
609
610
626
627
629 """Load a few 'lactose_MCMM4_S1_*.pdb' PDB files as models (using the internal structural object PDB reader)."""
630
631
632 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose'
633
634
635 files = ['lactose_MCMM4_S1_1.pdb',
636 'lactose_MCMM4_S1_2.pdb',
637 'lactose_MCMM4_S1_3.pdb']
638
639
640 self.interpreter.structure.read_pdb(file=files[0], dir=path, set_model_num=1)
641 self.interpreter.structure.read_pdb(file=files[1], dir=path, set_model_num=1)
642 self.interpreter.structure.read_pdb(file=files[2], dir=path, set_model_num=1)
643
644
645 self.interpreter.structure.load_spins('@*H*')
646
647
648 self.interpreter.structure.load_spins()
649
650
651 self.assert_(hasattr(cdp, 'structure'))
652 self.assert_(hasattr(cdp.structure, 'structural_data'))
653 self.assertEqual(len(cdp.structure.structural_data), 1)
654 self.assertEqual(len(cdp.structure.structural_data[0].mol), 3)
655
656 i = 0
657 for mol in cdp.structure.structural_data[0].mol:
658 self.assertEqual(mol.file_name, files[i])
659 self.assertEqual(mol.file_path, path)
660 self.assertEqual(mol.file_model, 1)
661 self.assertEqual(mol.file_mol_num, 1)
662 i = i + 1
663
664
666 """Load the 2 models of the 'gromacs.pdb' PDB file as separate molecules of the same model (using the internal structural object PDB reader)."""
667
668
669 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'phthalic_acid'
670
671
672 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, read_model=1, set_model_num=1)
673 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path, read_model=2, set_model_num=1)
674
675
676 self.interpreter.structure.load_spins('@*H*')
677
678
679 self.interpreter.structure.load_spins()
680
681
682 self.assert_(hasattr(cdp, 'structure'))
683 self.assert_(hasattr(cdp.structure, 'structural_data'))
684 self.assertEqual(len(cdp.structure.structural_data), 1)
685 self.assertEqual(len(cdp.structure.structural_data[0].mol), 2)
686
687 i = 0
688 for mol in cdp.structure.structural_data[0].mol:
689 self.assertEqual(mol.file_name, 'gromacs.pdb')
690 self.assertEqual(mol.file_path, path)
691 self.assertEqual(mol.file_model, i+1)
692 self.assertEqual(mol.file_mol_num, 1)
693 i = i + 1
694
695
697 """Test the packing of models and molecules using 'gromacs.pdb' and 'lactose_MCMM4_S1_*.pdb' (using the internal structural object PDB reader)."""
698
699
700 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
701
702
703 self.interpreter.structure.read_pdb(file='gromacs.pdb', dir=path+sep+'phthalic_acid')
704 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')
705 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')
706 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')
707 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')
708
709
710 self.interpreter.structure.load_spins('@*H*')
711
712
713 self.interpreter.structure.load_spins()
714
715
716 self.assert_(hasattr(cdp, 'structure'))
717 self.assert_(hasattr(cdp.structure, 'structural_data'))
718 self.assertEqual(len(cdp.structure.structural_data), 2)
719 self.assertEqual(len(cdp.structure.structural_data[0].mol), 3)
720 self.assertEqual(len(cdp.structure.structural_data[1].mol), 3)
721
722 files = [['gromacs.pdb', 'lactose_MCMM4_S1_1.pdb', 'lactose_MCMM4_S1_3.pdb'],
723 ['gromacs.pdb', 'lactose_MCMM4_S1_2.pdb', 'lactose_MCMM4_S1_4.pdb']]
724 paths = [[path+sep+'phthalic_acid', path+sep+'lactose', path+sep+'lactose'],
725 [path+sep+'phthalic_acid', path+sep+'lactose', path+sep+'lactose']]
726 models = [[1, 1, 1], [2, 1, 1]]
727
728 for i in range(len(cdp.structure.structural_data)):
729 for j in range(len(cdp.structure.structural_data[i].mol)):
730 mol = cdp.structure.structural_data[i].mol[j]
731 self.assertEqual(mol.file_name, files[i][j])
732 self.assertEqual(mol.file_path, paths[i][j])
733 self.assertEqual(mol.file_model, models[i][j])
734 self.assertEqual(mol.file_mol_num, 1)
735
736
738 """Test the reading of the complete 1UBQ PDB file."""
739
740
741 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
742 self.interpreter.structure.read_pdb('1UBQ.pdb', dir=path)
743
744
745 self.assert_(hasattr(cdp, 'structure'))
746 self.assert_(hasattr(cdp.structure, 'structural_data'))
747 self.assertEqual(len(cdp.structure.structural_data), 1)
748 self.assertEqual(len(cdp.structure.structural_data[0].mol), 1)
749
750
751 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_num[0], 1)
752 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_name[0], 'N')
753 self.assertEqual(cdp.structure.structural_data[0].mol[0].chain_id[0], 'A')
754 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_name[0], 'MET')
755 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_num[0], 1)
756 self.assertEqual(cdp.structure.structural_data[0].mol[0].x[0], 27.340)
757 self.assertEqual(cdp.structure.structural_data[0].mol[0].y[0], 24.430)
758 self.assertEqual(cdp.structure.structural_data[0].mol[0].z[0], 2.614)
759 self.assertEqual(cdp.structure.structural_data[0].mol[0].element[0], 'N')
760
761
762 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_num[-1], 661)
763 self.assertEqual(cdp.structure.structural_data[0].mol[0].atom_name[-1], 'O')
764 self.assertEqual(cdp.structure.structural_data[0].mol[0].chain_id[-1], None)
765 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_name[-1], 'HOH')
766 self.assertEqual(cdp.structure.structural_data[0].mol[0].res_num[-1], 58)
767 self.assertEqual(cdp.structure.structural_data[0].mol[0].x[-1], 37.667)
768 self.assertEqual(cdp.structure.structural_data[0].mol[0].y[-1], 43.421)
769 self.assertEqual(cdp.structure.structural_data[0].mol[0].z[-1], 17.000)
770 self.assertEqual(cdp.structure.structural_data[0].mol[0].element[-1], 'O')
771
772
774 """Test the reading and writing of the 1UBQ PDB file."""
775
776
777 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
778 self.interpreter.structure.read_pdb('1UBQ.pdb', dir=path)
779
780
781 self.interpreter.structure.delete(":35-76")
782
783
784 self.interpreter.structure.delete(":HOH")
785
786
787 self.tmpfile = mktemp() + '.pdb'
788 self.interpreter.structure.write_pdb(self.tmpfile)
789
790
791 file = open(self.tmpfile)
792 lines = file.readlines()
793 file.close()
794
795
796 real_data = [
797 "REMARK 4 THIS FILE COMPLIES WITH FORMAT V. 3.30, JUL-2011. \n",
798 "REMARK 40 CREATED BY RELAX (HTTP://WWW.NMR-RELAX.COM). \n",
799 "HELIX 1 H1 ILE A 23 GLU A 34 1 12 \n",
800 "SHEET 1 BET 5 GLY A 10 VAL A 17 0 \n",
801 "SHEET 2 BET 5 MET A 1 THR A 7 -1 \n",
802 "ATOM 1 N MET A 1 27.340 24.430 2.614 1.00 0.00 N \n",
803 "ATOM 2 CA MET A 1 26.266 25.413 2.842 1.00 0.00 C \n",
804 "ATOM 3 C MET A 1 26.913 26.639 3.531 1.00 0.00 C \n",
805 "ATOM 4 O MET A 1 27.886 26.463 4.263 1.00 0.00 O \n",
806 "ATOM 5 CB MET A 1 25.112 24.880 3.649 1.00 0.00 C \n",
807 "ATOM 6 CG MET A 1 25.353 24.860 5.134 1.00 0.00 C \n",
808 "ATOM 7 SD MET A 1 23.930 23.959 5.904 1.00 0.00 S \n",
809 "ATOM 8 CE MET A 1 24.447 23.984 7.620 1.00 0.00 C \n",
810 "ATOM 9 N GLN A 2 26.335 27.770 3.258 1.00 0.00 N \n",
811 "ATOM 10 CA GLN A 2 26.850 29.021 3.898 1.00 0.00 C \n",
812 "ATOM 11 C GLN A 2 26.100 29.253 5.202 1.00 0.00 C \n",
813 "ATOM 12 O GLN A 2 24.865 29.024 5.330 1.00 0.00 O \n",
814 "ATOM 13 CB GLN A 2 26.733 30.148 2.905 1.00 0.00 C \n",
815 "ATOM 14 CG GLN A 2 26.882 31.546 3.409 1.00 0.00 C \n",
816 "ATOM 15 CD GLN A 2 26.786 32.562 2.270 1.00 0.00 C \n",
817 "ATOM 16 OE1 GLN A 2 27.783 33.160 1.870 1.00 0.00 O \n",
818 "ATOM 17 NE2 GLN A 2 25.562 32.733 1.806 1.00 0.00 N \n",
819 "ATOM 18 N ILE A 3 26.849 29.656 6.217 1.00 0.00 N \n",
820 "ATOM 19 CA ILE A 3 26.235 30.058 7.497 1.00 0.00 C \n",
821 "ATOM 20 C ILE A 3 26.882 31.428 7.862 1.00 0.00 C \n",
822 "ATOM 21 O ILE A 3 27.906 31.711 7.264 1.00 0.00 O \n",
823 "ATOM 22 CB ILE A 3 26.344 29.050 8.645 1.00 0.00 C \n",
824 "ATOM 23 CG1 ILE A 3 27.810 28.748 8.999 1.00 0.00 C \n",
825 "ATOM 24 CG2 ILE A 3 25.491 27.771 8.287 1.00 0.00 C \n",
826 "ATOM 25 CD1 ILE A 3 27.967 28.087 10.417 1.00 0.00 C \n",
827 "ATOM 26 N PHE A 4 26.214 32.097 8.771 1.00 0.00 N \n",
828 "ATOM 27 CA PHE A 4 26.772 33.436 9.197 1.00 0.00 C \n",
829 "ATOM 28 C PHE A 4 27.151 33.362 10.650 1.00 0.00 C \n",
830 "ATOM 29 O PHE A 4 26.350 32.778 11.395 1.00 0.00 O \n",
831 "ATOM 30 CB PHE A 4 25.695 34.498 8.946 1.00 0.00 C \n",
832 "ATOM 31 CG PHE A 4 25.288 34.609 7.499 1.00 0.00 C \n",
833 "ATOM 32 CD1 PHE A 4 24.147 33.966 7.038 1.00 0.00 C \n",
834 "ATOM 33 CD2 PHE A 4 26.136 35.346 6.640 1.00 0.00 C \n",
835 "ATOM 34 CE1 PHE A 4 23.812 34.031 5.677 1.00 0.00 C \n",
836 "ATOM 35 CE2 PHE A 4 25.810 35.392 5.267 1.00 0.00 C \n",
837 "ATOM 36 CZ PHE A 4 24.620 34.778 4.853 1.00 0.00 C \n",
838 "ATOM 37 N VAL A 5 28.260 33.943 11.096 1.00 0.00 N \n",
839 "ATOM 38 CA VAL A 5 28.605 33.965 12.503 1.00 0.00 C \n",
840 "ATOM 39 C VAL A 5 28.638 35.461 12.900 1.00 0.00 C \n",
841 "ATOM 40 O VAL A 5 29.522 36.103 12.320 1.00 0.00 O \n",
842 "ATOM 41 CB VAL A 5 29.963 33.317 12.814 1.00 0.00 C \n",
843 "ATOM 42 CG1 VAL A 5 30.211 33.394 14.304 1.00 0.00 C \n",
844 "ATOM 43 CG2 VAL A 5 29.957 31.838 12.352 1.00 0.00 C \n",
845 "ATOM 44 N LYS A 6 27.751 35.867 13.740 1.00 0.00 N \n",
846 "ATOM 45 CA LYS A 6 27.691 37.315 14.143 1.00 0.00 C \n",
847 "ATOM 46 C LYS A 6 28.469 37.475 15.420 1.00 0.00 C \n",
848 "ATOM 47 O LYS A 6 28.213 36.753 16.411 1.00 0.00 O \n",
849 "ATOM 48 CB LYS A 6 26.219 37.684 14.307 1.00 0.00 C \n",
850 "ATOM 49 CG LYS A 6 25.884 39.139 14.615 1.00 0.00 C \n",
851 "ATOM 50 CD LYS A 6 24.348 39.296 14.642 1.00 0.00 C \n",
852 "ATOM 51 CE LYS A 6 23.865 40.723 14.749 1.00 0.00 C \n",
853 "ATOM 52 NZ LYS A 6 22.375 40.720 14.907 1.00 0.00 N \n",
854 "ATOM 53 N THR A 7 29.426 38.430 15.446 1.00 0.00 N \n",
855 "ATOM 54 CA THR A 7 30.225 38.643 16.662 1.00 0.00 C \n",
856 "ATOM 55 C THR A 7 29.664 39.839 17.434 1.00 0.00 C \n",
857 "ATOM 56 O THR A 7 28.850 40.565 16.859 1.00 0.00 O \n",
858 "ATOM 57 CB THR A 7 31.744 38.879 16.299 1.00 0.00 C \n",
859 "ATOM 58 OG1 THR A 7 31.737 40.257 15.824 1.00 0.00 O \n",
860 "ATOM 59 CG2 THR A 7 32.260 37.969 15.171 1.00 0.00 C \n",
861 "ATOM 60 N LEU A 8 30.132 40.069 18.642 1.00 0.00 N \n",
862 "ATOM 61 CA LEU A 8 29.607 41.180 19.467 1.00 0.00 C \n",
863 "ATOM 62 C LEU A 8 30.075 42.538 18.984 1.00 0.00 C \n",
864 "ATOM 63 O LEU A 8 29.586 43.570 19.483 1.00 0.00 O \n",
865 "ATOM 64 CB LEU A 8 29.919 40.890 20.938 1.00 0.00 C \n",
866 "ATOM 65 CG LEU A 8 29.183 39.722 21.581 1.00 0.00 C \n",
867 "ATOM 66 CD1 LEU A 8 29.308 39.750 23.095 1.00 0.00 C \n",
868 "ATOM 67 CD2 LEU A 8 27.700 39.721 21.228 1.00 0.00 C \n",
869 "ATOM 68 N THR A 9 30.991 42.571 17.998 1.00 0.00 N \n",
870 "ATOM 69 CA THR A 9 31.422 43.940 17.553 1.00 0.00 C \n",
871 "ATOM 70 C THR A 9 30.755 44.351 16.277 1.00 0.00 C \n",
872 "ATOM 71 O THR A 9 31.207 45.268 15.566 1.00 0.00 O \n",
873 "ATOM 72 CB THR A 9 32.979 43.918 17.445 1.00 0.00 C \n",
874 "ATOM 73 OG1 THR A 9 33.174 43.067 16.265 1.00 0.00 O \n",
875 "ATOM 74 CG2 THR A 9 33.657 43.319 18.672 1.00 0.00 C \n",
876 "ATOM 75 N GLY A 10 29.721 43.673 15.885 1.00 0.00 N \n",
877 "ATOM 76 CA GLY A 10 28.978 43.960 14.678 1.00 0.00 C \n",
878 "ATOM 77 C GLY A 10 29.604 43.507 13.393 1.00 0.00 C \n",
879 "ATOM 78 O GLY A 10 29.219 43.981 12.301 1.00 0.00 O \n",
880 "ATOM 79 N LYS A 11 30.563 42.623 13.495 1.00 0.00 N \n",
881 "ATOM 80 CA LYS A 11 31.191 42.012 12.331 1.00 0.00 C \n",
882 "ATOM 81 C LYS A 11 30.459 40.666 12.130 1.00 0.00 C \n",
883 "ATOM 82 O LYS A 11 30.253 39.991 13.133 1.00 0.00 O \n",
884 "ATOM 83 CB LYS A 11 32.672 41.717 12.505 1.00 0.00 C \n",
885 "ATOM 84 CG LYS A 11 33.280 41.086 11.227 1.00 0.00 C \n",
886 "ATOM 85 CD LYS A 11 34.762 40.799 11.470 1.00 0.00 C \n",
887 "ATOM 86 CE LYS A 11 35.614 40.847 10.240 1.00 0.00 C \n",
888 "ATOM 87 NZ LYS A 11 35.100 40.073 9.101 1.00 0.00 N \n",
889 "ATOM 88 N THR A 12 30.163 40.338 10.886 1.00 0.00 N \n",
890 "ATOM 89 CA THR A 12 29.542 39.020 10.653 1.00 0.00 C \n",
891 "ATOM 90 C THR A 12 30.494 38.261 9.729 1.00 0.00 C \n",
892 "ATOM 91 O THR A 12 30.849 38.850 8.706 1.00 0.00 O \n",
893 "ATOM 92 CB THR A 12 28.113 39.049 10.015 1.00 0.00 C \n",
894 "ATOM 93 OG1 THR A 12 27.280 39.722 10.996 1.00 0.00 O \n",
895 "ATOM 94 CG2 THR A 12 27.588 37.635 9.715 1.00 0.00 C \n",
896 "ATOM 95 N ILE A 13 30.795 37.015 10.095 1.00 0.00 N \n",
897 "ATOM 96 CA ILE A 13 31.720 36.289 9.176 1.00 0.00 C \n",
898 "ATOM 97 C ILE A 13 30.955 35.211 8.459 1.00 0.00 C \n",
899 "ATOM 98 O ILE A 13 30.025 34.618 9.040 1.00 0.00 O \n",
900 "ATOM 99 CB ILE A 13 32.995 35.883 9.934 1.00 0.00 C \n",
901 "ATOM 100 CG1 ILE A 13 33.306 34.381 9.840 1.00 0.00 C \n",
902 "ATOM 101 CG2 ILE A 13 33.109 36.381 11.435 1.00 0.00 C \n",
903 "ATOM 102 CD1 ILE A 13 34.535 34.028 10.720 1.00 0.00 C \n",
904 "ATOM 103 N THR A 14 31.244 34.986 7.197 1.00 0.00 N \n",
905 "ATOM 104 CA THR A 14 30.505 33.884 6.512 1.00 0.00 C \n",
906 "ATOM 105 C THR A 14 31.409 32.680 6.446 1.00 0.00 C \n",
907 "ATOM 106 O THR A 14 32.619 32.812 6.125 1.00 0.00 O \n",
908 "ATOM 107 CB THR A 14 30.091 34.393 5.078 1.00 0.00 C \n",
909 "ATOM 108 OG1 THR A 14 31.440 34.513 4.487 1.00 0.00 O \n",
910 "ATOM 109 CG2 THR A 14 29.420 35.756 5.119 1.00 0.00 C \n",
911 "ATOM 110 N LEU A 15 30.884 31.485 6.666 1.00 0.00 N \n",
912 "ATOM 111 CA LEU A 15 31.677 30.275 6.639 1.00 0.00 C \n",
913 "ATOM 112 C LEU A 15 31.022 29.288 5.665 1.00 0.00 C \n",
914 "ATOM 113 O LEU A 15 29.809 29.395 5.545 1.00 0.00 O \n",
915 "ATOM 114 CB LEU A 15 31.562 29.686 8.045 1.00 0.00 C \n",
916 "ATOM 115 CG LEU A 15 32.631 29.444 9.060 1.00 0.00 C \n",
917 "ATOM 116 CD1 LEU A 15 33.814 30.390 9.030 1.00 0.00 C \n",
918 "ATOM 117 CD2 LEU A 15 31.945 29.449 10.436 1.00 0.00 C \n",
919 "ATOM 118 N GLU A 16 31.834 28.412 5.125 1.00 0.00 N \n",
920 "ATOM 119 CA GLU A 16 31.220 27.341 4.275 1.00 0.00 C \n",
921 "ATOM 120 C GLU A 16 31.440 26.079 5.080 1.00 0.00 C \n",
922 "ATOM 121 O GLU A 16 32.576 25.802 5.461 1.00 0.00 O \n",
923 "ATOM 122 CB GLU A 16 31.827 27.262 2.894 1.00 0.00 C \n",
924 "ATOM 123 CG GLU A 16 31.363 28.410 1.962 1.00 0.00 C \n",
925 "ATOM 124 CD GLU A 16 31.671 28.291 0.498 1.00 0.00 C \n",
926 "ATOM 125 OE1 GLU A 16 30.869 28.621 -0.366 1.00 0.00 O \n",
927 "ATOM 126 OE2 GLU A 16 32.835 27.861 0.278 1.00 0.00 O \n",
928 "ATOM 127 N VAL A 17 30.310 25.458 5.384 1.00 0.00 N \n",
929 "ATOM 128 CA VAL A 17 30.288 24.245 6.193 1.00 0.00 C \n",
930 "ATOM 129 C VAL A 17 29.279 23.227 5.641 1.00 0.00 C \n",
931 "ATOM 130 O VAL A 17 28.478 23.522 4.725 1.00 0.00 O \n",
932 "ATOM 131 CB VAL A 17 29.903 24.590 7.665 1.00 0.00 C \n",
933 "ATOM 132 CG1 VAL A 17 30.862 25.496 8.389 1.00 0.00 C \n",
934 "ATOM 133 CG2 VAL A 17 28.476 25.135 7.705 1.00 0.00 C \n",
935 "ATOM 134 N GLU A 18 29.380 22.057 6.232 1.00 0.00 N \n",
936 "ATOM 135 CA GLU A 18 28.468 20.940 5.980 1.00 0.00 C \n",
937 "ATOM 136 C GLU A 18 27.819 20.609 7.316 1.00 0.00 C \n",
938 "ATOM 137 O GLU A 18 28.449 20.674 8.360 1.00 0.00 O \n",
939 "ATOM 138 CB GLU A 18 29.213 19.697 5.506 1.00 0.00 C \n",
940 "ATOM 139 CG GLU A 18 29.728 19.755 4.060 1.00 0.00 C \n",
941 "ATOM 140 CD GLU A 18 28.754 20.061 2.978 1.00 0.00 C \n",
942 "ATOM 141 OE1 GLU A 18 27.546 19.992 2.985 1.00 0.00 O \n",
943 "ATOM 142 OE2 GLU A 18 29.336 20.423 1.904 1.00 0.00 O \n",
944 "ATOM 143 N PRO A 19 26.559 20.220 7.288 1.00 0.00 N \n",
945 "ATOM 144 CA PRO A 19 25.829 19.825 8.494 1.00 0.00 C \n",
946 "ATOM 145 C PRO A 19 26.541 18.732 9.251 1.00 0.00 C \n",
947 "ATOM 146 O PRO A 19 26.333 18.536 10.457 1.00 0.00 O \n",
948 "ATOM 147 CB PRO A 19 24.469 19.332 7.952 1.00 0.00 C \n",
949 "ATOM 148 CG PRO A 19 24.299 20.134 6.704 1.00 0.00 C \n",
950 "ATOM 149 CD PRO A 19 25.714 20.108 6.073 1.00 0.00 C \n",
951 "ATOM 150 N SER A 20 27.361 17.959 8.559 1.00 0.00 N \n",
952 "ATOM 151 CA SER A 20 28.054 16.835 9.210 1.00 0.00 C \n",
953 "ATOM 152 C SER A 20 29.258 17.318 9.984 1.00 0.00 C \n",
954 "ATOM 153 O SER A 20 29.930 16.477 10.606 1.00 0.00 O \n",
955 "ATOM 154 CB SER A 20 28.523 15.820 8.182 1.00 0.00 C \n",
956 "ATOM 155 OG SER A 20 28.946 16.445 6.967 1.00 0.00 O \n",
957 "ATOM 156 N ASP A 21 29.599 18.599 9.828 1.00 0.00 N \n",
958 "ATOM 157 CA ASP A 21 30.796 19.083 10.566 1.00 0.00 C \n",
959 "ATOM 158 C ASP A 21 30.491 19.162 12.040 1.00 0.00 C \n",
960 "ATOM 159 O ASP A 21 29.367 19.523 12.441 1.00 0.00 O \n",
961 "ATOM 160 CB ASP A 21 31.155 20.515 10.048 1.00 0.00 C \n",
962 "ATOM 161 CG ASP A 21 31.923 20.436 8.755 1.00 0.00 C \n",
963 "ATOM 162 OD1 ASP A 21 32.493 19.374 8.456 1.00 0.00 O \n",
964 "ATOM 163 OD2 ASP A 21 31.838 21.402 7.968 1.00 0.00 O \n",
965 "ATOM 164 N THR A 22 31.510 18.936 12.852 1.00 0.00 N \n",
966 "ATOM 165 CA THR A 22 31.398 19.064 14.286 1.00 0.00 C \n",
967 "ATOM 166 C THR A 22 31.593 20.553 14.655 1.00 0.00 C \n",
968 "ATOM 167 O THR A 22 32.159 21.311 13.861 1.00 0.00 O \n",
969 "ATOM 168 CB THR A 22 32.492 18.193 14.995 1.00 0.00 C \n",
970 "ATOM 169 OG1 THR A 22 33.778 18.739 14.516 1.00 0.00 O \n",
971 "ATOM 170 CG2 THR A 22 32.352 16.700 14.630 1.00 0.00 C \n",
972 "ATOM 171 N ILE A 23 31.113 20.863 15.860 1.00 0.00 N \n",
973 "ATOM 172 CA ILE A 23 31.288 22.201 16.417 1.00 0.00 C \n",
974 "ATOM 173 C ILE A 23 32.776 22.519 16.577 1.00 0.00 C \n",
975 "ATOM 174 O ILE A 23 33.233 23.659 16.384 1.00 0.00 O \n",
976 "ATOM 175 CB ILE A 23 30.520 22.300 17.764 1.00 0.00 C \n",
977 "ATOM 176 CG1 ILE A 23 29.006 22.043 17.442 1.00 0.00 C \n",
978 "ATOM 177 CG2 ILE A 23 30.832 23.699 18.358 1.00 0.00 C \n",
979 "ATOM 178 CD1 ILE A 23 28.407 22.948 16.366 1.00 0.00 C \n",
980 "ATOM 179 N GLU A 24 33.548 21.526 16.950 1.00 0.00 N \n",
981 "ATOM 180 CA GLU A 24 35.031 21.722 17.069 1.00 0.00 C \n",
982 "ATOM 181 C GLU A 24 35.615 22.190 15.759 1.00 0.00 C \n",
983 "ATOM 182 O GLU A 24 36.532 23.046 15.724 1.00 0.00 O \n",
984 "ATOM 183 CB GLU A 24 35.667 20.383 17.447 1.00 0.00 C \n",
985 "ATOM 184 CG GLU A 24 37.128 20.293 17.872 1.00 0.00 C \n",
986 "ATOM 185 CD GLU A 24 37.561 18.851 18.082 1.00 0.00 C \n",
987 "ATOM 186 OE1 GLU A 24 37.758 18.024 17.195 1.00 0.00 O \n",
988 "ATOM 187 OE2 GLU A 24 37.628 18.599 19.313 1.00 0.00 O \n",
989 "ATOM 188 N ASN A 25 35.139 21.624 14.662 1.00 0.00 N \n",
990 "ATOM 189 CA ASN A 25 35.590 21.945 13.302 1.00 0.00 C \n",
991 "ATOM 190 C ASN A 25 35.238 23.382 12.920 1.00 0.00 C \n",
992 "ATOM 191 O ASN A 25 36.066 24.109 12.333 1.00 0.00 O \n",
993 "ATOM 192 CB ASN A 25 35.064 20.957 12.255 1.00 0.00 C \n",
994 "ATOM 193 CG ASN A 25 35.541 21.418 10.871 1.00 0.00 C \n",
995 "ATOM 194 OD1 ASN A 25 36.772 21.623 10.676 1.00 0.00 O \n",
996 "ATOM 195 ND2 ASN A 25 34.628 21.595 9.920 1.00 0.00 N \n",
997 "ATOM 196 N VAL A 26 34.007 23.745 13.250 1.00 0.00 N \n",
998 "ATOM 197 CA VAL A 26 33.533 25.097 12.978 1.00 0.00 C \n",
999 "ATOM 198 C VAL A 26 34.441 26.099 13.684 1.00 0.00 C \n",
1000 "ATOM 199 O VAL A 26 34.883 27.090 13.093 1.00 0.00 O \n",
1001 "ATOM 200 CB VAL A 26 32.060 25.257 13.364 1.00 0.00 C \n",
1002 "ATOM 201 CG1 VAL A 26 31.684 26.749 13.342 1.00 0.00 C \n",
1003 "ATOM 202 CG2 VAL A 26 31.152 24.421 12.477 1.00 0.00 C \n",
1004 "ATOM 203 N LYS A 27 34.734 25.822 14.949 1.00 0.00 N \n",
1005 "ATOM 204 CA LYS A 27 35.596 26.715 15.736 1.00 0.00 C \n",
1006 "ATOM 205 C LYS A 27 36.975 26.826 15.107 1.00 0.00 C \n",
1007 "ATOM 206 O LYS A 27 37.579 27.926 15.159 1.00 0.00 O \n",
1008 "ATOM 207 CB LYS A 27 35.715 26.203 17.172 1.00 0.00 C \n",
1009 "ATOM 208 CG LYS A 27 34.343 26.445 17.898 1.00 0.00 C \n",
1010 "ATOM 209 CD LYS A 27 34.509 26.077 19.360 1.00 0.00 C \n",
1011 "ATOM 210 CE LYS A 27 33.206 26.311 20.122 1.00 0.00 C \n",
1012 "ATOM 211 NZ LYS A 27 33.455 25.910 21.546 1.00 0.00 N \n",
1013 "ATOM 212 N ALA A 28 37.499 25.743 14.571 1.00 0.00 N \n",
1014 "ATOM 213 CA ALA A 28 38.794 25.761 13.880 1.00 0.00 C \n",
1015 "ATOM 214 C ALA A 28 38.728 26.591 12.611 1.00 0.00 C \n",
1016 "ATOM 215 O ALA A 28 39.704 27.346 12.277 1.00 0.00 O \n",
1017 "ATOM 216 CB ALA A 28 39.285 24.336 13.566 1.00 0.00 C \n",
1018 "ATOM 217 N LYS A 29 37.633 26.543 11.867 1.00 0.00 N \n",
1019 "ATOM 218 CA LYS A 29 37.471 27.391 10.668 1.00 0.00 C \n",
1020 "ATOM 219 C LYS A 29 37.441 28.882 11.052 1.00 0.00 C \n",
1021 "ATOM 220 O LYS A 29 38.020 29.772 10.382 1.00 0.00 O \n",
1022 "ATOM 221 CB LYS A 29 36.193 27.058 9.911 1.00 0.00 C \n",
1023 "ATOM 222 CG LYS A 29 36.153 25.620 9.409 1.00 0.00 C \n",
1024 "ATOM 223 CD LYS A 29 34.758 25.280 8.900 1.00 0.00 C \n",
1025 "ATOM 224 CE LYS A 29 34.793 24.264 7.767 1.00 0.00 C \n",
1026 "ATOM 225 NZ LYS A 29 34.914 24.944 6.441 1.00 0.00 N \n",
1027 "ATOM 226 N ILE A 30 36.811 29.170 12.192 1.00 0.00 N \n",
1028 "ATOM 227 CA ILE A 30 36.731 30.570 12.645 1.00 0.00 C \n",
1029 "ATOM 228 C ILE A 30 38.148 30.981 13.069 1.00 0.00 C \n",
1030 "ATOM 229 O ILE A 30 38.544 32.150 12.856 1.00 0.00 O \n",
1031 "ATOM 230 CB ILE A 30 35.708 30.776 13.806 1.00 0.00 C \n",
1032 "ATOM 231 CG1 ILE A 30 34.228 30.630 13.319 1.00 0.00 C \n",
1033 "ATOM 232 CG2 ILE A 30 35.874 32.138 14.512 1.00 0.00 C \n",
1034 "ATOM 233 CD1 ILE A 30 33.284 30.504 14.552 1.00 0.00 C \n",
1035 "ATOM 234 N GLN A 31 38.883 30.110 13.713 1.00 0.00 N \n",
1036 "ATOM 235 CA GLN A 31 40.269 30.508 14.115 1.00 0.00 C \n",
1037 "ATOM 236 C GLN A 31 41.092 30.808 12.851 1.00 0.00 C \n",
1038 "ATOM 237 O GLN A 31 41.828 31.808 12.681 1.00 0.00 O \n",
1039 "ATOM 238 CB GLN A 31 40.996 29.399 14.865 1.00 0.00 C \n",
1040 "ATOM 239 CG GLN A 31 42.445 29.848 15.182 1.00 0.00 C \n",
1041 "ATOM 240 CD GLN A 31 43.090 28.828 16.095 1.00 0.00 C \n",
1042 "ATOM 241 OE1 GLN A 31 42.770 27.655 15.906 1.00 0.00 O \n",
1043 "ATOM 242 NE2 GLN A 31 43.898 29.252 17.050 1.00 0.00 N \n",
1044 "ATOM 243 N ASP A 32 41.001 29.878 11.931 1.00 0.00 N \n",
1045 "ATOM 244 CA ASP A 32 41.718 30.022 10.643 1.00 0.00 C \n",
1046 "ATOM 245 C ASP A 32 41.399 31.338 9.967 1.00 0.00 C \n",
1047 "ATOM 246 O ASP A 32 42.260 32.036 9.381 1.00 0.00 O \n",
1048 "ATOM 247 CB ASP A 32 41.398 28.780 9.810 1.00 0.00 C \n",
1049 "ATOM 248 CG ASP A 32 42.626 28.557 8.928 1.00 0.00 C \n",
1050 "ATOM 249 OD1 ASP A 32 43.666 28.262 9.539 1.00 0.00 O \n",
1051 "ATOM 250 OD2 ASP A 32 42.430 28.812 7.728 1.00 0.00 O \n",
1052 "ATOM 251 N LYS A 33 40.117 31.750 9.988 1.00 0.00 N \n",
1053 "ATOM 252 CA LYS A 33 39.808 32.994 9.233 1.00 0.00 C \n",
1054 "ATOM 253 C LYS A 33 39.837 34.271 9.995 1.00 0.00 C \n",
1055 "ATOM 254 O LYS A 33 40.164 35.323 9.345 1.00 0.00 O \n",
1056 "ATOM 255 CB LYS A 33 38.615 32.801 8.320 1.00 0.00 C \n",
1057 "ATOM 256 CG LYS A 33 37.220 32.822 8.827 1.00 0.00 C \n",
1058 "ATOM 257 CD LYS A 33 36.351 33.613 7.838 1.00 0.00 C \n",
1059 "ATOM 258 CE LYS A 33 36.322 32.944 6.477 1.00 0.00 C \n",
1060 "ATOM 259 NZ LYS A 33 35.768 33.945 5.489 1.00 0.00 N \n",
1061 "ATOM 260 N GLU A 34 39.655 34.335 11.285 1.00 0.00 N \n",
1062 "ATOM 261 CA GLU A 34 39.676 35.547 12.072 1.00 0.00 C \n",
1063 "ATOM 262 C GLU A 34 40.675 35.527 13.200 1.00 0.00 C \n",
1064 "ATOM 263 O GLU A 34 40.814 36.528 13.911 1.00 0.00 O \n",
1065 "ATOM 264 CB GLU A 34 38.290 35.814 12.698 1.00 0.00 C \n",
1066 "ATOM 265 CG GLU A 34 37.156 35.985 11.688 1.00 0.00 C \n",
1067 "ATOM 266 CD GLU A 34 37.192 37.361 11.033 1.00 0.00 C \n",
1068 "ATOM 267 OE1 GLU A 34 37.519 38.360 11.645 1.00 0.00 O \n",
1069 "ATOM 268 OE2 GLU A 34 36.861 37.320 9.822 1.00 0.00 O \n",
1070 "TER 269 GLU A 34 \n",
1071 "MASTER 0 0 0 0 0 0 0 0 268 1 0 0 \n",
1072 "END \n"
1073 ]
1074
1075
1076 for i in range(len(real_data)):
1077 self.assertEqual(real_data[i], lines[i])
1078
1079
1101
1102
1104 """Load the 'SSS-cluster4-new-test.xyz' XYZ file (using the internal structural object XYZ reader)."""
1105
1106
1107 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
1108
1109
1110 self.interpreter.structure.read_xyz(file='SSS-cluster4-new-test.xyz', dir=path, read_model=[1])
1111
1112
1113 self.assertEqual(cdp.structure.structural_data[0].mol[0].mol_name, 'SSS-cluster4-new-test_mol1')
1114
1115
1116 self.interpreter.structure.load_spins('#SSS-cluster4-new-test_mol1@2')
1117 self.assertEqual(count_spins(), 1)
1118
1119
1120 a=return_spin('#SSS-cluster4-new-test_mol1@2')
1121 self.assertAlmostEqual(a.pos[0], -12.398)
1122 self.assertAlmostEqual(a.pos[1], -15.992)
1123 self.assertAlmostEqual(a.pos[2], 11.448)
1124
1125
1126
1127
1128
1129 self.interpreter.structure.load_spins()
1130
1131
1132 self.interpreter.interatom.define(spin_id1='@2', spin_id2='@10')
1133 self.interpreter.interatom.unit_vectors()
1134 self.assertAlmostEqual(cdp.interatomic[0].vector[0], -0.4102707)
1135 self.assertAlmostEqual(cdp.interatomic[0].vector[1], 0.62128879)
1136 self.assertAlmostEqual(cdp.interatomic[0].vector[2], -0.6675913)
1137
1138
1162
1163
1165 """Test the structure.rmsd user function."""
1166
1167
1168 self.interpreter.structure.add_model(model_num=1)
1169 self.interpreter.structure.add_model(model_num=2)
1170 self.interpreter.structure.add_model(model_num=4)
1171
1172
1173 self.assert_(hasattr(cdp, 'structure'))
1174 self.assert_(hasattr(cdp.structure, 'structural_data'))
1175 self.assertEqual(len(cdp.structure.structural_data), 3)
1176
1177
1178 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')
1179 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')
1180 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')
1181
1182
1183 self.assertEqual(cdp.structure.structural_data[0].mol[0].x, [1., 1., 1.])
1184 self.assertEqual(cdp.structure.structural_data[0].mol[0].y, [0., 2., 20.])
1185 self.assertEqual(cdp.structure.structural_data[0].mol[0].z, [-1., -1., -1.])
1186 self.assertEqual(cdp.structure.structural_data[1].mol[0].x, [0., 0., 0.])
1187 self.assertEqual(cdp.structure.structural_data[1].mol[0].y, [0., 2., 20.])
1188 self.assertEqual(cdp.structure.structural_data[1].mol[0].z, [0., 0., 0.])
1189 self.assertEqual(cdp.structure.structural_data[2].mol[0].x, [-1., -1., -1.])
1190 self.assertEqual(cdp.structure.structural_data[2].mol[0].y, [0., 2., 20.])
1191 self.assertEqual(cdp.structure.structural_data[2].mol[0].z, [1., 1., 1.])
1192
1193
1194 self.interpreter.structure.rmsd()
1195
1196
1197 self.assert_(hasattr(cdp.structure, 'rmsd'))
1198 self.assertAlmostEqual(cdp.structure.rmsd, 2./3*sqrt(2))
1199
1200
1202 """Test the structure.rmsd user function on the truncated ubiquitin ensemble."""
1203
1204
1205 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
1206 self.interpreter.structure.read_pdb('trunc_ubi_pcs.pdb', dir=path)
1207
1208
1209 self.interpreter.structure.rmsd()
1210
1211
1212 self.assert_(hasattr(cdp.structure, 'rmsd'))
1213 self.assertAlmostEqual(cdp.structure.rmsd, 0.77282758781333061)
1214
1215
1217 """Test of the structure.superimpose user function, fitting to the first structure."""
1218
1219
1220 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'
1221
1222
1223 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=1, set_mol_name='CaM')
1224 self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, set_model_num=2, set_mol_name='CaM')
1225 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=3, set_mol_name='CaM')
1226
1227
1228 self.interpreter.structure.superimpose(method='fit to first', atom_id='@N,C,CA,O')
1229
1230
1231 model1 = cdp.structure.structural_data[0].mol[0]
1232 model2 = cdp.structure.structural_data[1].mol[0]
1233 model3 = cdp.structure.structural_data[2].mol[0]
1234 for i in range(len(model1.atom_name)):
1235
1236 self.assertAlmostEqual(model1.x[i], model2.x[i], 2)
1237 self.assertAlmostEqual(model1.y[i], model2.y[i], 2)
1238 self.assertAlmostEqual(model1.z[i], model2.z[i], 2)
1239
1240
1241 self.assertAlmostEqual(model1.x[i], model3.x[i], 2)
1242 self.assertAlmostEqual(model1.y[i], model3.y[i], 2)
1243 self.assertAlmostEqual(model1.z[i], model3.z[i], 2)
1244
1245
1247 """Test of the structure.superimpose user function, fitting to the mean structure."""
1248
1249
1250 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'
1251
1252
1253 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=1, set_mol_name='CaM')
1254 self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, set_model_num=2, set_mol_name='CaM')
1255
1256
1257 self.interpreter.structure.superimpose(method='fit to mean', atom_id='@N,C,CA,O')
1258
1259
1260 model1 = cdp.structure.structural_data[0].mol[0]
1261 model2 = cdp.structure.structural_data[1].mol[0]
1262 for i in range(len(model1.atom_name)):
1263 self.assertAlmostEqual(model1.x[i], model2.x[i], 2)
1264 self.assertAlmostEqual(model1.y[i], model2.y[i], 2)
1265 self.assertAlmostEqual(model1.z[i], model2.z[i], 2)
1266
1267
1269 """Second test of the structure.superimpose user function, fitting to the mean structure."""
1270
1271
1272 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'
1273
1274
1275 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=1, set_mol_name='CaM')
1276 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=2, set_mol_name='CaM')
1277 self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, set_model_num=3, set_mol_name='CaM')
1278
1279
1280 self.interpreter.structure.translate([20.0, 0.0, 0.0], model=3)
1281
1282
1283 self.interpreter.structure.superimpose(models=[2, 3], method='fit to mean', atom_id='@N,C,CA,O')
1284
1285
1286 model1 = cdp.structure.structural_data[0].mol[0]
1287 model2 = cdp.structure.structural_data[1].mol[0]
1288 model3 = cdp.structure.structural_data[2].mol[0]
1289 for i in range(len(model1.atom_name)):
1290
1291 self.assertAlmostEqual(model1.x[i] + 10, model2.x[i], 2)
1292 self.assertAlmostEqual(model1.y[i], model2.y[i], 2)
1293 self.assertAlmostEqual(model1.z[i], model2.z[i], 2)
1294
1295
1296 self.assertAlmostEqual(model2.x[i], model3.x[i], 2)
1297 self.assertAlmostEqual(model2.y[i], model3.y[i], 2)
1298 self.assertAlmostEqual(model2.z[i], model3.z[i], 2)
1299
1300
1302 """Check the operation of the structure.web_of_motion user function using structural models 1 and 2 (of 3)."""
1303
1304
1305 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
1306 self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path)
1307
1308
1309 file = DummyFileObject()
1310 self.interpreter.structure.web_of_motion(file=file, models=[1, 2])
1311
1312
1313 result = [
1314 "REMARK 4 THIS FILE COMPLIES WITH FORMAT V. 3.30, JUL-2011. ",
1315 "REMARK 40 CREATED BY RELAX (HTTP://WWW.NMR-RELAX.COM). ",
1316 "ATOM 1 N LEU A 4 9.464 -9.232 27.573 1.00 0.00 N ",
1317 "ATOM 2 N LEU A 4 9.211 -9.425 26.970 1.00 0.00 N ",
1318 "ATOM 3 H LEU A 4 8.575 -8.953 27.963 1.00 0.00 H ",
1319 "ATOM 4 H LEU A 4 9.085 -9.743 27.919 1.00 0.00 H ",
1320 "ATOM 5 CA LEU A 4 10.302 -8.195 26.930 1.00 0.00 C ",
1321 "ATOM 6 CA LEU A 4 10.077 -8.221 26.720 1.00 0.00 C ",
1322 "ATOM 7 CB LEU A 4 9.494 -7.221 26.051 1.00 0.00 C ",
1323 "ATOM 8 CB LEU A 4 9.297 -7.096 26.024 1.00 0.00 C ",
1324 "ATOM 9 CG LEU A 4 10.107 -5.862 25.665 1.00 0.00 C ",
1325 "ATOM 10 CG LEU A 4 10.061 -5.803 25.679 1.00 0.00 C ",
1326 "ATOM 11 CD1 LEU A 4 11.182 -6.007 24.608 1.00 0.00 C ",
1327 "ATOM 12 CD1 LEU A 4 11.029 -6.002 24.507 1.00 0.00 C ",
1328 "ATOM 13 CD2 LEU A 4 9.036 -4.875 25.171 1.00 0.00 C ",
1329 "ATOM 14 CD2 LEU A 4 9.120 -4.618 25.384 1.00 0.00 C ",
1330 "ATOM 15 C LEU A 4 10.999 -7.436 28.046 1.00 0.00 C ",
1331 "ATOM 16 C LEU A 4 10.625 -7.721 28.047 1.00 0.00 C ",
1332 "TER 17 LEU A 4 ",
1333 "CONECT 1 2 ",
1334 "CONECT 2 1 ",
1335 "CONECT 3 4 ",
1336 "CONECT 4 3 ",
1337 "CONECT 5 6 ",
1338 "CONECT 6 5 ",
1339 "CONECT 7 8 ",
1340 "CONECT 8 7 ",
1341 "CONECT 9 10 ",
1342 "CONECT 10 9 ",
1343 "CONECT 11 12 ",
1344 "CONECT 12 11 ",
1345 "CONECT 13 14 ",
1346 "CONECT 14 13 ",
1347 "CONECT 15 16 ",
1348 "CONECT 16 15 ",
1349 "MASTER 0 0 0 0 0 0 0 0 16 1 16 0 ",
1350 "END "
1351 ]
1352
1353
1354 lines = file.readlines()
1355 for i in range(len(lines)):
1356 self.assertEqual(result[i]+'\n', lines[i])
1357
1358
1360 """Check the operation of the structure.web_of_motion user function using structural models 1 and 3 (of 3)."""
1361
1362
1363 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
1364 self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path)
1365
1366
1367 file = DummyFileObject()
1368 self.interpreter.structure.web_of_motion(file=file, models=[1, 3])
1369
1370
1371 result = [
1372 "REMARK 4 THIS FILE COMPLIES WITH FORMAT V. 3.30, JUL-2011. ",
1373 "REMARK 40 CREATED BY RELAX (HTTP://WWW.NMR-RELAX.COM). ",
1374 "ATOM 1 N LEU A 4 9.464 -9.232 27.573 1.00 0.00 N ",
1375 "ATOM 2 N LEU A 4 7.761 -6.392 27.161 1.00 0.00 N ",
1376 "ATOM 3 H LEU A 4 8.575 -8.953 27.963 1.00 0.00 H ",
1377 "ATOM 4 H LEU A 4 7.278 -6.195 28.026 1.00 0.00 H ",
1378 "ATOM 5 CA LEU A 4 10.302 -8.195 26.930 1.00 0.00 C ",
1379 "ATOM 6 CA LEU A 4 9.256 -6.332 27.183 1.00 0.00 C ",
1380 "ATOM 7 CB LEU A 4 9.494 -7.221 26.051 1.00 0.00 C ",
1381 "ATOM 8 CB LEU A 4 9.799 -5.331 26.144 1.00 0.00 C ",
1382 "ATOM 9 CG LEU A 4 10.107 -5.862 25.665 1.00 0.00 C ",
1383 "ATOM 10 CG LEU A 4 10.293 -5.882 24.803 1.00 0.00 C ",
1384 "ATOM 11 CD1 LEU A 4 11.182 -6.007 24.608 1.00 0.00 C ",
1385 "ATOM 12 CD1 LEU A 4 9.404 -6.984 24.274 1.00 0.00 C ",
1386 "ATOM 13 CD2 LEU A 4 9.036 -4.875 25.171 1.00 0.00 C ",
1387 "ATOM 14 CD2 LEU A 4 10.355 -4.772 23.792 1.00 0.00 C ",
1388 "ATOM 15 C LEU A 4 10.999 -7.436 28.046 1.00 0.00 C ",
1389 "ATOM 16 C LEU A 4 9.816 -6.033 28.572 1.00 0.00 C ",
1390 "TER 17 LEU A 4 ",
1391 "CONECT 1 2 ",
1392 "CONECT 2 1 ",
1393 "CONECT 3 4 ",
1394 "CONECT 4 3 ",
1395 "CONECT 5 6 ",
1396 "CONECT 6 5 ",
1397 "CONECT 7 8 ",
1398 "CONECT 8 7 ",
1399 "CONECT 9 10 ",
1400 "CONECT 10 9 ",
1401 "CONECT 11 12 ",
1402 "CONECT 12 11 ",
1403 "CONECT 13 14 ",
1404 "CONECT 14 13 ",
1405 "CONECT 15 16 ",
1406 "CONECT 16 15 ",
1407 "MASTER 0 0 0 0 0 0 0 0 16 1 16 0 ",
1408 "END "
1409 ]
1410
1411
1412 lines = file.readlines()
1413 for i in range(len(lines)):
1414 self.assertEqual(result[i]+'\n', lines[i])
1415
1416
1418 """Check the operation of the structure.web_of_motion user function using all structural models."""
1419
1420
1421 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'
1422 self.interpreter.structure.read_pdb('web_of_motion.pdb', dir=path)
1423
1424
1425 file = DummyFileObject()
1426 self.interpreter.structure.web_of_motion(file=file)
1427
1428
1429 result = [
1430 "REMARK 4 THIS FILE COMPLIES WITH FORMAT V. 3.30, JUL-2011. ",
1431 "REMARK 40 CREATED BY RELAX (HTTP://WWW.NMR-RELAX.COM). ",
1432 "ATOM 1 N LEU A 4 9.464 -9.232 27.573 1.00 0.00 N ",
1433 "ATOM 2 N LEU A 4 9.211 -9.425 26.970 1.00 0.00 N ",
1434 "ATOM 3 N LEU A 4 7.761 -6.392 27.161 1.00 0.00 N ",
1435 "ATOM 4 H LEU A 4 8.575 -8.953 27.963 1.00 0.00 H ",
1436 "ATOM 5 H LEU A 4 9.085 -9.743 27.919 1.00 0.00 H ",
1437 "ATOM 6 H LEU A 4 7.278 -6.195 28.026 1.00 0.00 H ",
1438 "ATOM 7 CA LEU A 4 10.302 -8.195 26.930 1.00 0.00 C ",
1439 "ATOM 8 CA LEU A 4 10.077 -8.221 26.720 1.00 0.00 C ",
1440 "ATOM 9 CA LEU A 4 9.256 -6.332 27.183 1.00 0.00 C ",
1441 "ATOM 10 CB LEU A 4 9.494 -7.221 26.051 1.00 0.00 C ",
1442 "ATOM 11 CB LEU A 4 9.297 -7.096 26.024 1.00 0.00 C ",
1443 "ATOM 12 CB LEU A 4 9.799 -5.331 26.144 1.00 0.00 C ",
1444 "ATOM 13 CG LEU A 4 10.107 -5.862 25.665 1.00 0.00 C ",
1445 "ATOM 14 CG LEU A 4 10.061 -5.803 25.679 1.00 0.00 C ",
1446 "ATOM 15 CG LEU A 4 10.293 -5.882 24.803 1.00 0.00 C ",
1447 "ATOM 16 CD1 LEU A 4 11.182 -6.007 24.608 1.00 0.00 C ",
1448 "ATOM 17 CD1 LEU A 4 11.029 -6.002 24.507 1.00 0.00 C ",
1449 "ATOM 18 CD1 LEU A 4 9.404 -6.984 24.274 1.00 0.00 C ",
1450 "ATOM 19 CD2 LEU A 4 9.036 -4.875 25.171 1.00 0.00 C ",
1451 "ATOM 20 CD2 LEU A 4 9.120 -4.618 25.384 1.00 0.00 C ",
1452 "ATOM 21 CD2 LEU A 4 10.355 -4.772 23.792 1.00 0.00 C ",
1453 "ATOM 22 C LEU A 4 10.999 -7.436 28.046 1.00 0.00 C ",
1454 "ATOM 23 C LEU A 4 10.625 -7.721 28.047 1.00 0.00 C ",
1455 "ATOM 24 C LEU A 4 9.816 -6.033 28.572 1.00 0.00 C ",
1456 "TER 25 LEU A 4 ",
1457 "CONECT 1 2 3 ",
1458 "CONECT 2 1 3 ",
1459 "CONECT 3 1 2 ",
1460 "CONECT 4 5 6 ",
1461 "CONECT 5 4 6 ",
1462 "CONECT 6 4 5 ",
1463 "CONECT 7 8 9 ",
1464 "CONECT 8 7 9 ",
1465 "CONECT 9 7 8 ",
1466 "CONECT 10 11 12 ",
1467 "CONECT 11 10 12 ",
1468 "CONECT 12 10 11 ",
1469 "CONECT 13 14 15 ",
1470 "CONECT 14 13 15 ",
1471 "CONECT 15 13 14 ",
1472 "CONECT 16 17 18 ",
1473 "CONECT 17 16 18 ",
1474 "CONECT 18 16 17 ",
1475 "CONECT 19 20 21 ",
1476 "CONECT 20 19 21 ",
1477 "CONECT 21 19 20 ",
1478 "CONECT 22 23 24 ",
1479 "CONECT 23 22 24 ",
1480 "CONECT 24 22 23 ",
1481 "MASTER 0 0 0 0 0 0 0 0 24 1 24 0 ",
1482 "END "
1483 ]
1484
1485
1486 lines = file.readlines()
1487 for i in range(len(lines)):
1488 self.assertEqual(result[i]+'\n', lines[i])
1489