1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """Module containing the 'relax_data' user function class."""
25 __docformat__ = 'plaintext'
26
27
28 from base_class import User_fn_class, _build_doc
29 import arg_check
30 from generic_fns import relax_data
31 from relax_errors import RelaxError
32
33
35 """Class for manipulating R1, R2, and NOE relaxation data."""
36
37 - def back_calc(self, ri_id=None, ri_type=None, frq=None):
38
39 if self._exec_info.intro:
40 text = self._exec_info.ps3 + "relax_data.back_calc("
41 text = text + "ri_id=" + repr(ri_id)
42 text = text + ", ri_type=" + repr(ri_type)
43 text = text + ", frq=" + repr(frq) + ")"
44 print(text)
45
46
47 arg_check.is_str(ri_id, 'relaxation ID string', can_be_none=True)
48 arg_check.is_str(ri_type, 'relaxation type', can_be_none=True)
49 arg_check.is_num(frq, 'frequency', can_be_none=True)
50
51
52 relax_data.back_calc(ri_id=ri_id, ri_type=ri_type, frq=frq)
53
54
55 back_calc._doc_title = "Back calculate the relaxation data at the given frequency."
56 back_calc._doc_title_short = "Relaxation data back calculation."
57 back_calc._doc_args = [
58 ["ri_id", "The relaxation data ID string."],
59 ["ri_type", "The relaxation data type, ie 'R1', 'R2', or 'NOE'."],
60 ["frq", "The spectrometer frequency in Hz."]
61 ]
62 back_calc._doc_desc = """
63 This allows relaxation data of the given type and frequency to be back calculated from the model parameter values.
64 """
65 _build_doc(back_calc)
66
67
68 - def copy(self, pipe_from=None, pipe_to=None, ri_id=None):
69
70 if self._exec_info.intro:
71 text = self._exec_info.ps3 + "relax_data.copy("
72 text = text + "pipe_from=" + repr(pipe_from)
73 text = text + ", pipe_to=" + repr(pipe_to)
74 text = text + ", ri_id=" + repr(ri_id) + ")"
75 print(text)
76
77
78 arg_check.is_str(pipe_from, 'pipe from', can_be_none=True)
79 arg_check.is_str(pipe_to, 'pipe to', can_be_none=True)
80 arg_check.is_str(ri_id, 'relaxation data ID string', can_be_none=True)
81
82
83 if pipe_from == None and pipe_to == None:
84 raise RelaxError("The pipe_from and pipe_to arguments cannot both be set to None.")
85
86
87 relax_data.copy(pipe_from=pipe_from, pipe_to=pipe_to, ri_id=ri_id)
88
89
90 copy._doc_title = "Copy relaxation data from one pipe to another."
91 copy._doc_title_short = "Relaxation data copying."
92 copy._doc_args = [
93 ["pipe_from", "The name of the pipe to copy the relaxation data from."],
94 ["pipe_to", "The name of the pipe to copy the relaxation data to."],
95 ["ri_id", "The relaxation data ID string."]
96 ]
97 copy._doc_desc = """
98 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.
99 """
100 copy._doc_examples = """
101 To copy all relaxation data from pipe 'm1' to pipe 'm9', type one of:
102
103 relax> relax_data.copy('m1', 'm9')
104 relax> relax_data.copy(pipe_from='m1', pipe_to='m9')
105 relax> relax_data.copy('m1', 'm9', None)
106 relax> relax_data.copy(pipe_from='m1', pipe_to='m9', ri_id=None)
107
108 To copy only the NOE relaxation data with the ID string of 'NOE_800' from 'm3' to 'm6', type
109 one of:
110
111 relax> relax_data.copy('m3', 'm6', 'NOE_800')
112 relax> relax_data.copy(pipe_from='m3', pipe_to='m6', ri_id='NOE_800')
113 """
114 _build_doc(copy)
115
116
117 - def delete(self, ri_id=None):
118
119 if self._exec_info.intro:
120 text = self._exec_info.ps3 + "relax_data.delete("
121 text = text + "ri_id=" + repr(ri_id) + ")"
122 print(text)
123
124
125 arg_check.is_str(ri_id, 'relaxation data ID string')
126
127
128 relax_data.delete(ri_id=ri_id)
129
130
131 delete._doc_title = "Delete the data corresponding to the relaxation data ID string."
132 delete._doc_title_short = "Relaxation data deletion."
133 delete._doc_args = [
134 ["ri_id", "The relaxation data ID string."]
135 ]
136 delete._doc_desc = """
137 The relaxation data corresponding to the given relaxation data ID string will be removed from the current data pipe.
138 """
139 delete._doc_examples = """
140 To delete the relaxation data corresponding to the ID 'NOE_600', type:
141
142 relax> relax_data.delete('NOE_600')
143 """
144 _build_doc(delete)
145
146
148
149 if self._exec_info.intro:
150 text = self._exec_info.ps3 + "relax_data.display("
151 text = text + "ri_id=" + repr(ri_id) + ")"
152 print(text)
153
154
155 arg_check.is_str(ri_id, 'relaxation data ID string')
156
157
158 relax_data.display(ri_id=ri_id)
159
160
161 display._doc_title = "Display the data corresponding to the relaxation data ID string."
162 display._doc_title_short = "Displaying relaxation data."
163 display._doc_args = [
164 ["ri_id", "The relaxation data ID string."]
165 ]
166 display._doc_examples = """
167 To display the NOE relaxation data at 600 MHz with the ID string 'NOE_600', type:
168
169 relax> relax_data.display('NOE_600')
170 """
171 _build_doc(display)
172
173
188
189
190 peak_intensity_type._doc_title = "Specify the type of peak intensity measurement used - i.e. height or volume."
191 peak_intensity_type._doc_title_short = "Setting peak intensity type."
192 peak_intensity_type._doc_args = [
193 ["ri_id", "The relaxation data ID string."],
194 ["type", "The peak intensity type."]
195 ]
196 peak_intensity_type._doc_desc = """
197 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 type argument are 'height' and 'volume'.
198 """
199 _build_doc(peak_intensity_type)
200
201
202 - def read(self, ri_id=None, ri_type=None, frq=None, file=None, dir=None, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, data_col=None, error_col=None, sep=None, spin_id=None):
203
204 if self._exec_info.intro:
205 text = self._exec_info.ps3 + "relax_data.read("
206 text = text + "ri_id=" + repr(ri_id)
207 text = text + ", ri_type=" + repr(ri_type)
208 text = text + ", frq=" + repr(frq)
209 text = text + ", file=" + repr(file)
210 text = text + ", dir=" + repr(dir)
211 text = text + ", spin_id_col=" + repr(spin_id_col)
212 text = text + ", mol_name_col=" + repr(mol_name_col)
213 text = text + ", res_num_col=" + repr(res_num_col)
214 text = text + ", res_name_col=" + repr(res_name_col)
215 text = text + ", spin_num_col=" + repr(spin_num_col)
216 text = text + ", spin_name_col=" + repr(spin_name_col)
217 text = text + ", data_col=" + repr(data_col)
218 text = text + ", error_col=" + repr(error_col)
219 text = text + ", sep=" + repr(sep)
220 text = text + ", spin_id=" + repr(spin_id) + ")"
221 print(text)
222
223
224 arg_check.is_str(ri_id, 'relaxation ID string')
225 arg_check.is_str(ri_type, 'relaxation type')
226 arg_check.is_num(frq, 'frequency')
227 arg_check.is_str(file, 'file name')
228 arg_check.is_str(dir, 'directory name', can_be_none=True)
229 arg_check.is_int(spin_id_col, 'spin ID string column', can_be_none=True)
230 arg_check.is_int(mol_name_col, 'molecule name column', can_be_none=True)
231 arg_check.is_int(res_num_col, 'residue number column', can_be_none=True)
232 arg_check.is_int(res_name_col, 'residue name column', can_be_none=True)
233 arg_check.is_int(spin_num_col, 'spin number column', can_be_none=True)
234 arg_check.is_int(spin_name_col, 'spin name column', can_be_none=True)
235 arg_check.is_int(data_col, 'data column')
236 arg_check.is_int(error_col, 'error column')
237 arg_check.is_str(sep, 'column separator', can_be_none=True)
238 arg_check.is_str(spin_id, 'spin ID string', can_be_none=True)
239
240
241 relax_data.read(ri_id=ri_id, ri_type=ri_type, frq=frq, file=file, dir=dir, spin_id_col=spin_id_col, mol_name_col=mol_name_col, res_num_col=res_num_col, res_name_col=res_name_col, spin_num_col=spin_num_col, spin_name_col=spin_name_col, data_col=data_col, error_col=error_col, sep=sep, spin_id=spin_id)
242
243
244 read._doc_title = "Read R1, R2, or NOE relaxation data from a file."
245 read._doc_title_short = "Reading relaxation data from file."
246 read._doc_args = [
247 ["ri_id", "The relaxation data ID string. This must be a unique identifier."],
248 ["ri_type", "The relaxation data type, i.e. 'R1', 'R2', or 'NOE'."],
249 ["frq", "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."],
250 ["file", "The name of the file containing the relaxation data."],
251 ["dir", "The directory where the file is located."],
252 ["spin_id_col", "The spin ID string column (an alternative to the mol, res, and spin name and number columns)."],
253 ["mol_name_col", "The molecule name column (alternative to the spin_id_col)."],
254 ["res_num_col", "The residue number column (alternative to the spin_id_col)."],
255 ["res_name_col", "The residue name column (alternative to the spin_id_col)."],
256 ["spin_num_col", "The spin number column (alternative to the spin_id_col)."],
257 ["spin_name_col", "The spin name column (alternative to the spin_id_col)."],
258 ["data_col", "The relaxation data column."],
259 ["error_col", "The experimental error column."],
260 ["sep", "The column separator (the default is white space)."],
261 ["spin_id", "The spin ID string to restrict the loading of data to certain spin subsets."]
262 ]
263 read._doc_desc = """
264 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.
265 """
266 read._doc_examples = """
267 The following commands will read the protein NOE relaxation data collected at 600 MHz out of
268 a file called 'noe.600.out' where the residue numbers, residue names, data, errors are in
269 the first, second, third, and forth columns respectively.
270
271 relax> relax_data.read('NOE_600', 'NOE', 599.7 * 1e6, 'noe.600.out', res_num_col=1,
272 res_name_col=2, data_col=3, error_col=4)
273 relax> relax_data.read(ri_id='NOE_600', ri_type='NOE', frq=600.0 * 1e6, file='noe.600.out',
274 res_num_col=1, res_name_col=2, data_col=3, error_col=4)
275
276
277 The following commands will read the R2 data out of the file 'r2.out' where the residue
278 numbers, residue names, data, errors are in the second, third, fifth, and sixth columns
279 respectively. The columns are separated by commas.
280
281 relax> relax_data.read('R2_800', 'R2', 8.0 * 1e8, 'r2.out', res_num_col=2, res_name_col=3,
282 data_col=5, error_col=6, sep=',')
283 relax> relax_data.read(ri_id='R2_800', ri_type='R2', frq=8.0*1e8, file='r2.out',
284 res_num_col=2, res_name_col=3, data_col=5, error_col=6, sep=',')
285
286
287 The following commands will read the R1 data out of the file 'r1.out' where the columns are
288 separated by the symbol '%'
289
290 relax> relax_data.read('R1_300', 'R1', 300.1 * 1e6, 'r1.out', sep='%')
291 """
292 _build_doc(read)
293
294
309
310
311 temp_calibration._doc_title = "Specify the temperature calibration method used."
312 temp_calibration._doc_title_short = "Setting temperature calibration method."
313 temp_calibration._doc_args = [
314 ["ri_id", "The relaxation data ID string."],
315 ["method", "The calibration method."]
316 ]
317 temp_calibration._doc_desc = """
318 This is essential for BMRB data deposition. The currently allowed methods are:
319
320 'methanol',
321 'monoethylene glycol',
322 'no calibration applied'.
323
324 Other strings will be accepted if supplied.
325 """
326 _build_doc(temp_calibration)
327
328
343
344
345 temp_control._doc_title = "Specify the temperature control method used."
346 temp_control._doc_title_short = "Setting temperature control method."
347 temp_control._doc_args = [
348 ["ri_id", "The relaxation data ID string."],
349 ["method", "The control method."]
350 ]
351 temp_control._doc_desc = """
352 This is essential for BMRB data deposition. The currently allowed methods are:
353
354 'single scan interleaving',
355 'temperature compensation block',
356 'single scan interleaving and temperature compensation block',
357 'single fid interleaving',
358 'single experiment interleaving',
359 'no temperature control applied'.
360 """
361 _build_doc(temp_control)
362
363
364 - def write(self, ri_id=None, file=None, dir=None, bc=False, force=False):
365
366 if self._exec_info.intro:
367 text = self._exec_info.ps3 + "relax_data.write("
368 text = text + "ri_id=" + repr(ri_id)
369 text = text + ", file=" + repr(file)
370 text = text + ", dir=" + repr(dir)
371 text = text + ", bc=" + repr(bc)
372 text = text + ", force=" + repr(force) + ")"
373 print(text)
374
375
376 arg_check.is_str(ri_id, 'relaxation data ID string')
377 arg_check.is_str(file, 'file name')
378 arg_check.is_str(dir, 'directory name', can_be_none=True)
379 arg_check.is_bool(bc, 'back calculated data flag')
380 arg_check.is_bool(force, 'force flag')
381
382
383 relax_data.write(ri_id=ri_id, file=file, dir=dir, bc=bc, force=force)
384
385
386 write._doc_title = "Write relaxation data to a file."
387 write._doc_title_short = "Relaxation data writing."
388 write._doc_args = [
389 ["ri_id", "The relaxation data ID string."],
390 ["file", "The name of the file."],
391 ["dir", "The directory name."],
392 ["force", "A flag which if True will cause the file to be overwritten."]
393 ]
394 write._doc_desc = """
395 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.
396 """
397 _build_doc(write)
398