Package prompt :: Module relax_data
[hide private]
[frames] | no frames]

Source Code for Module prompt.relax_data

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003-2011 Edward d'Auvergne                                   # 
  4  #                                                                             # 
  5  # This file is part of the program relax.                                     # 
  6  #                                                                             # 
  7  # relax is free software; you can redistribute it and/or modify               # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation; either version 2 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # relax is distributed in the hope that it will be useful,                    # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with relax; if not, write to the Free Software                        # 
 19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  # Module docstring. 
 24  """Module containing the 'relax_data' user function class.""" 
 25  __docformat__ = 'plaintext' 
 26   
 27  # relax module imports. 
 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   
34 -class Relax_data(User_fn_class):
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 # Function intro text. 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 # The argument checks. 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 # Execute the functional code. 52 relax_data.back_calc(ri_id=ri_id, ri_type=ri_type, frq=frq)
53 54 # The function doc info. 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 # Function intro text. 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 # The argument checks. 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 # Both pipe arguments cannot be None. 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 # Execute the functional code. 87 relax_data.copy(pipe_from=pipe_from, pipe_to=pipe_to, ri_id=ri_id)
88 89 # The function doc info. 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 # Function intro text. 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 # The argument checks. 125 arg_check.is_str(ri_id, 'relaxation data ID string') 126 127 # Execute the functional code. 128 relax_data.delete(ri_id=ri_id)
129 130 # The function doc info. 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
147 - def display(self, ri_id=None):
148 # Function intro text. 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 # The argument checks. 155 arg_check.is_str(ri_id, 'relaxation data ID string') 156 157 # Execute the functional code. 158 relax_data.display(ri_id=ri_id)
159 160 # The function doc info. 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
174 - def peak_intensity_type(self, ri_id=None, type=None):
175 # Function intro text. 176 if self._exec_info.intro: 177 text = self._exec_info.ps3 + "relax_data.peak_intensity_type(" 178 text = text + "ri_id=" + repr(ri_id) 179 text = text + ", type=" + repr(type) + ")" 180 print(text) 181 182 # The argument checks. 183 arg_check.is_str(ri_id, 'relaxation data ID string') 184 arg_check.is_str(type, 'peak intensity type') 185 186 # Execute the functional code. 187 relax_data.peak_intensity_type(ri_id=ri_id, type=type)
188 189 # The function doc info. 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 # Function intro text. 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 # The argument checks. 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 # Execute the functional code. 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 # The function doc info. 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
295 - def temp_calibration(self, ri_id=None, method=None):
296 # Function intro text. 297 if self._exec_info.intro: 298 text = self._exec_info.ps3 + "relax_data.temp_calibration(" 299 text = text + "ri_id=" + repr(ri_id) 300 text = text + ", method=" + repr(method) + ")" 301 print(text) 302 303 # The argument checks. 304 arg_check.is_str(ri_id, 'relaxation data ID string') 305 arg_check.is_str(method, 'temperature calibration method') 306 307 # Execute the functional code. 308 relax_data.temp_calibration(ri_id=ri_id, method=method)
309 310 # The function doc info. 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
329 - def temp_control(self, ri_id=None, method=None):
330 # Function intro text. 331 if self._exec_info.intro: 332 text = self._exec_info.ps3 + "relax_data.temp_control(" 333 text = text + "ri_id=" + repr(ri_id) 334 text = text + ", method=" + repr(method) + ")" 335 print(text) 336 337 # The argument checks. 338 arg_check.is_str(ri_id, 'relaxation data ID string') 339 arg_check.is_str(method, 'temperature control method') 340 341 # Execute the functional code. 342 relax_data.temp_control(ri_id=ri_id, method=method)
343 344 # The function doc info. 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 # Function intro text. 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 # The argument checks. 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 # Execute the functional code. 383 relax_data.write(ri_id=ri_id, file=file, dir=dir, bc=bc, force=force)
384 385 # The function doc info. 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