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

Source Code for Module prompt.model_free

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003-2005 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  import sys 
 24   
 25  import help 
 26   
 27   
28 -class Model_free:
29 - def __init__(self, relax):
30 # Help. 31 self.__relax_help__ = \ 32 """Class for holding the preset model functions.""" 33 34 # Add the generic help string. 35 self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help 36 37 # Place relax in the class namespace. 38 self.__relax__ = relax
39 40
41 - def copy(self, run1=None, run2=None, sim=None):
42 """Function for copying model-free data from run1 to run2. 43 44 Keyword Arguments 45 ~~~~~~~~~~~~~~~~~ 46 47 run1: The name of the run to copy the sequence from. 48 49 run2: The name of the run to copy the sequence to. 50 51 sim: The simulation number. 52 53 54 Description 55 ~~~~~~~~~~~ 56 57 This function will copy all model-free data from 'run1' to 'run2'. Any model-free data in 58 'run2' will be overwritten. If the argument 'sim' is an integer, then only data from that 59 simulation will be copied. 60 61 62 Examples 63 ~~~~~~~~ 64 65 To copy all model-free data from the run 'm1' to the run 'm2', type: 66 67 relax> model_free.copy('m1', 'm2') 68 relax> model_free.copy(run1='m1', run2='m2') 69 """ 70 71 # Function intro text. 72 if self.__relax__.interpreter.intro: 73 text = sys.ps3 + "model_free.copy(" 74 text = text + "run1=" + `run1` 75 text = text + ", run2=" + `run2` 76 text = text + ", sim=" + `sim` + ")" 77 print text 78 79 # The run1 argument. 80 if type(run1) != str: 81 raise RelaxStrError, ('run1', run1) 82 83 # The run2 argument. 84 if type(run2) != str: 85 raise RelaxStrError, ('run2', run2) 86 87 # The sim argument. 88 if sim != None and type(sim) != int: 89 raise RelaxIntError, ('sim', sim) 90 91 # Execute the functional code. 92 self.__relax__.specific.model_free.copy(run1=run1, run2=run2, sim=sim)
93 94
95 - def create_model(self, run=None, model=None, equation=None, params=None, res_num=None):
96 """Function to create a model-free model. 97 98 Keyword Arguments 99 ~~~~~~~~~~~~~~~~~ 100 101 run: The run to assign the values to. 102 103 model: The name of the model-free model. 104 105 equation: The model-free equation. 106 107 params: The array of parameter names of the model. 108 109 res_num: The residue number. 110 111 112 Model-free equation 113 ~~~~~~~~~~~~~~~~~~~ 114 115 'mf_orig' selects the original model-free equations with parameters {S2, te}. 116 'mf_ext' selects the extended model-free equations with parameters {S2f, tf, S2, ts}. 117 'mf_ext2' selects the extended model-free equations with parameters {S2f, tf, S2s, ts}. 118 119 120 Model-free parameters 121 ~~~~~~~~~~~~~~~~~~~~~ 122 123 The following parameters are accepted for the original model-free equation: 124 125 'S2': The square of the generalised order parameter. 126 'te': The effective correlation time. 127 128 The following parameters are accepted for the extended model-free equation: 129 130 'S2f': The square of the generalised order parameter of the faster motion. 131 'tf': The effective correlation time of the faster motion. 132 'S2': The square of the generalised order parameter S2 = S2f * S2s. 133 'ts': The effective correlation time of the slower motion. 134 135 The following parameters are accepted for the extended 2 model-free equation: 136 137 'S2f': The square of the generalised order parameter of the faster motion. 138 'tf': The effective correlation time of the faster motion. 139 'S2s': The square of the generalised order parameter of the slower motion. 140 'ts': The effective correlation time of the slower motion. 141 142 The following parameters are accepted for all equations: 143 144 'Rex': The chemical exchange relaxation. 145 'r': The average bond length <r>. 146 'CSA': The chemical shift anisotropy. 147 148 149 Residue number 150 ~~~~~~~~~~~~~~ 151 152 If 'res_num' is supplied as an integer then the model will only be created for that residue, 153 otherwise the model will be created for all residues. 154 155 156 Examples 157 ~~~~~~~~ 158 159 The following commands will create the model-free model 'm1' which is based on the original 160 model-free equation and contains the single parameter 'S2'. 161 162 relax> model_free.create_model('m1', 'm1', 'mf_orig', ['S2']) 163 relax> model_free.create_model(run='m1', model='m1', params=['S2'], equation='mf_orig') 164 165 166 The following commands will create the model-free model 'large_model' which is based on the 167 extended model-free equation and contains the seven parameters 'S2f', 'tf', 'S2', 'ts', 168 'Rex', 'CSA', 'r'. 169 170 relax> model_free.create_model('test', 'large_model', 'mf_ext', ['S2f', 'tf', 'S2', 'ts', 171 'Rex', 'CSA', 'r']) 172 relax> model_free.create_model(run='test', model='large_model', params=['S2f', 'tf', 'S2', 173 'ts', 'Rex', 'CSA', 'r'], equation='mf_ext') 174 """ 175 176 # Function intro text. 177 if self.__relax__.interpreter.intro: 178 text = sys.ps3 + "model_free.create_model(" 179 text = text + "run=" + `run` 180 text = text + ", model=" + `model` 181 text = text + ", equation=" + `equation` 182 text = text + ", params=" + `params` 183 text = text + ", res_num=" + `res_num` + ")" 184 print text 185 186 # Run argument. 187 if type(run) != str: 188 raise RelaxStrError, ('run', run) 189 190 # Model argument. 191 if type(model) != str: 192 raise RelaxStrError, ('model', model) 193 194 # Equation. 195 if type(equation) != str: 196 raise RelaxStrError, ('model-free equation', equation) 197 198 # Parameter types. 199 if type(params) != list: 200 raise RelaxListError, ('parameter types', params) 201 for i in xrange(len(params)): 202 if type(params[i]) != str: 203 raise RelaxListStrError, ('parameter types', params) 204 205 # Residue number. 206 if res_num != None and type(res_num) != int: 207 raise RelaxNoneIntError, ('residue number', res_num) 208 209 # Execute the functional code. 210 self.__relax__.specific.model_free.create_model(run=run, model=model, equation=equation, params=params, res_num=res_num)
211 212
213 - def delete(self, run=None):
214 """Function for deleting all model-free data corresponding to the run. 215 216 Keyword Arguments 217 ~~~~~~~~~~~~~~~~~ 218 219 run: The name of the run. 220 221 222 Examples 223 ~~~~~~~~ 224 225 To delete all model-free data corresponding to the run 'm2', type: 226 227 relax> model_free.delete('m2') 228 """ 229 230 # Function intro text. 231 if self.__relax__.interpreter.intro: 232 text = sys.ps3 + "model_free.delete(" 233 text = text + "run=" + `run` + ")" 234 print text 235 236 # The run name. 237 if type(run) != str: 238 raise RelaxStrError, ('run', run) 239 240 # Execute the functional code. 241 self.__relax__.specific.model_free.delete(run=run)
242 243
244 - def remove_tm(self, run=None, res_num=None):
245 """Function for removing the local tm parameter from a model. 246 247 Keyword Arguments 248 ~~~~~~~~~~~~~~~~~ 249 250 run: The run to assign the values to. 251 252 res_num: The residue number. 253 254 255 Description 256 ~~~~~~~~~~~ 257 258 This function will remove the local tm parameter from the model-free parameters of the given 259 run. Model-free parameters must already exist within the run yet, if there is no local tm, 260 nothing will happen. 261 262 If no residue number is given, then the function will apply to all residues. 263 264 265 Examples 266 ~~~~~~~~ 267 268 The following commands will remove the parameter 'tm' from the run 'local_tm': 269 270 relax> model_free.remove_tm('local_tm') 271 relax> model_free.remove_tm(run='local_tm') 272 """ 273 274 # Function intro text. 275 if self.__relax__.interpreter.intro: 276 text = sys.ps3 + "model_free.remove_tm(" 277 text = text + "run=" + `run` 278 text = text + ", res_num=" + `res_num` + ")" 279 print text 280 281 # Run argument. 282 if type(run) != str: 283 raise RelaxStrError, ('run', run) 284 285 # Residue number. 286 if res_num != None and type(res_num) != int: 287 raise RelaxNoneIntError, ('residue number', res_num) 288 289 # Execute the functional code. 290 self.__relax__.specific.model_free.remove_tm(run=run, res_num=res_num)
291 292
293 - def select_model(self, run=None, model=None, res_num=None):
294 """Function for the selection of a preset model-free model. 295 296 Keyword Arguments 297 ~~~~~~~~~~~~~~~~~ 298 299 run: The run to assign the values to. 300 301 model: The name of the preset model. 302 303 304 The preset models 305 ~~~~~~~~~~~~~~~~~ 306 307 The standard preset model-free models are 308 'm0': [], 309 'm1': [S2], 310 'm2': [S2, te], 311 'm3': [S2, Rex], 312 'm4': [S2, te, Rex], 313 'm5': [S2f, S2, ts], 314 'm6': [S2f, tf, S2, ts], 315 'm7': [S2f, S2, ts, Rex], 316 'm8': [S2f, tf, S2, ts, Rex], 317 'm9': [Rex]. 318 319 The preset model-free models with optimisation of the CSA value are 320 'm10': [CSA], 321 'm11': [CSA, S2], 322 'm12': [CSA, S2, te], 323 'm13': [CSA, S2, Rex], 324 'm14': [CSA, S2, te, Rex], 325 'm15': [CSA, S2f, S2, ts], 326 'm16': [CSA, S2f, tf, S2, ts], 327 'm17': [CSA, S2f, S2, ts, Rex], 328 'm18': [CSA, S2f, tf, S2, ts, Rex], 329 'm19': [CSA, Rex]. 330 331 The preset model-free models with optimisation of the bond length are 332 'm20': [r], 333 'm21': [r, S2], 334 'm22': [r, S2, te], 335 'm23': [r, S2, Rex], 336 'm24': [r, S2, te, Rex], 337 'm25': [r, S2f, S2, ts], 338 'm26': [r, S2f, tf, S2, ts], 339 'm27': [r, S2f, S2, ts, Rex], 340 'm28': [r, S2f, tf, S2, ts, Rex], 341 'm29': [r, CSA, Rex]. 342 343 The preset model-free models with both optimisation of the bond length and CSA are 344 'm30': [r, CSA], 345 'm31': [r, CSA, S2], 346 'm32': [r, CSA, S2, te], 347 'm33': [r, CSA, S2, Rex], 348 'm34': [r, CSA, S2, te, Rex], 349 'm35': [r, CSA, S2f, S2, ts], 350 'm36': [r, CSA, S2f, tf, S2, ts], 351 'm37': [r, CSA, S2f, S2, ts, Rex], 352 'm38': [r, CSA, S2f, tf, S2, ts, Rex], 353 'm39': [r, CSA, Rex]. 354 355 Warning: The models in the thirties range fail when using standard R1, R2, and NOE 356 relaxation data. This is due to the extreme flexibly of these models where a change in the 357 parameter 'r' is compensated by a corresponding change in the parameter 'CSA' and 358 vice versa. 359 360 361 Additional preset model-free models, which are simply extensions of the above models with 362 the addition of a local tm parameter are: 363 'tm0': [tm], 364 'tm1': [tm, S2], 365 'tm2': [tm, S2, te], 366 'tm3': [tm, S2, Rex], 367 'tm4': [tm, S2, te, Rex], 368 'tm5': [tm, S2f, S2, ts], 369 'tm6': [tm, S2f, tf, S2, ts], 370 'tm7': [tm, S2f, S2, ts, Rex], 371 'tm8': [tm, S2f, tf, S2, ts, Rex], 372 'tm9': [tm, Rex]. 373 374 The preset model-free models with optimisation of the CSA value are 375 'tm10': [tm, CSA], 376 'tm11': [tm, CSA, S2], 377 'tm12': [tm, CSA, S2, te], 378 'tm13': [tm, CSA, S2, Rex], 379 'tm14': [tm, CSA, S2, te, Rex], 380 'tm15': [tm, CSA, S2f, S2, ts], 381 'tm16': [tm, CSA, S2f, tf, S2, ts], 382 'tm17': [tm, CSA, S2f, S2, ts, Rex], 383 'tm18': [tm, CSA, S2f, tf, S2, ts, Rex], 384 'tm19': [tm, CSA, Rex]. 385 386 The preset model-free models with optimisation of the bond length are 387 'tm20': [tm, r], 388 'tm21': [tm, r, S2], 389 'tm22': [tm, r, S2, te], 390 'tm23': [tm, r, S2, Rex], 391 'tm24': [tm, r, S2, te, Rex], 392 'tm25': [tm, r, S2f, S2, ts], 393 'tm26': [tm, r, S2f, tf, S2, ts], 394 'tm27': [tm, r, S2f, S2, ts, Rex], 395 'tm28': [tm, r, S2f, tf, S2, ts, Rex], 396 'tm29': [tm, r, CSA, Rex]. 397 398 The preset model-free models with both optimisation of the bond length and CSA are 399 'tm30': [tm, r, CSA], 400 'tm31': [tm, r, CSA, S2], 401 'tm32': [tm, r, CSA, S2, te], 402 'tm33': [tm, r, CSA, S2, Rex], 403 'tm34': [tm, r, CSA, S2, te, Rex], 404 'tm35': [tm, r, CSA, S2f, S2, ts], 405 'tm36': [tm, r, CSA, S2f, tf, S2, ts], 406 'tm37': [tm, r, CSA, S2f, S2, ts, Rex], 407 'tm38': [tm, r, CSA, S2f, tf, S2, ts, Rex], 408 'tm39': [tm, r, CSA, Rex]. 409 410 411 412 Residue number 413 ~~~~~~~~~~~~~~ 414 415 If 'res_num' is supplied as an integer then the model will only be selected for that 416 residue, otherwise the model will be selected for all residues. 417 418 419 420 Examples 421 ~~~~~~~~ 422 423 To pick model 'm1' for all selected residues and assign it to the run 'mixed', type: 424 425 relax> model_free.select_model('mixed', 'm1') 426 relax> model_free.select_model(run='mixed', model='m1') 427 """ 428 429 # Function intro text. 430 if self.__relax__.interpreter.intro: 431 text = sys.ps3 + "model_free.select_model(" 432 text = text + "run=" + `run` 433 text = text + ", model=" + `model` + ")" 434 print text 435 436 # Run argument. 437 if type(run) != str: 438 raise RelaxStrError, ('run', run) 439 440 # Model argument. 441 elif type(model) != str: 442 raise RelaxStrError, ('model', model) 443 444 # Residue number. 445 if res_num != None and type(res_num) != int: 446 raise RelaxNoneIntError, ('residue number', res_num) 447 448 # Execute the functional code. 449 self.__relax__.specific.model_free.select_model(run=run, model=model, res_num=res_num)
450