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

Source Code for Module prompt.model_free

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