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

Source Code for Module prompt.palmer

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003-2006 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 Palmer:
29 - def __init__(self, relax):
30 # Help. 31 self.__relax_help__ = \ 32 """Class for interfacing with Art Palmer's Modelfree 4.""" 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 create(self, run=None, dir=None, force=0, binary='modelfree4', diff_search='none', sims=0, sim_type='pred', trim=0, steps=20, constraints=1, nucleus='15N', atom1='N', atom2='H'):
42 """Function for creating the Modelfree4 input files. 43 44 Keyword Arguments 45 ~~~~~~~~~~~~~~~~~ 46 47 run: The name of the run. 48 49 dir: The directory to place the files. The default is the value of 'run'. 50 51 force: A flag which if set to 1 will cause the results file to be overwritten if it already 52 exists. 53 54 binary: The name of the executable Modelfree program file. 55 56 diff_search: See the Modelfree4 manual for 'diffusion_search'. 57 58 sims: The number of Monte Carlo simulations. 59 60 sim_type: See the Modelfree4 manual. 61 62 trim: See the Modelfree4 manual. 63 64 steps: See the Modelfree4 manual. 65 66 constraints: A flag specifying whether the parameters should be constrained. The default 67 is to turn constraints on (constraints=1). 68 69 nucleus: A three letter string describing the nucleus type, ie 15N, 13C, etc. 70 71 atom1: The symbol of the X nucleus in the pdb file. 72 73 atom2: The symbol of the H nucleus in the pdb file. 74 75 76 Description 77 ~~~~~~~~~~~ 78 79 The following files are created 80 81 'dir/mfin', 82 'dir/mfdata', 83 'dir/mfpar', 84 'dir/mfmodel', 85 'dir/run.sh'. 86 87 The file 'run/run.sh' contains the single command, 88 89 'modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out', 90 91 which can be used to execute modelfree4. 92 93 If you would like to use a different Modelfree executable file, change the keyword argument 94 'binary' to the appropriate file name. If the file is not located within the environment's 95 path, include the full path infront of the binary file name. 96 """ 97 98 # Function intro text. 99 if self.__relax__.interpreter.intro: 100 text = sys.ps3 + "palmer.create(" 101 text = text + "run=" + `run` 102 text = text + ", dir=" + `dir` 103 text = text + ", force=" + `force` 104 text = text + ", binary=" + `binary` 105 text = text + ", diff_search=" + `diff_search` 106 text = text + ", sims=" + `sims` 107 text = text + ", sim_type=" + `sim_type` 108 text = text + ", trim=" + `trim` 109 text = text + ", steps=" + `steps` 110 text = text + ", constraints=" + `constraints` 111 text = text + ", nucleus=" + `nucleus` 112 text = text + ", atom1=" + `atom1` 113 text = text + ", atom2=" + `atom2` + ")" 114 print text 115 116 # The run argument. 117 if type(run) != str: 118 raise RelaxStrError, ('run', run) 119 120 # Directory. 121 if dir != None: 122 if type(dir) != str: 123 raise RelaxNoneStrError, ('directory name', dir) 124 125 # The force flag. 126 if type(force) != int or (force != 0 and force != 1): 127 raise RelaxBinError, ('force flag', force) 128 129 # The Modelfree executable file. 130 if type(binary) != str: 131 raise RelaxStrError, ('Modelfree binary', binary) 132 133 # The diff_search argument. 134 if type(diff_search) != str: 135 raise RelaxStrError, ('diff_search', diff_search) 136 137 # The number of Monte Carlo simulations. 138 if type(sims) != int: 139 raise RelaxIntError, ('sims', sims) 140 141 # The sim_type argument. 142 if type(sim_type) != str: 143 raise RelaxStrError, ('sim_type', sim_type) 144 145 # The trim argument. 146 if type(trim) != float and type(trim) != int: 147 raise RelaxFloatError, ('trim', trim) 148 149 # The steps argument. 150 if type(steps) != int: 151 raise RelaxIntError, ('steps', steps) 152 153 # Constraint flag. 154 if type(constraints) != int or (constraints != 0 and constraints != 1): 155 raise RelaxBinError, ('constraint flag', constraints) 156 157 # The nucleus argument. 158 if type(nucleus) != str: 159 raise RelaxStrError, ('nucleus', nucleus) 160 161 # The atom1 argument. 162 if type(atom1) != str: 163 raise RelaxStrError, ('atom1', atom1) 164 165 # The atom2 argument. 166 if type(atom2) != str: 167 raise RelaxStrError, ('atom2', atom2) 168 169 # Execute the functional code. 170 self.__relax__.generic.palmer.create(run=run, dir=dir, force=force, binary=binary, diff_search=diff_search, sims=sims, sim_type=sim_type, trim=trim, steps=steps, constraints=constraints, nucleus=nucleus, atom1=atom1, atom2=atom2)
171 172
173 - def execute(self, run=None, dir=None, force=0, binary='modelfree4'):
174 """Function for executing Modelfree4. 175 176 Keyword Arguments 177 ~~~~~~~~~~~~~~~~~ 178 179 run: The name of the run. 180 181 dir: The directory to place the files. The default is the value of 'run'. 182 183 force: A flag which if set to 1 will cause the results file to be overwritten if it already 184 exists. 185 186 binary: The name of the executable Modelfree program file. 187 188 189 Description 190 ~~~~~~~~~~~ 191 192 Modelfree 4 will be executed as 193 194 $ modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out 195 196 If a PDB file is loaded and non-isotropic diffusion is selected, then the file name will be 197 placed on the command line as '-s pdb_file_name'. 198 199 200 If you would like to use a different Modelfree executable file, change the keyword argument 201 'binary' to the appropriate file name. If the file is not located within the environment's 202 path, include the full path in front of the binary file name. 203 """ 204 205 # Function intro text. 206 if self.__relax__.interpreter.intro: 207 text = sys.ps3 + "palmer.execute(" 208 text = text + "run=" + `run` 209 text = text + ", dir=" + `dir` 210 text = text + ", force=" + `force` 211 text = text + ", binary=" + `binary` + ")" 212 print text 213 214 # The run argument. 215 if type(run) != str: 216 raise RelaxStrError, ('run', run) 217 218 # Directory. 219 if dir != None: 220 if type(dir) != str: 221 raise RelaxNoneStrError, ('directory name', dir) 222 223 # The force flag. 224 if type(force) != int or (force != 0 and force != 1): 225 raise RelaxBinError, ('force flag', force) 226 227 # The Modelfree executable file. 228 if type(binary) != str: 229 raise RelaxStrError, ('Modelfree binary', binary) 230 231 # Execute the functional code. 232 self.__relax__.generic.palmer.execute(run=run, dir=dir, force=force, binary=binary)
233 234
235 - def extract(self, run=None, dir=None):
236 """Function for extracting data from the Modelfree4 'mfout' star formatted file. 237 238 Keyword Arguments 239 ~~~~~~~~~~~~~~~~~ 240 241 run: The name of the run. 242 243 dir: The directory where the file 'mfout' is found. The default is the value of 'run'. 244 """ 245 246 # Function intro text. 247 if self.__relax__.interpreter.intro: 248 text = sys.ps3 + "palmer.extract(" 249 text = text + "run=" + `run` 250 text = text + ", dir=" + `dir` + ")" 251 print text 252 253 # The run argument. 254 if type(run) != str: 255 raise RelaxStrError, ('run', run) 256 257 # Directory. 258 if dir != None: 259 if type(dir) != str: 260 raise RelaxNoneStrError, ('directory name', dir) 261 262 # Execute the functional code. 263 self.__relax__.generic.palmer.extract(run=run, dir=dir)
264