1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The relax_data user function definitions."""
24
25
26 from os import sep
27 import dep_check
28 if dep_check.wx_module:
29 from wx import FD_OPEN, FD_SAVE
30 else:
31 FD_OPEN = -1
32 FD_SAVE = -1
33
34
35 from graphics import WIZARD_IMAGE_PATH
36 from pipe_control import pipes, relax_data
37 from user_functions.data import Uf_info; uf_info = Uf_info()
38 from user_functions.objects import Desc_container
39
40
41
42 uf_class = uf_info.add_class('relax_data')
43 uf_class.title = "Class for manipulating R1, R2, NOE, or R2eff relaxation data."
44 uf_class.menu_text = "&relax_data"
45 uf_class.gui_icon = "relax.fid"
46
47
48
49 uf = uf_info.add_uf('relax_data.back_calc')
50 uf.title = "Back calculate the relaxation data at the given frequency."
51 uf.title_short = "Relaxation data back calculation."
52 uf.add_keyarg(
53 name = "ri_id",
54 py_type = "str",
55 desc_short = "relaxation ID string",
56 desc = "The relaxation data ID string.",
57 can_be_none = True
58 )
59 uf.add_keyarg(
60 name = "ri_type",
61 py_type = "str",
62 desc_short = "relaxation type",
63 desc = "The relaxation data type, ie 'R1', 'R2', or 'NOE'.",
64 wiz_element_type = "combo",
65 wiz_combo_choices = ["R1", "R2", "NOE"],
66 wiz_read_only = True,
67 can_be_none = True
68 )
69 uf.add_keyarg(
70 name = "frq",
71 py_type = "num",
72 desc_short = "frequency",
73 desc = "The spectrometer frequency in Hz.",
74 can_be_none = True
75 )
76
77 uf.desc.append(Desc_container())
78 uf.desc[-1].add_paragraph("This allows relaxation data of the given type and frequency to be back calculated from the model parameter values. If the relaxation data ID, type and frequency are not given, then relaxation data matching that currently loaded in the relax data store will be back-calculated.")
79 uf.backend = relax_data.back_calc
80 uf.menu_text = "&back_calc"
81 uf.gui_icon = "oxygen.categories.applications-education"
82 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
83
84
85
86 uf = uf_info.add_uf('relax_data.copy')
87 uf.title = "Copy relaxation data from one pipe to another."
88 uf.title_short = "Relaxation data copying."
89 uf.add_keyarg(
90 name = "pipe_from",
91 py_type = "str",
92 desc_short = "source data pipe",
93 desc = "The name of the pipe to copy the relaxation data from.",
94 wiz_element_type = 'combo',
95 wiz_combo_iter = pipes.pipe_names,
96 wiz_read_only = True,
97 can_be_none = True
98 )
99 uf.add_keyarg(
100 name = "pipe_to",
101 py_type = "str",
102 desc_short = "destination data pipe",
103 desc = "The name of the pipe to copy the relaxation data to.",
104 wiz_element_type = 'combo',
105 wiz_combo_iter = pipes.pipe_names,
106 wiz_read_only = True,
107 can_be_none = True
108 )
109 uf.add_keyarg(
110 name = "ri_id",
111 py_type = "str",
112 desc_short = "relaxation data ID string",
113 desc = "The relaxation data ID string.",
114 wiz_element_type = 'combo',
115 wiz_combo_iter = relax_data.get_ids,
116 wiz_read_only = True,
117 can_be_none = True
118 )
119
120 uf.desc.append(Desc_container())
121 uf.desc[-1].add_paragraph("This will copy relaxation data from one data pipe to another. If the relaxation ID data string is not given then all relaxation data will be copied, otherwise only a specific data set will be copied.")
122
123 uf.desc.append(Desc_container("Prompt examples"))
124 uf.desc[-1].add_paragraph("To copy all relaxation data from pipe 'm1' to pipe 'm9', type one of:")
125 uf.desc[-1].add_prompt("relax> relax_data.copy('m1', 'm9')")
126 uf.desc[-1].add_prompt("relax> relax_data.copy(pipe_from='m1', pipe_to='m9')")
127 uf.desc[-1].add_prompt("relax> relax_data.copy('m1', 'm9', None)")
128 uf.desc[-1].add_prompt("relax> relax_data.copy(pipe_from='m1', pipe_to='m9', ri_id=None)")
129 uf.desc[-1].add_paragraph("To copy only the NOE relaxation data with the ID string of 'NOE_800' from 'm3' to 'm6', type one of:")
130 uf.desc[-1].add_prompt("relax> relax_data.copy('m3', 'm6', 'NOE_800')")
131 uf.desc[-1].add_prompt("relax> relax_data.copy(pipe_from='m3', pipe_to='m6', ri_id='NOE_800')")
132 uf.backend = relax_data.copy
133 uf.menu_text = "©"
134 uf.gui_icon = "oxygen.actions.list-add"
135 uf.wizard_size = (700, 500)
136 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
137
138
139
140 uf = uf_info.add_uf('relax_data.delete')
141 uf.title = "Delete the data corresponding to the relaxation data ID string."
142 uf.title_short = "Relaxation data deletion."
143 uf.add_keyarg(
144 name = "ri_id",
145 py_type = "str",
146 desc_short = "relaxation data ID string",
147 desc = "The relaxation data ID string.",
148 wiz_element_type = 'combo',
149 wiz_combo_iter = relax_data.get_ids,
150 wiz_read_only = True
151 )
152
153 uf.desc.append(Desc_container())
154 uf.desc[-1].add_paragraph("The relaxation data corresponding to the given relaxation data ID string will be removed from the current data pipe.")
155
156 uf.desc.append(Desc_container("Prompt examples"))
157 uf.desc[-1].add_paragraph("To delete the relaxation data corresponding to the ID 'NOE_600', type:")
158 uf.desc[-1].add_prompt("relax> relax_data.delete('NOE_600')")
159 uf.backend = relax_data.delete
160 uf.menu_text = "&delete"
161 uf.gui_icon = "oxygen.actions.list-remove"
162 uf.wizard_size = (700, 400)
163 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
164
165
166
167 uf = uf_info.add_uf('relax_data.display')
168 uf.title = "Display the data corresponding to the relaxation data ID string."
169 uf.title_short = "Displaying relaxation data."
170 uf.display = True
171 uf.add_keyarg(
172 name = "ri_id",
173 py_type = "str",
174 desc_short = "relaxation data ID string",
175 desc = "The relaxation data ID string.",
176 wiz_element_type = 'combo',
177 wiz_combo_iter = relax_data.get_ids,
178 wiz_read_only = True
179 )
180
181 uf.desc.append(Desc_container())
182 uf.desc[-1].add_paragraph("This will display the relaxation data corresponding to the given ID.")
183
184 uf.desc.append(Desc_container("Prompt examples"))
185 uf.desc[-1].add_paragraph("To display the NOE relaxation data at 600 MHz with the ID string 'NOE_600', type:")
186 uf.desc[-1].add_prompt("relax> relax_data.display('NOE_600')")
187 uf.backend = relax_data.display
188 uf.menu_text = "dis&play"
189 uf.gui_icon = "oxygen.actions.document-preview"
190 uf.wizard_size = (700, 400)
191 uf.wizard_height_desc = 140
192 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
193
194
195
196 uf = uf_info.add_uf('relax_data.peak_intensity_type')
197 uf.title = "Specify if heights or volumes were used to measure the peak intensities."
198 uf.title_short = "How were peak intensities measured?"
199 uf.add_keyarg(
200 name = "ri_id",
201 py_type = "str",
202 desc_short = "relaxation data ID string",
203 desc = "The relaxation data ID string.",
204 wiz_element_type = 'combo',
205 wiz_combo_iter = relax_data.get_ids,
206 wiz_read_only = True
207 )
208 uf.add_keyarg(
209 name = "type",
210 default = "height",
211 py_type = "str",
212 desc_short = "peak intensity type",
213 desc = "The peak intensity type.",
214 wiz_element_type = "combo",
215 wiz_combo_choices = ["height", "volume"],
216 wiz_read_only = True
217 )
218
219 uf.desc.append(Desc_container())
220 uf.desc[-1].add_paragraph("This is essential for BMRB data deposition. It is used to specify whether peak heights or peak volumes were measured. The two currently allowed values for the peak intensity type are 'height' and 'volume'.")
221 uf.backend = relax_data.peak_intensity_type
222 uf.menu_text = "peak_&intensity_type"
223 uf.gui_icon = "oxygen.actions.edit-rename"
224 uf.wizard_height_desc = 300
225 uf.wizard_size = (800, 600)
226 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
227
228
229
230 uf = uf_info.add_uf('relax_data.read')
231 uf.title = "Read R1, R2, NOE, or R2eff relaxation data from a file."
232 uf.title_short = "Reading relaxation data from file."
233 uf.add_keyarg(
234 name = "ri_id",
235 py_type = "str",
236 desc_short = "relaxation ID string",
237 desc = "The relaxation data ID string. This must be a unique identifier."
238 )
239 uf.add_keyarg(
240 name = "ri_type",
241 py_type = "str",
242 desc_short = "relaxation type",
243 desc = "The relaxation data type, i.e. 'R1', 'R2', 'NOE', or 'R2eff'.",
244 wiz_element_type = "combo",
245 wiz_combo_choices = ["R1", "R2", "NOE", "R2eff"],
246 wiz_read_only = True
247 )
248 uf.add_keyarg(
249 name = "frq",
250 py_type = "num",
251 desc_short = "frequency in Hz",
252 desc = "The exact proton frequency of the spectrometer in Hertz. See the 'sfrq' parameter in the Varian procpar file or the 'SFO1' parameter in the Bruker acqus file."
253 )
254 uf.add_keyarg(
255 name = "file",
256 py_type = "str",
257 arg_type = "file sel",
258 desc_short = "file name",
259 desc = "The name of the file containing the relaxation data.",
260 wiz_filesel_style = FD_OPEN
261 )
262 uf.add_keyarg(
263 name = "dir",
264 py_type = "str",
265 arg_type = "dir",
266 desc_short = "directory name",
267 desc = "The directory where the file is located.",
268 can_be_none = True
269 )
270 uf.add_keyarg(
271 name = "spin_id_col",
272 py_type = "int",
273 arg_type = "free format",
274 desc_short = "spin ID string column",
275 desc = "The spin ID string column (an alternative to the mol, res, and spin name and number columns).",
276 can_be_none = True
277 )
278 uf.add_keyarg(
279 name = "mol_name_col",
280 py_type = "int",
281 arg_type = "free format",
282 desc_short = "molecule name column",
283 desc = "The molecule name column (alternative to the spin_id_col).",
284 can_be_none = True
285 )
286 uf.add_keyarg(
287 name = "res_num_col",
288 py_type = "int",
289 arg_type = "free format",
290 desc_short = "residue number column",
291 desc = "The residue number column (alternative to the spin_id_col).",
292 can_be_none = True
293 )
294 uf.add_keyarg(
295 name = "res_name_col",
296 py_type = "int",
297 arg_type = "free format",
298 desc_short = "residue name column",
299 desc = "The residue name column (alternative to the spin_id_col).",
300 can_be_none = True
301 )
302 uf.add_keyarg(
303 name = "spin_num_col",
304 py_type = "int",
305 arg_type = "free format",
306 desc_short = "spin number column",
307 desc = "The spin number column (alternative to the spin_id_col).",
308 can_be_none = True
309 )
310 uf.add_keyarg(
311 name = "spin_name_col",
312 py_type = "int",
313 arg_type = "free format",
314 desc_short = "spin name column",
315 desc = "The spin name column (alternative to the spin_id_col).",
316 can_be_none = True
317 )
318 uf.add_keyarg(
319 name = "data_col",
320 py_type = "int",
321 arg_type = "free format",
322 desc_short = "data column",
323 desc = "The relaxation data column."
324 )
325 uf.add_keyarg(
326 name = "error_col",
327 py_type = "int",
328 arg_type = "free format",
329 desc_short = "error column",
330 desc = "The experimental error column."
331 )
332 uf.add_keyarg(
333 name = "sep",
334 py_type = "str",
335 arg_type = "free format",
336 desc_short = "column separator",
337 desc = "The column separator (the default is white space).",
338 can_be_none = True
339 )
340 uf.add_keyarg(
341 name = "spin_id",
342 py_type = "str",
343 arg_type = "spin ID",
344 desc_short = "spin ID string",
345 desc = "The spin ID string to restrict the loading of data to certain spin subsets.",
346 can_be_none = True
347 )
348
349 uf.desc.append(Desc_container())
350 uf.desc[-1].add_paragraph("This will load the relaxation data into the relax data store. The data is associated with the spectrometer frequency in Hertz. For subsequent analysis, this frequency must be set to the exact field strength. This value is stored in the 'sfrq' parameter in the Varian procpar file or the 'SFO1' parameter in the Bruker acqus file.")
351 uf.desc[-1].add_paragraph("The spin system can be identified in the file using two different formats. The first is the spin ID string column which can include the molecule name, the residue name and number, and the spin name and number. Alternatively the molecule name, residue number, residue name, spin number and/or spin name columns can be supplied allowing this information to be in separate columns. Note that the numbering of columns starts at one. The spin ID string can be used to restrict the reading to certain spin types, for example only 15N spins when only residue information is in the file.")
352
353 uf.desc.append(Desc_container("Prompt examples"))
354 uf.desc[-1].add_paragraph("The following commands will read the protein NOE relaxation data collected at 600 MHz out of a file called 'noe.600.out' where the residue numbers, residue names, data, errors are in the first, second, third, and forth columns respectively.")
355 uf.desc[-1].add_prompt("relax> relax_data.read('NOE_600', 'NOE', 599.7 * 1e6, 'noe.600.out', res_num_col=1, res_name_col=2, data_col=3, error_col=4)")
356 uf.desc[-1].add_prompt("relax> relax_data.read(ri_id='NOE_600', ri_type='NOE', frq=600.0 * 1e6, file='noe.600.out', res_num_col=1, res_name_col=2, data_col=3, error_col=4)")
357 uf.desc[-1].add_paragraph("The following commands will read the R2 data out of the file 'r2.out' where the residue numbers, residue names, data, errors are in the second, third, fifth, and sixth columns respectively. The columns are separated by commas.")
358 uf.desc[-1].add_prompt("relax> relax_data.read('R2_800', 'R2', 8.0 * 1e8, 'r2.out', res_num_col=2, res_name_col=3, data_col=5, error_col=6, sep=',')")
359 uf.desc[-1].add_prompt("relax> relax_data.read(ri_id='R2_800', ri_type='R2', frq=8.0*1e8, file='r2.out', res_num_col=2, res_name_col=3, data_col=5, error_col=6, sep=',')")
360 uf.desc[-1].add_paragraph("The following commands will read the R1 data out of the file 'r1.out' where the columns are separated by the symbol '%'")
361 uf.desc[-1].add_prompt("relax> relax_data.read('R1_300', 'R1', 300.1 * 1e6, 'r1.out', sep='%')")
362 uf.backend = relax_data.read
363 uf.menu_text = "&read"
364 uf.gui_icon = "oxygen.actions.document-open"
365 uf.wizard_height_desc = 450
366 uf.wizard_size = (1000, 700)
367 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
368
369
370
371 uf = uf_info.add_uf('relax_data.temp_calibration')
372 uf.title = "Specify the per-experiment temperature calibration method used."
373 uf.title_short = "The per-experiment temperature calibration method."
374 uf.add_keyarg(
375 name = "ri_id",
376 py_type = "str",
377 desc_short = "relaxation data ID string",
378 desc = "The relaxation data ID string.",
379 wiz_element_type = 'combo',
380 wiz_combo_iter = relax_data.get_ids,
381 wiz_read_only = True
382 )
383 uf.add_keyarg(
384 name = "method",
385 py_type = "str",
386 desc_short = "per-experiment calibration method",
387 desc = "The per-experiment temperature calibration method.",
388 wiz_element_type = 'combo',
389 wiz_combo_choices = [
390 'methanol',
391 'monoethylene glycol',
392 'no calibration applied'
393 ]
394 )
395
396 uf.desc.append(Desc_container())
397 uf.desc[-1].add_paragraph("For the proper measurement of relaxation data, per-experiment temperature calibration is essential. This user function is not for inputting standard MeOH/ethylene glycol/etc. calibration of a spectrometer - this temperature setting is of no use when you are running experiments which pump in large amounts of power into the probe head.")
398 uf.desc[-1].add_paragraph("The R1 experiment should be about the same temperature as a HSQC and hence be close to the standard MeOH/ethylene glycol spectrometer calibration. However the R2 CPMG or spin lock and, to a lesser extent, the NOE pre-saturation pump a lot more power into the probe head. The power differences can either cause the temperature in the sample to be too high or too low. This is unpredictable as the thermometer used by the VT unit is next to the coils in the probe head and not inside the NMR sample. So the VT unit tries to control the temperature inside the probe head rather than in the NMR sample. However between the thermometer and the sample is the water of the sample, the glass of the NMR tube, the air gap where the VT unit controls air flow and the outside components of the probe head protecting the electronics. If the sample, the probe head or the VT unit is changed, this will have a different affect on the per-experiment temperature. The VT unit responds differently under different conditions and may sometimes over or under compensate by a couple of degrees. Therefore each relaxation data set from each spectrometer requires a per-experiment calibration.")
399 uf.desc[-1].add_paragraph("Specifying the per-experiment calibration method is needed for BMRB data deposition. The currently allowed methods are:")
400 uf.desc[-1].add_list_element("'methanol',")
401 uf.desc[-1].add_list_element("'monoethylene glycol',")
402 uf.desc[-1].add_list_element("'no calibration applied'.")
403 uf.desc[-1].add_paragraph("Other methods will be accepted if supplied.")
404 uf.backend = relax_data.temp_calibration
405 uf.menu_text = "&temp_calibration"
406 uf.gui_icon = "oxygen.status.weather-clear"
407 uf.wizard_height_desc = 550
408 uf.wizard_size = (1000, 750)
409 uf.wizard_image = WIZARD_IMAGE_PATH + 'oxygen-icon-weather-clear.png'
410
411
412
413 uf = uf_info.add_uf('relax_data.temp_control')
414 uf.title = "Specify the temperature control method used."
415 uf.title_short = "The temperature control method."
416 uf.add_keyarg(
417 name = "ri_id",
418 py_type = "str",
419 desc_short = "relaxation data ID string",
420 desc = "The relaxation data ID string.",
421 wiz_element_type = 'combo',
422 wiz_combo_iter = relax_data.get_ids,
423 wiz_read_only = True
424 )
425 uf.add_keyarg(
426 name = "method",
427 py_type = "str",
428 desc_short = "temperature control method",
429 desc = "The control method.",
430 wiz_element_type = 'combo',
431 wiz_combo_choices = [
432 'single scan interleaving',
433 'temperature compensation block',
434 'single scan interleaving and temperature compensation block',
435 'single fid interleaving',
436 'single experiment interleaving',
437 'no temperature control applied'
438 ],
439 wiz_read_only = True
440 )
441
442 uf.desc.append(Desc_container())
443 uf.desc[-1].add_paragraph("For the proper measurement of relaxation data, explicit temperature control techniques are essential. A number of factors can cause significant temperature fluctuations between individual relaxation experiments. This includes the daily temperature cycle of the room housing the spectrometer, different amounts of power for the individual experiments, etc.")
444 uf.desc[-1].add_paragraph("The best methods for eliminating such problems are single scan interleaving and temperature compensation block. Single scan interleaving is the most powerful technique for averaging the temperature fluctuations not only across different experiments, but also across the entire measurement time. The application of off-resonance temperature compensation blocks at the start of the experiment is useful for the R2 and will normalise the temperature between the individual experiments, but single scan or single fid interleaving is nevertheless required for normalising the temperature across the entire measurement.")
445 uf.desc[-1].add_paragraph("Specifying the temperature control method is needed for BMRB data deposition. The currently allowed methods are:")
446 uf.desc[-1].add_list_element("'single scan interleaving',")
447 uf.desc[-1].add_list_element("'temperature compensation block',")
448 uf.desc[-1].add_list_element("'single scan interleaving and temperature compensation block',")
449 uf.desc[-1].add_list_element("'single fid interleaving',")
450 uf.desc[-1].add_list_element("'single experiment interleaving',")
451 uf.desc[-1].add_list_element("'no temperature control applied'.")
452 uf.backend = relax_data.temp_control
453 uf.menu_text = "temp_contro&l"
454 uf.gui_icon = "oxygen.status.weather-clear"
455 uf.wizard_size = (1000, 750)
456 uf.wizard_height_desc = 500
457 uf.wizard_image = WIZARD_IMAGE_PATH + 'oxygen-icon-weather-clear.png'
458
459
460
461 uf = uf_info.add_uf('relax_data.type')
462 uf.title = "Set the type of relaxation data."
463 uf.title_short = "Relaxation data type setting."
464 uf.add_keyarg(
465 name = "ri_id",
466 py_type = "str",
467 desc_short = "relaxation ID string",
468 desc = "The relaxation data ID string of the data to set the frequency of.",
469 wiz_element_type = 'combo',
470 wiz_combo_iter = relax_data.get_ids,
471 wiz_read_only = True
472 )
473 uf.add_keyarg(
474 name = "ri_type",
475 py_type = "str",
476 desc_short = "relaxation type",
477 desc = "The relaxation data type, i.e. 'R1', 'R2', or 'NOE'.",
478 wiz_element_type = "combo",
479 wiz_combo_choices = ["R1", "R2", "NOE"],
480 wiz_read_only = True
481 )
482
483 uf.desc.append(Desc_container())
484 uf.desc[-1].add_paragraph("This allows the type associated with the relaxation data to be either set or reset. This type must be one of 'R1', 'R2', or 'NOE'.")
485 uf.backend = relax_data.type
486 uf.menu_text = "&type"
487 uf.gui_icon = "oxygen.actions.edit-rename"
488 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
489
490
491
492
493 uf = uf_info.add_uf('relax_data.write')
494 uf.title = "Write relaxation data to a file."
495 uf.title_short = "Relaxation data writing."
496 uf.add_keyarg(
497 name = "ri_id",
498 py_type = "str",
499 desc_short = "relaxation data ID string",
500 desc = "The relaxation data ID string.",
501 wiz_element_type = 'combo',
502 wiz_combo_iter = relax_data.get_ids,
503 wiz_read_only = True
504 )
505 uf.add_keyarg(
506 name = "file",
507 py_type = "str",
508 arg_type = "file sel",
509 desc_short = "file name",
510 desc = "The name of the file.",
511 wiz_filesel_style = FD_SAVE
512 )
513 uf.add_keyarg(
514 name = "dir",
515 py_type = "str",
516 arg_type = "dir",
517 desc_short = "directory name",
518 desc = "The directory name.",
519 can_be_none = True
520 )
521 uf.add_keyarg(
522 name = "bc",
523 default = False,
524 py_type = "bool",
525 desc_short = "back calculated data flag",
526 desc = "A flag which if True will cause the back-calculated data to be written to the file."
527 )
528 uf.add_keyarg(
529 name = "force",
530 default = False,
531 py_type = "bool",
532 desc_short = "force flag",
533 desc = "A flag which if True will cause the file to be overwritten."
534 )
535
536 uf.desc.append(Desc_container())
537 uf.desc[-1].add_paragraph("If no directory name is given, the file will be placed in the current working directory. The relaxation data ID string is required for selecting which relaxation data to write to file.")
538 uf.backend = relax_data.write
539 uf.menu_text = "&write"
540 uf.gui_icon = "oxygen.actions.document-save"
541 uf.wizard_size = (800, 600)
542 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
543