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
28
29 from graphics import WIZARD_IMAGE_PATH
30 from pipe_control import pipes, relax_data
31 from user_functions.data import Uf_info; uf_info = Uf_info()
32 from user_functions.objects import Desc_container
33
34
35
36 uf_class = uf_info.add_class('relax_data')
37 uf_class.title = "Class for manipulating R1, R2, NOE, or R2eff relaxation data."
38 uf_class.menu_text = "&relax_data"
39 uf_class.gui_icon = "relax.fid"
40
41
42
43 uf = uf_info.add_uf('relax_data.back_calc')
44 uf.title = "Back calculate the relaxation data at the given frequency."
45 uf.title_short = "Relaxation data back calculation."
46 uf.add_keyarg(
47 name = "ri_id",
48 basic_types = ["str"],
49 desc_short = "relaxation ID string",
50 desc = "The relaxation data ID string.",
51 can_be_none = True
52 )
53 uf.add_keyarg(
54 name = "ri_type",
55 basic_types = ["str"],
56 desc_short = "relaxation type",
57 desc = "The relaxation data type, ie 'R1', 'R2', or 'NOE'.",
58 wiz_element_type = "combo",
59 wiz_combo_choices = ["R1", "R2", "NOE"],
60 wiz_read_only = True,
61 can_be_none = True
62 )
63 uf.add_keyarg(
64 name = "frq",
65 basic_types = ["number"],
66 desc_short = "frequency",
67 desc = "The spectrometer frequency in Hz.",
68 can_be_none = True
69 )
70
71 uf.desc.append(Desc_container())
72 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.")
73 uf.backend = relax_data.back_calc
74 uf.menu_text = "&back_calc"
75 uf.gui_icon = "oxygen.categories.applications-education"
76 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
77
78
79
80 uf = uf_info.add_uf('relax_data.copy')
81 uf.title = "Copy relaxation data from one pipe to another."
82 uf.title_short = "Relaxation data copying."
83 uf.add_keyarg(
84 name = "pipe_from",
85 basic_types = ["str"],
86 desc_short = "source data pipe",
87 desc = "The name of the pipe to copy the relaxation data from.",
88 wiz_element_type = 'combo',
89 wiz_combo_iter = pipes.pipe_names,
90 wiz_read_only = True,
91 can_be_none = True
92 )
93 uf.add_keyarg(
94 name = "pipe_to",
95 basic_types = ["str"],
96 desc_short = "destination data pipe",
97 desc = "The name of the pipe to copy the relaxation data to.",
98 wiz_element_type = 'combo',
99 wiz_combo_iter = pipes.pipe_names,
100 wiz_read_only = True,
101 can_be_none = True
102 )
103 uf.add_keyarg(
104 name = "ri_id",
105 basic_types = ["str"],
106 desc_short = "relaxation data ID string",
107 desc = "The relaxation data ID string.",
108 wiz_element_type = 'combo',
109 wiz_combo_iter = relax_data.get_ids,
110 wiz_read_only = True,
111 can_be_none = True
112 )
113
114 uf.desc.append(Desc_container())
115 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.")
116
117 uf.desc.append(Desc_container("Prompt examples"))
118 uf.desc[-1].add_paragraph("To copy all relaxation data from pipe 'm1' to pipe 'm9', type one of:")
119 uf.desc[-1].add_prompt("relax> relax_data.copy('m1', 'm9')")
120 uf.desc[-1].add_prompt("relax> relax_data.copy(pipe_from='m1', pipe_to='m9')")
121 uf.desc[-1].add_prompt("relax> relax_data.copy('m1', 'm9', None)")
122 uf.desc[-1].add_prompt("relax> relax_data.copy(pipe_from='m1', pipe_to='m9', ri_id=None)")
123 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:")
124 uf.desc[-1].add_prompt("relax> relax_data.copy('m3', 'm6', 'NOE_800')")
125 uf.desc[-1].add_prompt("relax> relax_data.copy(pipe_from='m3', pipe_to='m6', ri_id='NOE_800')")
126 uf.backend = relax_data.copy
127 uf.menu_text = "©"
128 uf.gui_icon = "oxygen.actions.list-add"
129 uf.wizard_size = (700, 500)
130 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
131
132
133
134 uf = uf_info.add_uf('relax_data.delete')
135 uf.title = "Delete the data corresponding to the relaxation data ID string."
136 uf.title_short = "Relaxation data deletion."
137 uf.add_keyarg(
138 name = "ri_id",
139 basic_types = ["str"],
140 desc_short = "relaxation data ID string",
141 desc = "The relaxation data ID string.",
142 wiz_element_type = 'combo',
143 wiz_combo_iter = relax_data.get_ids,
144 wiz_read_only = True
145 )
146
147 uf.desc.append(Desc_container())
148 uf.desc[-1].add_paragraph("The relaxation data corresponding to the given relaxation data ID string will be removed from the current data pipe.")
149
150 uf.desc.append(Desc_container("Prompt examples"))
151 uf.desc[-1].add_paragraph("To delete the relaxation data corresponding to the ID 'NOE_600', type:")
152 uf.desc[-1].add_prompt("relax> relax_data.delete('NOE_600')")
153 uf.backend = relax_data.delete
154 uf.menu_text = "&delete"
155 uf.gui_icon = "oxygen.actions.list-remove"
156 uf.wizard_size = (700, 400)
157 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
158
159
160
161 uf = uf_info.add_uf('relax_data.display')
162 uf.title = "Display the data corresponding to the relaxation data ID string."
163 uf.title_short = "Displaying relaxation data."
164 uf.display = True
165 uf.add_keyarg(
166 name = "ri_id",
167 basic_types = ["str"],
168 desc_short = "relaxation data ID string",
169 desc = "The relaxation data ID string.",
170 wiz_element_type = 'combo',
171 wiz_combo_iter = relax_data.get_ids,
172 wiz_read_only = True
173 )
174
175 uf.desc.append(Desc_container())
176 uf.desc[-1].add_paragraph("This will display the relaxation data corresponding to the given ID.")
177
178 uf.desc.append(Desc_container("Prompt examples"))
179 uf.desc[-1].add_paragraph("To display the NOE relaxation data at 600 MHz with the ID string 'NOE_600', type:")
180 uf.desc[-1].add_prompt("relax> relax_data.display('NOE_600')")
181 uf.backend = relax_data.display
182 uf.menu_text = "dis&play"
183 uf.gui_icon = "oxygen.actions.document-preview"
184 uf.wizard_size = (700, 400)
185 uf.wizard_height_desc = 140
186 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
187
188
189
190 uf = uf_info.add_uf('relax_data.peak_intensity_type')
191 uf.title = "Specify if heights or volumes were used to measure the peak intensities."
192 uf.title_short = "How were peak intensities measured?"
193 uf.add_keyarg(
194 name = "ri_id",
195 basic_types = ["str"],
196 desc_short = "relaxation data ID string",
197 desc = "The relaxation data ID string.",
198 wiz_element_type = 'combo',
199 wiz_combo_iter = relax_data.get_ids,
200 wiz_read_only = True
201 )
202 uf.add_keyarg(
203 name = "type",
204 default = "height",
205 basic_types = ["str"],
206 desc_short = "peak intensity type",
207 desc = "The peak intensity type.",
208 wiz_element_type = "combo",
209 wiz_combo_choices = ["height", "volume"],
210 wiz_read_only = True
211 )
212
213 uf.desc.append(Desc_container())
214 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'.")
215 uf.backend = relax_data.peak_intensity_type
216 uf.menu_text = "peak_&intensity_type"
217 uf.gui_icon = "oxygen.actions.edit-rename"
218 uf.wizard_height_desc = 300
219 uf.wizard_size = (800, 600)
220 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
221
222
223
224 uf = uf_info.add_uf('relax_data.read')
225 uf.title = "Read R1, R2, NOE, or R2eff relaxation data from a file."
226 uf.title_short = "Reading relaxation data from file."
227 uf.add_keyarg(
228 name = "ri_id",
229 basic_types = ["str"],
230 desc_short = "relaxation ID string",
231 desc = "The relaxation data ID string. This must be a unique identifier."
232 )
233 uf.add_keyarg(
234 name = "ri_type",
235 basic_types = ["str"],
236 desc_short = "relaxation type",
237 desc = "The relaxation data type, i.e. 'R1', 'R2', 'NOE', or 'R2eff'.",
238 wiz_element_type = "combo",
239 wiz_combo_choices = ["R1", "R2", "NOE", "R2eff"],
240 wiz_read_only = True
241 )
242 uf.add_keyarg(
243 name = "frq",
244 basic_types = ["number"],
245 desc_short = "frequency in Hz",
246 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."
247 )
248 uf.add_keyarg(
249 name = "file",
250 arg_type = "file sel read",
251 desc_short = "file name",
252 desc = "The name of the file containing the relaxation data.",
253 )
254 uf.add_keyarg(
255 name = "dir",
256 arg_type = "dir",
257 desc_short = "directory name",
258 desc = "The directory where the file is located.",
259 can_be_none = True
260 )
261 uf.add_keyarg(
262 name = "spin_id_col",
263 basic_types = ["int"],
264 arg_type = "free format",
265 desc_short = "spin ID string column",
266 desc = "The spin ID string column (an alternative to the mol, res, and spin name and number columns).",
267 can_be_none = True
268 )
269 uf.add_keyarg(
270 name = "mol_name_col",
271 basic_types = ["int"],
272 arg_type = "free format",
273 desc_short = "molecule name column",
274 desc = "The molecule name column (alternative to the spin_id_col).",
275 can_be_none = True
276 )
277 uf.add_keyarg(
278 name = "res_num_col",
279 basic_types = ["int"],
280 arg_type = "free format",
281 desc_short = "residue number column",
282 desc = "The residue number column (alternative to the spin_id_col).",
283 can_be_none = True
284 )
285 uf.add_keyarg(
286 name = "res_name_col",
287 basic_types = ["int"],
288 arg_type = "free format",
289 desc_short = "residue name column",
290 desc = "The residue name column (alternative to the spin_id_col).",
291 can_be_none = True
292 )
293 uf.add_keyarg(
294 name = "spin_num_col",
295 basic_types = ["int"],
296 arg_type = "free format",
297 desc_short = "spin number column",
298 desc = "The spin number column (alternative to the spin_id_col).",
299 can_be_none = True
300 )
301 uf.add_keyarg(
302 name = "spin_name_col",
303 basic_types = ["int"],
304 arg_type = "free format",
305 desc_short = "spin name column",
306 desc = "The spin name column (alternative to the spin_id_col).",
307 can_be_none = True
308 )
309 uf.add_keyarg(
310 name = "data_col",
311 basic_types = ["int"],
312 arg_type = "free format",
313 desc_short = "data column",
314 desc = "The relaxation data column."
315 )
316 uf.add_keyarg(
317 name = "error_col",
318 basic_types = ["int"],
319 arg_type = "free format",
320 desc_short = "error column",
321 desc = "The experimental error column."
322 )
323 uf.add_keyarg(
324 name = "sep",
325 basic_types = ["str"],
326 arg_type = "free format",
327 desc_short = "column separator",
328 desc = "The column separator (the default is white space).",
329 can_be_none = True
330 )
331 uf.add_keyarg(
332 name = "spin_id",
333 arg_type = "spin ID",
334 desc_short = "spin ID string",
335 desc = "The spin ID string to restrict the loading of data to certain spin subsets.",
336 can_be_none = True
337 )
338
339 uf.desc.append(Desc_container())
340 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.")
341 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.")
342
343 uf.desc.append(Desc_container("Prompt examples"))
344 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.")
345 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)")
346 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)")
347 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.")
348 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=',')")
349 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=',')")
350 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 '%'")
351 uf.desc[-1].add_prompt("relax> relax_data.read('R1_300', 'R1', 300.1 * 1e6, 'r1.out', sep='%')")
352 uf.backend = relax_data.read
353 uf.menu_text = "&read"
354 uf.gui_icon = "oxygen.actions.document-open"
355 uf.wizard_height_desc = 450
356 uf.wizard_size = (1000, 700)
357 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
358
359
360
361 uf = uf_info.add_uf('relax_data.temp_calibration')
362 uf.title = "Specify the per-experiment temperature calibration method used."
363 uf.title_short = "The per-experiment temperature calibration method."
364 uf.add_keyarg(
365 name = "ri_id",
366 basic_types = ["str"],
367 desc_short = "relaxation data ID string",
368 desc = "The relaxation data ID string.",
369 wiz_element_type = 'combo',
370 wiz_combo_iter = relax_data.get_ids,
371 wiz_read_only = True
372 )
373 uf.add_keyarg(
374 name = "method",
375 basic_types = ["str"],
376 desc_short = "per-experiment calibration method",
377 desc = "The per-experiment temperature calibration method.",
378 wiz_element_type = 'combo',
379 wiz_combo_choices = [
380 'methanol',
381 'monoethylene glycol',
382 'no calibration applied'
383 ]
384 )
385
386 uf.desc.append(Desc_container())
387 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.")
388 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.")
389 uf.desc[-1].add_paragraph("Specifying the per-experiment calibration method is needed for BMRB data deposition. The currently allowed methods are:")
390 uf.desc[-1].add_list_element("'methanol',")
391 uf.desc[-1].add_list_element("'monoethylene glycol',")
392 uf.desc[-1].add_list_element("'no calibration applied'.")
393 uf.desc[-1].add_paragraph("Other methods will be accepted if supplied.")
394 uf.backend = relax_data.temp_calibration
395 uf.menu_text = "&temp_calibration"
396 uf.gui_icon = "oxygen.status.weather-clear"
397 uf.wizard_height_desc = 550
398 uf.wizard_size = (1000, 750)
399 uf.wizard_image = WIZARD_IMAGE_PATH + 'oxygen-icon-weather-clear.png'
400
401
402
403 uf = uf_info.add_uf('relax_data.temp_control')
404 uf.title = "Specify the temperature control method used."
405 uf.title_short = "The temperature control method."
406 uf.add_keyarg(
407 name = "ri_id",
408 basic_types = ["str"],
409 desc_short = "relaxation data ID string",
410 desc = "The relaxation data ID string.",
411 wiz_element_type = 'combo',
412 wiz_combo_iter = relax_data.get_ids,
413 wiz_read_only = True
414 )
415 uf.add_keyarg(
416 name = "method",
417 basic_types = ["str"],
418 desc_short = "temperature control method",
419 desc = "The control method.",
420 wiz_element_type = 'combo',
421 wiz_combo_choices = [
422 'single scan interleaving',
423 'temperature compensation block',
424 'single scan interleaving and temperature compensation block',
425 'single fid interleaving',
426 'single experiment interleaving',
427 'no temperature control applied'
428 ],
429 wiz_read_only = True
430 )
431
432 uf.desc.append(Desc_container())
433 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.")
434 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.")
435 uf.desc[-1].add_paragraph("Specifying the temperature control method is needed for BMRB data deposition. The currently allowed methods are:")
436 uf.desc[-1].add_list_element("'single scan interleaving',")
437 uf.desc[-1].add_list_element("'temperature compensation block',")
438 uf.desc[-1].add_list_element("'single scan interleaving and temperature compensation block',")
439 uf.desc[-1].add_list_element("'single fid interleaving',")
440 uf.desc[-1].add_list_element("'single experiment interleaving',")
441 uf.desc[-1].add_list_element("'no temperature control applied'.")
442 uf.backend = relax_data.temp_control
443 uf.menu_text = "temp_contro&l"
444 uf.gui_icon = "oxygen.status.weather-clear"
445 uf.wizard_size = (1000, 750)
446 uf.wizard_height_desc = 500
447 uf.wizard_image = WIZARD_IMAGE_PATH + 'oxygen-icon-weather-clear.png'
448
449
450
451 uf = uf_info.add_uf('relax_data.type')
452 uf.title = "Set the type of relaxation data."
453 uf.title_short = "Relaxation data type setting."
454 uf.add_keyarg(
455 name = "ri_id",
456 basic_types = ["str"],
457 desc_short = "relaxation ID string",
458 desc = "The relaxation data ID string of the data to set the frequency of.",
459 wiz_element_type = 'combo',
460 wiz_combo_iter = relax_data.get_ids,
461 wiz_read_only = True
462 )
463 uf.add_keyarg(
464 name = "ri_type",
465 basic_types = ["str"],
466 desc_short = "relaxation type",
467 desc = "The relaxation data type, i.e. 'R1', 'R2', or 'NOE'.",
468 wiz_element_type = "combo",
469 wiz_combo_choices = ["R1", "R2", "NOE"],
470 wiz_read_only = True
471 )
472
473 uf.desc.append(Desc_container())
474 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'.")
475 uf.backend = relax_data.type
476 uf.menu_text = "&type"
477 uf.gui_icon = "oxygen.actions.edit-rename"
478 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
479
480
481
482
483 uf = uf_info.add_uf('relax_data.write')
484 uf.title = "Write relaxation data to a file."
485 uf.title_short = "Relaxation data writing."
486 uf.add_keyarg(
487 name = "ri_id",
488 basic_types = ["str"],
489 desc_short = "relaxation data ID string",
490 desc = "The relaxation data ID string.",
491 wiz_element_type = 'combo',
492 wiz_combo_iter = relax_data.get_ids,
493 wiz_read_only = True
494 )
495 uf.add_keyarg(
496 name = "file",
497 arg_type = "file sel write",
498 desc_short = "file name",
499 desc = "The name of the file.",
500 )
501 uf.add_keyarg(
502 name = "dir",
503 arg_type = "dir",
504 desc_short = "directory name",
505 desc = "The directory name.",
506 can_be_none = True
507 )
508 uf.add_keyarg(
509 name = "bc",
510 default = False,
511 basic_types = ["bool"],
512 desc_short = "back calculated data flag",
513 desc = "A flag which if True will cause the back-calculated data to be written to the file."
514 )
515 uf.add_keyarg(
516 name = "force",
517 default = False,
518 basic_types = ["bool"],
519 desc_short = "force flag",
520 desc = "A flag which if True will cause the file to be overwritten."
521 )
522
523 uf.desc.append(Desc_container())
524 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.")
525 uf.backend = relax_data.write
526 uf.menu_text = "&write"
527 uf.gui_icon = "oxygen.actions.document-save"
528 uf.wizard_size = (800, 600)
529 uf.wizard_image = WIZARD_IMAGE_PATH + 'fid.png'
530