1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The pcs user function definitions."""
25
26
27 import wx
28
29
30 from generic_fns import align_tensor, pcs, pipes
31 from graphics import WIZARD_IMAGE_PATH
32 from user_functions.data import Uf_info; uf_info = Uf_info()
33 from user_functions.objects import Desc_container
34
35
36
37 uf_class = uf_info.add_class('pcs')
38 uf_class.title = "Class for handling pseudo-contact shifts."
39 uf_class.menu_text = "&pcs"
40 uf_class.gui_icon = "relax.align_tensor"
41
42
43
44 uf = uf_info.add_uf('pcs.back_calc')
45 uf.title = "Back calculate the pseudo-contact shifts."
46 uf.title_short = "PCS back calculation."
47 uf.display = True
48 uf.add_keyarg(
49 name = "align_id",
50 py_type = "str",
51 desc_short = "alignment ID string",
52 desc = "The alignment ID string.",
53 wiz_element_type = 'combo',
54 wiz_combo_iter = align_tensor.get_ids,
55 wiz_read_only = True,
56 can_be_none = True
57 )
58
59 uf.desc.append(Desc_container())
60 uf.desc[-1].add_paragraph("This will back calculate the pseudo-contact shifts if the paramagnetic centre, temperature and magnetic field strength has been specified, an alignment tensor is present, and atomic positions have been loaded into the relax data store.")
61 uf.backend = pcs.back_calc
62 uf.menu_text = "&back_calc"
63 uf.gui_icon = "oxygen.categories.applications-education"
64 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
65 uf.wizard_apply_button = False
66
67
68
69 uf = uf_info.add_uf('pcs.calc_q_factors')
70 uf.title = "Calculate the PCS Q factor for the selected spins."
71 uf.title_short = "PCS Q factor calculation."
72 uf.display = True
73 uf.add_keyarg(
74 name = "spin_id",
75 py_type = "str",
76 desc_short = "spin ID string",
77 desc = "The spin ID string for restricting to subset of all selected spins.",
78 can_be_none = True
79 )
80
81 uf.desc.append(Desc_container())
82 uf.desc[-1].add_paragraph("For this to work, the back-calculated PCS data must first be generated by the analysis specific code. Otherwise a warning will be given.")
83
84 uf.desc.append(Desc_container("Prompt examples"))
85 uf.desc[-1].add_paragraph("To calculate the PCS Q factor for only the spins '@H26', '@H27', and '@H28', type one of:")
86 uf.desc[-1].add_prompt("relax> pcs.calc_q_factors('@H26 & @H27 & @H28')")
87 uf.desc[-1].add_prompt("relax> pcs.calc_q_factors(spin_id='@H26 & @H27 & @H28')")
88 uf.backend = pcs.q_factors
89 uf.menu_text = "&calc_q_factors"
90 uf.gui_icon = "oxygen.categories.applications-education"
91 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
92 uf.wizard_apply_button = False
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148 uf = uf_info.add_uf('pcs.corr_plot')
149 uf.title = "Generate a correlation plot of the measured vs. the back-calculated PCSs."
150 uf.title_short = "Correlation plot generation."
151 uf.add_keyarg(
152 name = "format",
153 default = "grace",
154 py_type = "str",
155 desc_short = "format",
156 desc = "The format of the plot data.",
157 wiz_element_type = "combo",
158 wiz_combo_choices = ["grace"],
159 wiz_read_only = True,
160 can_be_none = True
161 )
162 uf.add_keyarg(
163 name = "file",
164 default = "pcs_corr_plot.agr",
165 py_type = "str",
166 arg_type = "file sel",
167 desc_short = "Grace file name",
168 desc = "The name of the Grace file to create.",
169 wiz_filesel_wildcard = "Grace files (*.agr)|*.agr;*.AGR",
170 wiz_filesel_style = wx.FD_SAVE
171 )
172 uf.add_keyarg(
173 name = "dir",
174 py_type = "str",
175 arg_type = "dir",
176 desc_short = "directory name",
177 desc = "The directory name.",
178 can_be_none = True
179 )
180 uf.add_keyarg(
181 name = "force",
182 default = False,
183 py_type = "bool",
184 desc_short = "force flag",
185 desc = "A flag which if True will cause the file to be overwritten."
186 )
187
188 uf.desc.append(Desc_container())
189 uf.desc[-1].add_paragraph("Two formats are currently supported. If format is set to 'grace', then a Grace plot file will be created. If the format is not set then a plain text list of the measured and back-calculated data will be created.")
190
191 uf.desc.append(Desc_container("Prompt examples"))
192 uf.desc[-1].add_paragraph("To create a Grace plot of the data, type:")
193 uf.desc[-1].add_prompt("relax> pcs.corr_plot()")
194 uf.desc[-1].add_paragraph("To create a plain text list of the measured and back-calculated data, type one of:")
195 uf.desc[-1].add_prompt("relax> pcs.corr_plot(None)")
196 uf.desc[-1].add_prompt("relax> pcs.corr_plot(format=None)")
197 uf.backend = pcs.corr_plot
198 uf.menu_text = "corr_&plot"
199 uf.wizard_size = (800, 500)
200 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
201 uf.wizard_apply_button = False
202
203
204
205 uf = uf_info.add_uf('pcs.delete')
206 uf.title = "Delete the PCS data corresponding to the alignment ID."
207 uf.title_short = "PCS deletion."
208 uf.add_keyarg(
209 name = "align_id",
210 py_type = "str",
211 desc_short = "alignment ID string",
212 desc = "The alignment ID string of the data to delete.",
213 wiz_element_type = 'combo',
214 wiz_combo_iter = align_tensor.get_ids,
215 wiz_read_only = True,
216 can_be_none = True
217 )
218
219 uf.desc.append(Desc_container())
220 uf.desc[-1].add_paragraph("This will delete all PCS data associated with the alignment ID in the current data pipe.")
221
222 uf.desc.append(Desc_container("Prompt examples"))
223 uf.desc[-1].add_paragraph("To delete the PCS data corresponding to align_id='PH_gel', type:")
224 uf.desc[-1].add_prompt("relax> pcs.delete('PH_gel')")
225 uf.backend = pcs.delete
226 uf.menu_text = "&delete"
227 uf.gui_icon = "oxygen.actions.list-remove"
228 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
229
230
231
232 uf = uf_info.add_uf('pcs.display')
233 uf.title = "Display the PCS data corresponding to the alignment ID."
234 uf.title_short = "PCS data display."
235 uf.display = True
236 uf.add_keyarg(
237 name = "align_id",
238 py_type = "str",
239 desc_short = "alignment ID string",
240 desc = "The alignment ID string.",
241 wiz_element_type = 'combo',
242 wiz_combo_iter = align_tensor.get_ids,
243 wiz_read_only = True
244 )
245 uf.add_keyarg(
246 name = "bc",
247 default = False,
248 py_type = "bool",
249 desc_short = "back-calculation flag",
250 desc = "A flag which if set will display the back-calculated rather than measured RDCs."
251 )
252
253 uf.desc.append(Desc_container())
254 uf.desc[-1].add_paragraph("This will display all of the PCS data associated with the alignment ID in the current data pipe.")
255
256 uf.desc.append(Desc_container("Prompt examples"))
257 uf.desc[-1].add_paragraph("To display the 'phage' PCS data, type:")
258 uf.desc[-1].add_prompt("relax> pcs.display('phage')")
259 uf.backend = pcs.display
260 uf.menu_text = "di&splay"
261 uf.gui_icon = "oxygen.actions.document-preview"
262 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
263
264
265
266 uf = uf_info.add_uf('pcs.read')
267 uf.title = "Read the PCS data from file."
268 uf.title_short = "PCS data reading."
269 uf.add_keyarg(
270 name = "align_id",
271 py_type = "str",
272 desc_short = "alignment ID string",
273 desc = "The alignment ID string.",
274 wiz_element_type = 'combo',
275 wiz_combo_iter = align_tensor.get_ids
276 )
277 uf.add_keyarg(
278 name = "file",
279 py_type = "str",
280 arg_type = "file sel",
281 desc_short = "file name",
282 desc = "The name of the file containing the PCS data.",
283 wiz_filesel_style = wx.FD_OPEN
284 )
285 uf.add_keyarg(
286 name = "dir",
287 py_type = "str",
288 arg_type = "dir",
289 desc_short = "directory name",
290 desc = "The directory where the file is located.",
291 can_be_none = True
292 )
293 uf.add_keyarg(
294 name = "spin_id_col",
295 py_type = "int",
296 arg_type = "free format",
297 desc_short = "spin ID column",
298 desc = "The spin ID string column (an alternative to the mol, res, and spin name and number columns).",
299 can_be_none = True
300 )
301 uf.add_keyarg(
302 name = "mol_name_col",
303 py_type = "int",
304 arg_type = "free format",
305 desc_short = "molecule name column",
306 desc = "The molecule name column (alternative to the spin_id_col).",
307 can_be_none = True
308 )
309 uf.add_keyarg(
310 name = "res_num_col",
311 py_type = "int",
312 arg_type = "free format",
313 desc_short = "residue number column",
314 desc = "The residue number column (alternative to the spin_id_col).",
315 can_be_none = True
316 )
317 uf.add_keyarg(
318 name = "res_name_col",
319 py_type = "int",
320 arg_type = "free format",
321 desc_short = "residue name column",
322 desc = "The residue name column (alternative to the spin_id_col).",
323 can_be_none = True
324 )
325 uf.add_keyarg(
326 name = "spin_num_col",
327 py_type = "int",
328 arg_type = "free format",
329 desc_short = "spin number column",
330 desc = "The spin number column (alternative to the spin_id_col).",
331 can_be_none = True
332 )
333 uf.add_keyarg(
334 name = "spin_name_col",
335 py_type = "int",
336 arg_type = "free format",
337 desc_short = "spin name column",
338 desc = "The spin name column (alternative to the spin_id_col).",
339 can_be_none = True
340 )
341 uf.add_keyarg(
342 name = "data_col",
343 py_type = "int",
344 arg_type = "free format",
345 desc_short = "data column",
346 desc = "The PCS data column.",
347 can_be_none = True
348 )
349 uf.add_keyarg(
350 name = "error_col",
351 py_type = "int",
352 arg_type = "free format",
353 desc_short = "error column",
354 desc = "The experimental error column.",
355 can_be_none = True
356 )
357 uf.add_keyarg(
358 name = "sep",
359 py_type = "str",
360 arg_type = "free format",
361 desc_short = "column separator",
362 desc = "The column separator (the default is white space).",
363 can_be_none = True
364 )
365 uf.add_keyarg(
366 name = "spin_id",
367 py_type = "str",
368 desc_short = "spin ID string",
369 desc = "The spin ID string to restrict the loading of data to certain spin subsets.",
370 can_be_none = True
371 )
372
373 uf.desc.append(Desc_container())
374 uf.desc[-1].add_paragraph("This will read PCS data from a file and associate it with an alignment ID, either a new ID or a preexisting one with no PCS data.")
375 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 and name, and spin number and 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 can be used to restrict the reading to certain spin types, for example only 15N spins when only residue information is in the file.")
376
377 uf.desc.append(Desc_container("Prompt examples"))
378 uf.desc[-1].add_paragraph("The following commands will read the PCS data out of the file 'Tb.txt' where the columns are separated by the symbol ',', and store the PCSs under the ID 'Tb'.")
379 uf.desc[-1].add_prompt("relax> pcs.read('Tb', 'Tb.txt', sep=',')")
380 uf.desc[-1].add_paragraph("To read the 15N and 1H PCSs from the file 'Eu.txt', where the 15N values are in the 4th column and the 1H in the 9th, type both the following:")
381 uf.desc[-1].add_prompt("relax> pcs.read('Tb', 'Tb.txt', spin_id='@N', res_num_col=1, data_col=4)")
382 uf.desc[-1].add_prompt("relax> pcs.read('Tb', 'Tb.txt', spin_id='@H', res_num_col=1, data_col=9)")
383 uf.backend = pcs.read
384 uf.menu_text = "&read"
385 uf.gui_icon = "oxygen.actions.document-open"
386 uf.wizard_height_desc = 250
387 uf.wizard_size = (1000, 750)
388 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
389
390
391
392 uf = uf_info.add_uf('pcs.weight')
393 uf.title = "Set optimisation weights on the PCS data."
394 uf.title_short = "PCS weighting."
395 uf.add_keyarg(
396 name = "align_id",
397 py_type = "str",
398 desc_short = "alignment ID string",
399 desc = "The alignment ID string.",
400 wiz_element_type = 'combo',
401 wiz_combo_iter = align_tensor.get_ids,
402 wiz_read_only = True
403 )
404 uf.add_keyarg(
405 name = "spin_id",
406 py_type = "str",
407 desc_short = "spin ID string",
408 desc = "The spin ID string."
409 )
410 uf.add_keyarg(
411 name = "weight",
412 default = 1.0,
413 py_type = "num",
414 desc_short = "weight",
415 desc = "The weighting value."
416 )
417
418 uf.desc.append(Desc_container())
419 uf.desc[-1].add_paragraph("This can be used to force the PCS to contribute more or less to the chi-squared optimisation statistic. The higher the value, the more importance the PCS will have.")
420 uf.backend = pcs.weight
421 uf.menu_text = "wei&ght"
422 uf.wizard_size = (700, 500)
423 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
424
425
426
427 uf = uf_info.add_uf('pcs.write')
428 uf.title = "Write the PCS data to file."
429 uf.title_short = "PCS data writing."
430 uf.add_keyarg(
431 name = "align_id",
432 py_type = "str",
433 desc_short = "alignment ID string",
434 desc = "The alignment ID string.",
435 wiz_element_type = 'combo',
436 wiz_combo_iter = align_tensor.get_ids,
437 wiz_read_only = True
438 )
439 uf.add_keyarg(
440 name = "file",
441 py_type = "str",
442 arg_type = "file sel",
443 desc_short = "file name",
444 desc = "The name of the file.",
445 wiz_filesel_style = wx.FD_SAVE
446 )
447 uf.add_keyarg(
448 name = "dir",
449 py_type = "str",
450 arg_type = "dir",
451 desc_short = "directory name",
452 desc = "The directory name.",
453 can_be_none = True
454 )
455 uf.add_keyarg(
456 name = "bc",
457 default = False,
458 py_type = "bool",
459 desc_short = "back-calculation flag",
460 desc = "A flag which if set will write out the back-calculated rather than measured RDCs."
461 )
462 uf.add_keyarg(
463 name = "force",
464 default = False,
465 py_type = "bool",
466 desc_short = "force flag",
467 desc = "A flag which if True will cause the file to be overwritten."
468 )
469
470 uf.desc.append(Desc_container())
471 uf.desc[-1].add_paragraph("If no directory name is given, the file will be placed in the current working directory. The alignment ID is required for selecting which PCS data set will be written to file.")
472 uf.backend = pcs.write
473 uf.menu_text = "&write"
474 uf.gui_icon = "oxygen.actions.document-save"
475 uf.wizard_size = (800, 600)
476 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
477