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

Source Code for Module prompt.palmer

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003-2006, 2009-2010 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 'palmer' user function class for controlling the Modelfree4 software.""" 
 25  __docformat__ = 'plaintext' 
 26   
 27  # relax module imports. 
 28  from base_class import User_fn_class 
 29  import arg_check 
 30  from generic_fns import palmer 
 31   
 32   
33 -class Palmer(User_fn_class):
34 """Class for interfacing with Art Palmer's Modelfree 4.""" 35
36 - def create(self, dir=None, force=False, binary='modelfree4', diff_search='none', sims=0, sim_type='pred', trim=0, steps=20, constraints=True, heteronuc_type='15N', atom1='N', atom2='H', spin_id=None):
37 """Function for creating the Modelfree4 input files. 38 39 Keyword Arguments 40 ~~~~~~~~~~~~~~~~~ 41 42 dir: The directory to place the files. 43 44 force: A flag which if set to True will cause the results file to be overwritten if it 45 already exists. 46 47 binary: The name of the executable Modelfree program file. 48 49 diff_search: See the Modelfree4 manual for 'diffusion_search'. 50 51 sims: The number of Monte Carlo simulations. 52 53 sim_type: See the Modelfree4 manual. 54 55 trim: See the Modelfree4 manual. 56 57 steps: See the Modelfree4 manual. 58 59 constraints: A flag specifying whether the parameters should be constrained. The default 60 is to turn constraints on (constraints=True). 61 62 heteronuc_type: A three letter string describing the heteronucleus type, ie 15N, 13C, etc. 63 64 atom1: The symbol of the X heteronucleus in the pdb file. 65 66 atom2: The symbol of the H nucleus in the pdb file. 67 68 spin_id: The spin identification string. 69 70 71 Description 72 ~~~~~~~~~~~ 73 74 The following files are created 75 76 'dir/mfin', 77 'dir/mfdata', 78 'dir/mfpar', 79 'dir/mfmodel', 80 'dir/run.sh'. 81 82 The file 'dir/run.sh' contains the single command, 83 84 'modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out', 85 86 which can be used to execute modelfree4. 87 88 If you would like to use a different Modelfree executable file, change the keyword argument 89 'binary' to the appropriate file name. If the file is not located within the environment's 90 path, include the full path infront of the binary file name. 91 """ 92 93 # Function intro text. 94 if self._exec_info.intro: 95 text = self._exec_info.ps3 + "palmer.create(" 96 text = text + "dir=" + repr(dir) 97 text = text + ", force=" + repr(force) 98 text = text + ", binary=" + repr(binary) 99 text = text + ", diff_search=" + repr(diff_search) 100 text = text + ", sims=" + repr(sims) 101 text = text + ", sim_type=" + repr(sim_type) 102 text = text + ", trim=" + repr(trim) 103 text = text + ", steps=" + repr(steps) 104 text = text + ", constraints=" + repr(constraints) 105 text = text + ", heteronucleus=" + repr(heteronuc_type) 106 text = text + ", atom1=" + repr(atom1) 107 text = text + ", atom2=" + repr(atom2) 108 text = text + ", spin_id=" + repr(spin_id) + ")" 109 print(text) 110 111 # The argument checks. 112 arg_check.is_str(dir, 'directory name', can_be_none=True) 113 arg_check.is_bool(force, 'force flag') 114 arg_check.is_str(binary, 'Modelfree executable file') 115 arg_check.is_str(diff_search, 'diffusion search') 116 arg_check.is_int(sims, 'number of Monte Carlo simulations') 117 arg_check.is_str(sim_type, 'simulation type') 118 arg_check.is_num(trim, 'trimming') 119 arg_check.is_int(steps, 'steps') 120 arg_check.is_bool(constraints, 'constraints flag') 121 arg_check.is_str(heteronuc_type, 'heteronucleus') 122 arg_check.is_str(atom1, 'atom1') 123 arg_check.is_str(atom2, 'atom2') 124 125 # Execute the functional code. 126 palmer.create(dir=dir, force=force, binary=binary, diff_search=diff_search, sims=sims, sim_type=sim_type, trim=trim, steps=steps, constraints=constraints, heteronuc_type=heteronuc_type, atom1=atom1, atom2=atom2, spin_id=spin_id)
127 128
129 - def execute(self, dir=None, force=False, binary='modelfree4'):
130 """Function for executing Modelfree4. 131 132 Keyword Arguments 133 ~~~~~~~~~~~~~~~~~ 134 135 dir: The directory to place the files. 136 137 force: A flag which if set to True will cause the results file to be overwritten if it 138 already exists. 139 140 binary: The name of the executable Modelfree program file. 141 142 143 Description 144 ~~~~~~~~~~~ 145 146 Modelfree 4 will be executed as 147 148 $ modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out 149 150 If a PDB file is loaded and non-isotropic diffusion is selected, then the file name will be 151 placed on the command line as '-s pdb_file_name'. 152 153 154 If you would like to use a different Modelfree executable file, change the keyword argument 155 'binary' to the appropriate file name. If the file is not located within the environment's 156 path, include the full path in front of the binary file name. 157 """ 158 159 # Function intro text. 160 if self._exec_info.intro: 161 text = self._exec_info.ps3 + "palmer.execute(" 162 text = text + "dir=" + repr(dir) 163 text = text + ", force=" + repr(force) 164 text = text + ", binary=" + repr(binary) + ")" 165 print(text) 166 167 # The argument checks. 168 arg_check.is_str(dir, 'directory name', can_be_none=True) 169 arg_check.is_bool(force, 'force flag') 170 arg_check.is_str(binary, 'Modelfree executable file') 171 172 # Execute the functional code. 173 palmer.execute(dir=dir, force=force, binary=binary)
174 175
176 - def extract(self, dir=None):
177 """Function for extracting data from the Modelfree4 'mfout' star formatted file. 178 179 Keyword Arguments 180 ~~~~~~~~~~~~~~~~~ 181 182 dir: The directory where the file 'mfout' is found. 183 """ 184 185 # Function intro text. 186 if self._exec_info.intro: 187 text = self._exec_info.ps3 + "palmer.extract(" 188 text = text + "dir=" + repr(dir) + ")" 189 print(text) 190 191 # The argument checks. 192 arg_check.is_str(dir, 'directory name', can_be_none=True) 193 194 # Execute the functional code. 195 palmer.extract(dir=dir)
196