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 spectrum user function definitions."""
25
26
27 from os import sep
28 import dep_check
29 if dep_check.wx_module:
30 from wx import FD_OPEN
31 else:
32 FD_OPEN = -1
33
34
35 from graphics import WIZARD_IMAGE_PATH
36 from pipe_control import spectrum
37 from user_functions.data import Uf_info; uf_info = Uf_info()
38 from user_functions.data import Uf_tables; uf_tables = Uf_tables()
39 from user_functions.objects import Desc_container
40 from user_functions.wildcards import WILDCARD_SPECTRUM_PEAKLIST
41
42
43
44 uf_class = uf_info.add_class('spectrum')
45 uf_class.title = "Class for supporting the input of spectral data."
46 uf_class.menu_text = "&spectrum"
47 uf_class.gui_icon = "relax.fid"
48
49
50
51 uf = uf_info.add_uf('spectrum.baseplane_rmsd')
52 uf.title = "Set the baseplane RMSD of a given spin in a spectrum for error analysis."
53 uf.title_short = "Baseplane RMSD setting."
54 uf.add_keyarg(
55 name = "error",
56 default = 0.0,
57 py_type = "num",
58 desc_short = "error",
59 desc = "The baseplane RMSD error value."
60 )
61 uf.add_keyarg(
62 name = "spectrum_id",
63 py_type = "str",
64 desc_short = "spectrum ID string",
65 desc = "The spectrum ID string.",
66 wiz_element_type = 'combo',
67 wiz_combo_iter = spectrum.get_ids,
68 wiz_read_only = True
69 )
70 uf.add_keyarg(
71 name = "spin_id",
72 py_type = "str",
73 desc_short = "spin ID string",
74 desc = "The spin ID string.",
75 can_be_none = True
76 )
77
78 uf.desc.append(Desc_container())
79 uf.desc[-1].add_paragraph("The spectrum ID identifies the spectrum associated with the error and must correspond to a previously loaded set of intensities. If the spin ID is unset, then the error value for all spins will be set to the supplied value.")
80 uf.backend = spectrum.baseplane_rmsd
81 uf.menu_text = "&baseplane_rmsd"
82 uf.gui_icon = "oxygen.actions.edit-rename"
83 uf.wizard_size = (800, 500)
84 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
85
86
87
88 uf = uf_info.add_uf('spectrum.delete')
89 uf.title = "Delete the spectral data corresponding to the spectrum ID string."
90 uf.title_short = "Spectral data deletion."
91 uf.add_keyarg(
92 name = "spectrum_id",
93 py_type = "str",
94 desc_short = "spectrum ID string",
95 desc = "The unique spectrum ID string.",
96 wiz_element_type = 'combo',
97 wiz_combo_iter = spectrum.get_ids,
98 wiz_read_only = True
99 )
100
101 uf.desc.append(Desc_container())
102 uf.desc[-1].add_paragraph("The spectral data corresponding to the given spectrum ID string will be removed from the current data pipe.")
103
104 uf.desc.append(Desc_container("Prompt examples"))
105 uf.desc[-1].add_paragraph("To delete the peak height data corresponding to the ID 'R1 ncyc5', type:")
106 uf.desc[-1].add_prompt("relax> spectrum.delete('R1 ncyc5')")
107 uf.backend = spectrum.delete
108 uf.menu_text = "&delete"
109 uf.gui_icon = "oxygen.actions.list-remove"
110 uf.wizard_size = (700, 400)
111 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
112
113
114
115 uf = uf_info.add_uf('spectrum.error_analysis')
116 uf.title = "Perform an error analysis for peak intensities."
117 uf.title_short = "Peak intensity error analysis."
118 uf.add_keyarg(
119 name = "subset",
120 py_type = "str_list",
121 desc_short = "subset spectrum IDs",
122 desc = "The list of spectrum ID strings to restrict the error analysis to.",
123 wiz_combo_iter = spectrum.get_ids,
124 wiz_read_only = True,
125 can_be_none = True
126 )
127
128 uf.desc.append(Desc_container())
129 uf.desc[-1].add_paragraph("This user function must only be called after all peak intensities have been loaded and all other necessary spectral information set. This includes the baseplane RMSD and the number of points used in volume integration, both of which are only used if spectra have not been replicated.")
130 uf.desc[-1].add_paragraph("The error analysis can be restricted to a subset of the loaded spectral data. This is useful, for example, if half the spectra have been collected on one spectrometer and the other half on a different spectrometer.")
131 uf.desc[-1].add_paragraph("Six different types of error analysis are supported depending on whether peak heights or volumes are supplied, whether noise is determined from replicated spectra or the RMSD of the baseplane noise, and whether all spectra or only a subset have been duplicated. These are:")
132 table = uf_tables.add_table(label="table: peak intensity error analysis", caption="The six peak intensity error analysis types.")
133 table.add_headings(["Int type", "Noise source", "Error scope"])
134 table.add_row(["Heights", "RMSD baseplane", "One sigma per peak per spectrum"])
135 table.add_row(["Heights", "Partial duplicate + variance averaging", "One sigma for all peaks, all spectra"])
136 table.add_row(["Heights", "All replicated + variance averaging", "One sigma per replicated spectra set"])
137 table.add_row(["Volumes", "RMSD baseplane", "One sigma per peak per spectrum"])
138 table.add_row(["Volumes", "Partial duplicate + variance averaging", "One sigma for all peaks, all spectra"])
139 table.add_row(["Volumes", "All replicated + variance averaging", "One sigma per replicated spectra set"])
140 uf.desc[-1].add_table(table.label)
141
142 uf.desc.append(Desc_container("Peak heights with baseplane noise RMSD"))
143 uf.desc[-1].add_paragraph("When none of the spectra have been replicated, then the peak height errors are calculated using the RMSD of the baseplane noise, the value of which is set by the spectrum.baseplane_rmsd user function. This results in a different error per peak per spectrum. The standard deviation error measure for the peak height, sigma_I, is set to the RMSD value.")
144
145 uf.desc.append(Desc_container("Peak heights with partially replicated spectra"))
146 uf.desc[-1].add_paragraph("When spectra are replicated, the variance for a single spin at a single replicated spectra set is calculated by the formula")
147 uf.desc[-1].add_item_list_element(None, "sigma^2 = sum({Ii - Iav}^2) / (n - 1),")
148 uf.desc[-1].add_paragraph("where sigma^2 is the variance, sigma is the standard deviation, n is the size of the replicated spectra set with i being the corresponding index, Ii is the peak intensity for spectrum i, and Iav is the mean over all spectra i.e. the sum of all peak intensities divided by n.")
149 uf.desc[-1].add_paragraph("As the value of n in the above equation is always very low since normally only a couple of spectra are collected per replicated spectra set, the variance of all spins is averaged for a single replicated spectra set. Although this results in all spins having the same error, the accuracy of the error estimate is significantly improved.")
150 uf.desc[-1].add_paragraph("If there are in addition to the replicated spectra loaded peak intensities which only consist of a single spectrum, i.e. not all spectra are replicated, then the variances of replicated replicated spectra sets will be averaged. This will be used for the entire experiment so that there will be only a single error value for all spins and for all spectra.")
151
152 uf.desc.append(Desc_container("Peak heights with all spectra replicated"))
153 uf.desc[-1].add_paragraph("If all spectra are collected in duplicate (triplicate or higher number of spectra are supported), the each replicated spectra set will have its own error estimate. The error for a single peak is calculated as when partially replicated spectra are collected, and these are again averaged to give a single error per replicated spectra set. However as all replicated spectra sets will have their own error estimate, variance averaging across all spectra sets will not be performed.")
154
155 uf.desc.append(Desc_container("Peak volumes with baseplane noise RMSD"))
156 uf.desc[-1].add_paragraph("The method of error analysis when no spectra have been replicated and peak volumes are used is highly dependent on the integration method. Many methods simply sum the number of points within a fixed region, either a box or oval object. The number of points used, N, must be specified by another user function in this class. Then the error is simply given by the sum of variances:")
157 uf.desc[-1].add_item_list_element(None, "sigma_vol^2 = sigma_i^2 * N,")
158 uf.desc[-1].add_paragraph("where sigma_vol is the standard deviation of the volume, sigma_i is the standard deviation of a single point assumed to be equal to the RMSD of the baseplane noise, and N is the total number of points used in the summation integration method. For a box integration method, this converts to the Nicholson, Kay, Baldisseri, Arango, Young, Bax, and Torchia (1992) Biochemistry, 31: 5253-5263 equation:")
159 uf.desc[-1].add_item_list_element(None, "sigma_vol = sigma_i * sqrt(n*m),")
160 uf.desc[-1].add_paragraph("where n and m are the dimensions of the box. Note that a number of programs, for example peakint (http://hugin.ethz.ch/wuthrich/software/xeasy/xeasy_m15.html) does not use all points within the box. And if the number N can not be determined, this category of error analysis is not possible.")
161 uf.desc[-1].add_paragraph("Also note that non-point summation methods, for example when line shape fitting is used to determine peak volumes, the equations above cannot be used. Hence again this category of error analysis cannot be used. This is the case for one of the three integration methods used by Sparky (http://www.cgl.ucsf.edu/home/sparky/manual/peaks.html#Integration). And if fancy techniques are used, for example as Cara does to deconvolute overlapping peaks (http://www.cara.ethz.ch/Wiki/Integration), this again makes this error analysis impossible.")
162
163 uf.desc.append(Desc_container("Peak volumes with partially replicated spectra"))
164 uf.desc[-1].add_paragraph("When peak volumes are measured by any integration method and a few of the spectra are replicated, then the intensity errors are calculated identically as described in the 'Peak heights with partially replicated spectra' section above.")
165
166 uf.desc.append(Desc_container("Peak volumes with all spectra replicated"))
167 uf.desc[-1].add_paragraph("With all spectra replicated and again using any integration methodology, the intensity errors can be calculated as described in the 'Peak heights with all spectra replicated' section above.")
168 uf.backend = spectrum.error_analysis
169 uf.menu_text = "&error_analysis"
170 uf.gui_icon = "oxygen.categories.applications-education"
171 uf.wizard_height_desc = 530
172 uf.wizard_size = (1000, 700)
173 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
174 uf.wizard_apply_button = False
175
176
177
178 uf = uf_info.add_uf('spectrum.error_analysis_per_field')
179 uf.title = "Use spectrum IDs per each field strength for an error analysis for peak intensities."
180 uf.title_short = "Per field strength peak intensity error analysis."
181
182 uf.desc.append(Desc_container())
183 uf.desc[-1].add_paragraph("Please see the spectrum.error_analysis user function documentation.")
184 uf.desc[-1].add_paragraph("This user function will collect all spectrum IDs for each field strength separately, and call the spectrum.error_analysis with these.")
185 uf.desc[-1].add_paragraph("This function is meant as a short-cut for the spectrum.error_analysis function.")
186
187 uf.desc.append(Desc_container("Prompt examples"))
188 uf.desc[-1].add_paragraph("To collect all spectrum IDs per field strength, and perform peak intensity error analysis:")
189 uf.desc[-1].add_prompt("relax> spectrum.error_analysis_per_field()")
190 uf.backend = spectrum.error_analysis_per_field
191 uf.menu_text = "&error_analysis_per_field"
192 uf.gui_icon = "oxygen.categories.applications-education"
193 uf.wizard_height_desc = 530
194 uf.wizard_size = (1000, 700)
195 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
196 uf.wizard_apply_button = False
197
198
199
200 uf = uf_info.add_uf('spectrum.integration_points')
201 uf.title = "Set the number of summed points used in volume integration of a given spin in a spectrum."
202 uf.title_short = "Number of integration points."
203 uf.add_keyarg(
204 name = "N",
205 py_type = "int",
206 min = 1,
207 max = 10000000,
208 desc_short = "number of summed points",
209 desc = "The number of points used by the summation volume integration method."
210 )
211 uf.add_keyarg(
212 name = "spectrum_id",
213 py_type = "str",
214 desc_short = "spectrum ID string",
215 desc = "The spectrum ID string.",
216 wiz_element_type = 'combo',
217 wiz_combo_iter = spectrum.get_ids,
218 wiz_read_only = True
219 )
220 uf.add_keyarg(
221 name = "spin_id",
222 py_type = "str",
223 desc_short = "spin ID string",
224 desc = "Restrict setting the number to certain spins.",
225 can_be_none = True
226 )
227
228 uf.desc.append(Desc_container())
229 uf.desc[-1].add_paragraph("For a complete description of which integration methods and how many points N are used for different integration techniques, please see the spectrum.error_analysis user function documentation.")
230 uf.desc[-1].add_paragraph("The spectrum ID identifies the spectrum associated with the value of N and must correspond to a previously loaded set of intensities. If the spin ID is unset, then the number of summed points for all spins will be set to the supplied value.")
231 uf.backend = spectrum.integration_points
232 uf.menu_text = "&integration_points"
233 uf.gui_icon = "oxygen.actions.edit-rename"
234 uf.wizard_size = (900, 600)
235 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
236
237
238
239 uf = uf_info.add_uf('spectrum.read_intensities')
240 uf.title = "Read peak intensities from a file."
241 uf.title_short = "Peak intensity reading."
242 uf.add_keyarg(
243 name = "file",
244 py_type = "str_or_str_list",
245 arg_type = "file sel multi",
246 desc_short = "file name(s)",
247 desc = "The name of the file or the list of files containing the intensity data.",
248 wiz_filesel_wildcard = WILDCARD_SPECTRUM_PEAKLIST,
249 wiz_filesel_style = FD_OPEN
250 )
251 uf.add_keyarg(
252 name = "dir",
253 py_type = "str",
254 arg_type = "dir",
255 desc_short = "directory name",
256 desc = "The directory where the file is located.",
257 can_be_none = True
258 )
259 uf.add_keyarg(
260 name = "spectrum_id",
261 py_type = "str_or_str_list",
262 desc_short = "spectrum ID string",
263 desc = "The unique spectrum ID string or list of strings to associate with the peak intensity values. If multiple files are given, then each file should have a corresponding spectrum ID string. If 'auto' is provided for a NMRPipe seriesTab formatted file, the IDs are auto generated in form of Z_A{i}."
264 )
265 uf.add_keyarg(
266 name = "dim",
267 default = 1,
268 py_type = "int",
269 min = 1,
270 desc_short = "spectral dimension to read",
271 desc = "Associate the data with the spins of any dimension in the peak list. This defaults to w1, the heteronucleus in HSQC type experiments."
272 )
273 uf.add_keyarg(
274 name = "int_method",
275 default = "height",
276 py_type = "str",
277 desc_short = "peak integration method",
278 desc = "The method by which peaks were integrated.",
279 wiz_element_type = "combo",
280 wiz_combo_choices = ["height", "point sum", "other"],
281 wiz_read_only = True
282 )
283 uf.add_keyarg(
284 name = "int_col",
285 py_type = "int_or_int_list",
286 desc_short = "intensity column",
287 desc = "The optional column containing the peak intensity data (used by the generic intensity file format, or if the intensities are in a non-standard column).",
288 can_be_none = True
289 )
290 uf.add_keyarg(
291 name = "spin_id_col",
292 py_type = "int",
293 arg_type = "free format",
294 desc_short = "spin ID string column",
295 desc = "The spin ID string column used by the generic intensity file format (an alternative to the mol, res, and spin name and number columns).",
296 can_be_none = True
297 )
298 uf.add_keyarg(
299 name = "mol_name_col",
300 py_type = "int",
301 arg_type = "free format",
302 desc_short = "molecule name column",
303 desc = "The molecule name column used by the generic intensity file format (alternative to the spin ID column).",
304 can_be_none = True
305 )
306 uf.add_keyarg(
307 name = "res_num_col",
308 py_type = "int",
309 arg_type = "free format",
310 desc_short = "residue number column",
311 desc = "The residue number column used by the generic intensity file format (alternative to the spin ID column).",
312 can_be_none = True
313 )
314 uf.add_keyarg(
315 name = "res_name_col",
316 py_type = "int",
317 arg_type = "free format",
318 desc_short = "residue name column",
319 desc = "The residue name column used by the generic intensity file format (alternative to the spin ID column).",
320 can_be_none = True
321 )
322 uf.add_keyarg(
323 name = "spin_num_col",
324 py_type = "int",
325 arg_type = "free format",
326 desc_short = "spin number column",
327 desc = "The spin number column used by the generic intensity file format (alternative to the spin ID column).",
328 can_be_none = True
329 )
330 uf.add_keyarg(
331 name = "spin_name_col",
332 py_type = "int",
333 arg_type = "free format",
334 desc_short = "spin name column",
335 desc = "The spin name column used by the generic intensity file format (alternative to the spin ID column).",
336 can_be_none = True
337 )
338 uf.add_keyarg(
339 name = "sep",
340 py_type = "str",
341 arg_type = "free format",
342 desc_short = "column separator",
343 desc = "The column separator used by the generic intensity format (the default is white space).",
344 can_be_none = True
345 )
346 uf.add_keyarg(
347 name = "spin_id",
348 py_type = "str",
349 desc_short = "spin ID string",
350 desc = "The spin ID string used to restrict the loading of data to certain spin subsets.",
351 can_be_none = True
352 )
353 uf.add_keyarg(
354 name = "ncproc",
355 py_type = "int",
356 desc_short = "Bruker ncproc parameter",
357 desc = "The Bruker specific FID intensity scaling factor.",
358 can_be_none = True
359 )
360
361 uf.desc.append(Desc_container())
362 uf.desc[-1].add_paragraph("The peak intensity can either be from peak heights or peak volumes.")
363 uf.desc[-1].add_paragraph("The spectrum ID is a label which is subsequently utilised by other user functions. If this identifier matches that of a previously loaded set of intensities, then this indicates a replicated spectrum.")
364 uf.desc[-1].add_paragraph("The spectral dimension is used to specify if the intensity data should be loaded into the spins identified by the first dimension w1, second dimension w2, etc.")
365 uf.desc[-1].add_paragraph("The integration method is required for the subsequent error analysis. When peak heights are measured, this should be set to 'height'. Volume integration methods are a bit varied and hence two values are accepted. If the volume integration involves pure point summation, with no deconvolution algorithms or other methods affecting peak heights, then the value should be set to 'point sum'. All other volume integration methods, e.g. line shape fitting, the value should be set to 'other'.")
366 uf.desc[-1].add_paragraph("If a series of intensities extracted from Bruker FID files processed in Topspin or XWinNMR are to be compared, the ncproc parameter may need to be supplied. This is because this FID is stored using integer representation and is scaled using ncproc to avoid numerical truncation artifacts. If two spectra have significantly different maximal intensities, then ncproc will be different for both. The intensity scaling is binary, i.e. 2**ncproc. Therefore if spectrum A has an ncproc of 6 and and spectrum B a value of 7, then a reference intensity in B will be double that of A. Internally, relax stores the intensities scaled by 2**ncproc.")
367
368 uf.desc.append(Desc_container("File formats"))
369 uf.desc[-1].add_paragraph("The peak list or intensity file will be automatically determined.")
370 uf.desc[-1].add_paragraph("Sparky peak list: The file should be a Sparky peak list saved after typing the command 'lt'. The default is to assume that columns 0, 1, 2, and 3 (1st, 2nd, 3rd, and 4th) contain the Sparky assignment, w1, w2, and peak intensity data respectively. The frequency data w1 and w2 are ignored while the peak intensity data can either be the peak height or volume displayed by changing the window options. If the peak intensity data is not within column 3, set the integration column to the appropriate number (column numbering starts from 0 rather than 1).")
371 uf.desc[-1].add_paragraph("XEasy peak list: The file should be the saved XEasy text window output of the list peak entries command, 'tw' followed by 'le'. As the columns are fixed, the peak intensity column is hardwired to number 10 (the 11th column) which contains either the peak height or peak volume data. Because the columns are fixed, the integration column number will be ignored.")
372 uf.desc[-1].add_paragraph("NMRView: The file should be a NMRView peak list. The default is to use column 16 (which contains peak heights) for peak intensities. To use use peak volumes (or evolumes), int_col must be set to 15.")
373 uf.desc[-1].add_paragraph("NMRPipe seriesTab: The file should be a NMRPipe-format Spectral Series list. If the spectrum_id='auto', the IDs are auto generated in form of Z_A{i}.")
374 uf.desc[-1].add_paragraph("Generic intensity file: This is a generic format which can be created by scripting to support non-supported peak lists. It should contain in the first few columns enough information to identify the spin. This can include columns for the molecule name, residue number, residue name, spin number, and spin name. Alternatively a spin ID string column can be used. The peak intensities can be placed in another column specified by the integration column number. Intensities from multiple spectra can be placed into different columns, and these can then be specified simultaneously by setting the integration column value to a list of columns. This list must be matched by setting the spectrum ID to a list of the same length. If columns are delimited by a character other than whitespace, this can be specified with the column separator. The spin ID can be used to restrict the loading to specific spin subsets.")
375 uf.desc.append(Desc_container("Multiple files"))
376 uf.desc[-1].add_paragraph("The data from multiple files can be loaded simultaneously if a list of files is supplied. In this case, a list of spectrum ID strings of equal length must be supplied.")
377
378 uf.desc.append(Desc_container("Prompt examples"))
379 uf.desc[-1].add_paragraph("To read the reference and saturated spectra peak heights from the Sparky formatted files 'ref.list' and 'sat.list', type:")
380 uf.desc[-1].add_prompt("relax> spectrum.read_intensities(file='ref.list', spectrum_id='ref')")
381 uf.desc[-1].add_prompt("relax> spectrum.read_intensities(file='sat.list', spectrum_id='sat')")
382 uf.desc[-1].add_paragraph("To read the reference and saturated spectra peak heights from the XEasy formatted files 'ref.text' and 'sat.text', type:")
383 uf.desc[-1].add_prompt("relax> spectrum.read_intensities(file='ref.text', spectrum_id='ref')")
384 uf.desc[-1].add_prompt("relax> spectrum.read_intensities(file='sat.text', spectrum_id='sat')")
385 uf.backend = spectrum.read
386 uf.menu_text = "&read_intensities"
387 uf.gui_icon = "oxygen.actions.document-open"
388 uf.wizard_height_desc = 300
389 uf.wizard_size = (1000, 750)
390 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
391
392
393
394 uf = uf_info.add_uf('spectrum.read_spins')
395 uf.title = "Read peak assignments from a file and create spins."
396 uf.title_short = "Peak assignments reading."
397 uf.add_keyarg(
398 name = "file",
399 py_type = "str",
400 arg_type = "file sel",
401 desc_short = "file name",
402 desc = "The name of the file containing the intensity data.",
403 wiz_filesel_wildcard = WILDCARD_SPECTRUM_PEAKLIST,
404 wiz_filesel_style = FD_OPEN
405 )
406 uf.add_keyarg(
407 name = "dir",
408 py_type = "str",
409 arg_type = "dir",
410 desc_short = "directory name",
411 desc = "The directory where the file is located.",
412 can_be_none = True
413 )
414 uf.add_keyarg(
415 name = "dim",
416 default = 1,
417 py_type = "int",
418 min = 1,
419 desc_short = "spectral dimension to read",
420 desc = "Associate the data with the spins of any dimension in the peak list. This defaults to w1, the heteronucleus in HSQC type experiments."
421 )
422 uf.add_keyarg(
423 name = "spin_id_col",
424 py_type = "int",
425 arg_type = "free format",
426 desc_short = "spin ID string column",
427 desc = "The spin ID string column used by the generic intensity file format (an alternative to the mol, res, and spin name and number columns).",
428 can_be_none = True
429 )
430 uf.add_keyarg(
431 name = "mol_name_col",
432 py_type = "int",
433 arg_type = "free format",
434 desc_short = "molecule name column",
435 desc = "The molecule name column used by the generic intensity file format (alternative to the spin ID column).",
436 can_be_none = True
437 )
438 uf.add_keyarg(
439 name = "res_num_col",
440 py_type = "int",
441 arg_type = "free format",
442 desc_short = "residue number column",
443 desc = "The residue number column used by the generic intensity file format (alternative to the spin ID column).",
444 can_be_none = True
445 )
446 uf.add_keyarg(
447 name = "res_name_col",
448 py_type = "int",
449 arg_type = "free format",
450 desc_short = "residue name column",
451 desc = "The residue name column used by the generic intensity file format (alternative to the spin ID column).",
452 can_be_none = True
453 )
454 uf.add_keyarg(
455 name = "spin_num_col",
456 py_type = "int",
457 arg_type = "free format",
458 desc_short = "spin number column",
459 desc = "The spin number column used by the generic intensity file format (alternative to the spin ID column).",
460 can_be_none = True
461 )
462 uf.add_keyarg(
463 name = "spin_name_col",
464 py_type = "int",
465 arg_type = "free format",
466 desc_short = "spin name column",
467 desc = "The spin name column used by the generic intensity file format (alternative to the spin ID column).",
468 can_be_none = True
469 )
470 uf.add_keyarg(
471 name = "sep",
472 py_type = "str",
473 arg_type = "free format",
474 desc_short = "column separator",
475 desc = "The column separator used by the generic intensity format (the default is white space).",
476 can_be_none = True
477 )
478 uf.add_keyarg(
479 name = "spin_id",
480 py_type = "str",
481 desc_short = "spin ID string",
482 desc = "The spin ID string used to restrict the loading of data to certain spin subsets.",
483 can_be_none = True
484 )
485
486 uf.desc.append(Desc_container())
487 uf.desc[-1].add_paragraph("The spectral dimension is used to specify if the intensity data should be loaded into the spins identified by the first dimension w1, second dimension w2, etc.")
488
489 uf.desc.append(Desc_container("File formats"))
490 uf.desc[-1].add_paragraph("The peak list or intensity file will be automatically determined.")
491 uf.desc[-1].add_paragraph("Sparky peak list: The file should be a Sparky peak list saved after typing the command 'lt'. The default is to assume that columns 0, 1, 2, and 3 (1st, 2nd, 3rd, and 4th) contain the Sparky assignment, w1, w2, and peak intensity data respectively. The frequency data w1 and w2 are ignored while the peak intensity data can either be the peak height or volume displayed by changing the window options. If the peak intensity data is not within column 3, set the integration column to the appropriate number (column numbering starts from 0 rather than 1).")
492 uf.desc[-1].add_paragraph("XEasy peak list: The file should be the saved XEasy text window output of the list peak entries command, 'tw' followed by 'le'. As the columns are fixed, the peak intensity column is hardwired to number 10 (the 11th column) which contains either the peak height or peak volume data. Because the columns are fixed, the integration column number will be ignored.")
493 uf.desc[-1].add_paragraph("NMRView: The file should be a NMRView peak list. The default is to use column 16 (which contains peak heights) for peak intensities. To use use peak volumes (or evolumes), int_col must be set to 15.")
494 uf.desc[-1].add_paragraph("NMRPipe seriesTab: The file should be a NMRPipe-format Spectral Series list. If the spectrum_id='auto', the IDs are auto generated in form of Z_A{i}.")
495 uf.desc[-1].add_paragraph("Generic intensity file: This is a generic format which can be created by scripting to support non-supported peak lists. It should contain in the first few columns enough information to identify the spin. This can include columns for the molecule name, residue number, residue name, spin number, and spin name. Alternatively a spin ID string column can be used. The peak intensities can be placed in another column specified by the integration column number. Intensities from multiple spectra can be placed into different columns, and these can then be specified simultaneously by setting the integration column value to a list of columns. This list must be matched by setting the spectrum ID to a list of the same length. If columns are delimited by a character other than whitespace, this can be specified with the column separator. The spin ID can be used to restrict the loading to specific spin subsets.")
496
497 uf.desc.append(Desc_container("Prompt examples"))
498 uf.desc[-1].add_paragraph("To read the spin assignments from the Sparky formatted files 'ref.list' and 'sat.list', type:")
499 uf.desc[-1].add_prompt("relax> spectrum.read_spins(file='ref.list')")
500 uf.desc[-1].add_prompt("relax> spectrum.read_spins(file='sat.list')")
501 uf.desc[-1].add_paragraph("To read the spin assignments from the XEasy formatted files 'ref.text' and 'sat.text', type:")
502 uf.desc[-1].add_prompt("relax> spectrum.read_spins(file='ref.text')")
503 uf.desc[-1].add_prompt("relax> spectrum.read_spins(file='sat.text')")
504 uf.backend = spectrum.read_spins
505 uf.menu_text = "&read_spins"
506 uf.gui_icon = "oxygen.actions.document-open"
507 uf.wizard_height_desc = 300
508 uf.wizard_size = (1000, 750)
509 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
510
511
512
513 uf = uf_info.add_uf('spectrum.replicated')
514 uf.title = "Specify which spectra are replicates of each other."
515 uf.title_short = "Replicate spectra."
516 uf.add_keyarg(
517 name = "spectrum_ids",
518 py_type = "str_or_str_list",
519 desc_short = "spectrum ID strings",
520 desc = "The list of replicated spectra ID strings.",
521 wiz_element_type = 'combo_list',
522 wiz_combo_iter = spectrum.get_ids,
523 wiz_combo_list_min = 2,
524 wiz_read_only = True
525 )
526
527 uf.desc.append(Desc_container())
528 uf.desc[-1].add_paragraph("This is used to identify which of the loaded spectra are replicates of each other. Specifying the replicates is essential for error analysis if the baseplane RMSD has not been supplied.")
529
530 uf.desc.append(Desc_container("Prompt examples"))
531 uf.desc[-1].add_paragraph("To specify that the NOE spectra labelled 'ref1', 'ref2', and 'ref3' are the same spectrum replicated, type one of:")
532 uf.desc[-1].add_prompt("relax> spectrum.replicated(['ref1', 'ref2', 'ref3'])")
533 uf.desc[-1].add_prompt("relax> spectrum.replicated(spectrum_ids=['ref1', 'ref2', 'ref3'])")
534 uf.desc[-1].add_paragraph("To specify that the two R2 spectra 'ncyc2' and 'ncyc2b' are the same time point, type:")
535 uf.desc[-1].add_prompt("relax> spectrum.replicated(['ncyc2', 'ncyc2b'])")
536 uf.backend = spectrum.replicated
537 uf.menu_text = "re&plicated"
538 uf.gui_icon = "oxygen.actions.edit-rename"
539 uf.wizard_size = (700, 500)
540 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
541
542
543
544 uf = uf_info.add_uf('spectrum.sn_ratio')
545 uf.title = "Calculate the signal to noise ratio for all selected spins."
546 uf.title_short = "Signal to noise calculation."
547
548 uf.desc.append(Desc_container())
549 uf.desc[-1].add_paragraph("This user function will per spin calculate the signal to noise ratio: S/N.")
550
551 uf.desc.append(Desc_container("Prompt examples"))
552 uf.desc[-1].add_paragraph("To calculate the Signal to Noise ratio per spin.")
553 uf.desc[-1].add_prompt("relax> spectrum.sn_ratio()")
554 uf.backend = spectrum.signal_noise_ratio
555 uf.menu_text = "&sn_ratio"
556 uf.gui_icon = "relax.fid"
557 uf.wizard_size = (600, 400)
558 uf.wizard_image = WIZARD_IMAGE_PATH + 'spectrum' + sep + 'spectrum_200.png'
559 uf.wizard_apply_button = False
560