Module usr_param
[hide private]
[frames] | no frames]

Source Code for Module usr_param

  1  # usr_param.py v0.5                  4 January 2002        Edward d'Auvergne 
  2  # 
  3  # Class containing all the user specified parameters.  Used by the program mf. 
  4  # Make sure the version numbers between the program and this class are identical. 
  5   
  6  import sys 
  7  from re import match 
  8   
9 -class usr_param:
10 - def __init__(self):
11 "Class containing parameters specified by the user" 12 13 self.version = 0.5 14 self.program_type = 'mf' 15 16 # Relaxation curve fitting. 17 if match('^[Rr]elax[ _][Ff]it$', self.program_type): 18 self.relax_params() 19 20 # Normal program use. 21 elif match('^[Mm][Ff]$', self.program_type): 22 self.init_params = ['fixed'] 23 #self.init_params = ['Grid', 21] 24 self.minimiser = ['Newton', 'More Thuente'] 25 self.input() 26 self.model_selection() 27 self.palmer_method_param() 28 self.palmer_run_param() 29 self.palmer_mfin_param() 30 self.palmer_mfpar_param() 31 self.palmer_mfmodel_param() 32 33 # Use Art Palmer's Modelfree minimiser. 34 elif match('^[Pp]almer$', self.program_type): 35 #self.init_input() 36 self.input() 37 self.model_selection() 38 self.palmer_method_param() 39 self.palmer_run_param() 40 self.palmer_mfin_param() 41 self.palmer_mfpar_param() 42 self.palmer_mfmodel_param() 43 44 # Quit if there is no match. 45 else: 46 raise NameError, "Variable 'program_type' is not set correctly in usr_param.py, quitting program."
47 48
49 - def input(self):
50 """Specify the input data. 51 52 The structure of self.input_info is as follows: The fields of the first dimension correspond 53 to each relaxation data set and is flexible in size, ie len(self.input_info) = number of data sets. 54 The second dimension have the following fixed fields: 55 0 - Data type (R1, R2, or NOE) 56 1 - NMR frequancy label 57 2 - NMR proton frequancy in MHz 58 3 - The name of the file containing the relaxation data 59 60 The structure of self.nmr_frq is as follows: The length of the first dimension is equal to the number 61 of field strengths. The fields of the second are: 62 0 - NMR frequancy label 63 1 - NMR proton frequancy in MHz 64 2 - R1 flag (0 or 1 depending if data is present). 65 3 - R2 flag (0 or 1 depending if data is present). 66 4 - NOE flag (0 or 1 depending if data is present). 67 """ 68 69 self.input_info = [] 70 self.input_info.append(['R1', '600', 600.0 * 1e6, 'r1.600.out']) 71 self.input_info.append(['R2', '600', 600.0 * 1e6, 'r2.600.out']) 72 self.input_info.append(['NOE', '600', 600.0 * 1e6, 'noe.600.out']) 73 self.input_info.append(['R1', '500', 500.0 * 1e6, 'r1.500.out']) 74 self.input_info.append(['R2', '500', 500.0 * 1e6, 'r2.500.out']) 75 self.input_info.append(['NOE', '500', 500.0 * 1e6, 'noe.500.out'])
76 77
78 - def model_selection(self):
79 """Model selection method. self.method can be set to the following: 80 81 AIC: Method of model-free analysis based on model selection using the Akaike Information Criteria. 82 83 AICc: Method of model-free analysis based on model selection using the Akaike Information Criteria corrected 84 for finit sample size. 85 86 BIC: Method of model-free analysis based on model selection using the Schwartz Information Criteria. 87 88 Bootstrap: Modelfree analysis based on model selection using bootstrap methods to estimate the overall discrepancy. 89 90 CV: Modelfree analysis based on model selection using cross-validation methods to estimate the overall discrepancy. 91 92 Expect: Calculate the expected overall discrepancy (real model-free parameters must be known). 93 94 Farrow: The method given by Farrow et al., 1994. 95 96 Palmer: The method given by Mandel et al., 1995. 97 98 Overall: Calculate the realised overall discrepancy (real model-free parameters must be known). 99 """ 100 101 self.method = 'AIC'
102 103
104 - def palmer_method_param(self):
105 # The following three values are only used in Palmer's method and won't affect the others. 106 self.chi2_lim = 0.90 # Set the chi squared cutoff (1 - alpha critical value). 107 self.ftest_lim = 0.80 # Set the F-test cutoff (1 - alpha critical value). 108 self.large_chi2 = 20.0 # Set the maximum chi squared value.
109 110
111 - def palmer_run_param(self):
112 "Run file parameters" 113 114 self.pdb_file = 'Ap4Aase_new_3.pdb' 115 self.pdb_path = '../../' 116 self.pdb_full = self.pdb_path + self.pdb_file
117 118
119 - def palmer_mfin_param(self):
120 "mfin file parameters" 121 122 self.diff = 'isotropic' 123 #self.diff = 'axial' 124 self.num_sim = '200' 125 self.trim = '0' # Trim unconverged simulations. 126 127 # tm 128 self.tm = {} 129 self.tm['val'] = 10 130 self.tm['flag'] = '1' 131 self.tm['bound'] = '2' 132 self.tm['lower'] = '9.0' 133 self.tm['upper'] = '13.0' 134 self.tm['steps'] = '100' 135 136 # dratio 137 self.dratio = {} 138 self.dratio['val'] = 1.123 139 self.dratio['flag'] = '1' 140 self.dratio['bound'] = '0' 141 self.dratio['lower'] = '0.6' 142 self.dratio['upper'] = '1.5' 143 self.dratio['steps'] = '5' 144 145 # theta 146 self.theta = {} 147 self.theta['val'] = 87.493 148 self.theta['flag'] = '1' 149 self.theta['bound'] = '0' 150 self.theta['lower'] = '-90' 151 self.theta['upper'] = '90' 152 self.theta['steps'] = '10' 153 154 # phi 155 self.phi = {} 156 self.phi['val'] = -52.470 157 self.phi['flag'] = '1' 158 self.phi['bound'] = '0' 159 self.phi['lower'] = '-90' 160 self.phi['upper'] = '90' 161 self.phi['steps'] = '10'
162 163
164 - def palmer_mfpar_param(self):
165 "mfpar file parameters" 166 167 self.const = {} 168 self.const['nucleus'] = 'N15' 169 self.const['gamma'] = -2.710 170 self.const['rxh'] = 1.020 * 1e-10 171 self.const['csa'] = -160.00 * 1e-6 172 173 self.vector = {} 174 self.vector['atom1'] = 'N' 175 self.vector['atom2'] = 'H'
176 177
178 - def palmer_mfmodel_param(self):
179 "mfmodel file parameters" 180 181 self.md1 = {} 182 self.md1['tloc'] = {} 183 self.md1['tloc']['start'] = '0.0' 184 self.md1['tloc']['flag'] = '0' 185 self.md1['tloc']['bound'] = '2' 186 self.md1['tloc']['lower'] = '0.000' 187 self.md1['tloc']['upper'] = '20.000' 188 self.md1['tloc']['steps'] = '20' 189 190 self.md1['theta'] = {} 191 self.md1['theta']['start'] = '0.0' 192 self.md1['theta']['flag'] = '0' 193 self.md1['theta']['bound'] = '2' 194 self.md1['theta']['lower'] = '0.000' 195 self.md1['theta']['upper'] = '90.000' 196 self.md1['theta']['steps'] = '20' 197 198 self.md1['sf2'] = {} 199 self.md1['sf2']['start'] = '1.0' 200 self.md1['sf2']['flag'] = '0' 201 self.md1['sf2']['bound'] = '2' 202 self.md1['sf2']['lower'] = '0.000' 203 self.md1['sf2']['upper'] = '1.000' 204 self.md1['sf2']['steps'] = '20' 205 206 self.md1['ss2'] = {} 207 self.md1['ss2']['start'] = '1.0' 208 self.md1['ss2']['flag'] = '0' 209 self.md1['ss2']['bound'] = '2' 210 self.md1['ss2']['lower'] = '0.000' 211 self.md1['ss2']['upper'] = '1.000' 212 self.md1['ss2']['steps'] = '20' 213 214 self.md1['te'] = {} 215 self.md1['te']['start'] = '0.0' 216 self.md1['te']['flag'] = '0' 217 self.md1['te']['bound'] = '2' 218 self.md1['te']['lower'] = '0.000' 219 self.md1['te']['upper'] = '10000.000' 220 self.md1['te']['steps'] = '20' 221 222 self.md1['rex'] = {} 223 self.md1['rex']['start'] = '0.0' 224 self.md1['rex']['flag'] = '0' 225 self.md1['rex']['bound'] = '-1' 226 self.md1['rex']['lower'] = '0.000' 227 self.md1['rex']['upper'] = '20.000' 228 self.md1['rex']['steps'] = '20' 229 230 self.md2 = {} 231 for param in self.md1.keys(): 232 self.md2[param] = {} 233 for value in self.md1[param].keys(): 234 self.md2[param][value] = self.md1[param][value]
235 236
237 - def relax_params(self):
238 "Parameters used by the relaxation curve fitting." 239 240 # File type. Only 'sparky' is implemented at the moment. 241 self.type = "sparky" 242 243 # Relaxation time and associated file. 244 self.input_info = [] 245 self.input_info.append([0.0111, 'T1_10ms.list']) 246 self.input_info.append([0.0111, 'T1_10ms_b.list']) 247 self.input_info.append([0.0555, 'T1_50ms.list']) 248 self.input_info.append([0.1110, 'T1_100ms.list']) 249 self.input_info.append([0.1110, 'T1_100ms_b.list']) 250 self.input_info.append([0.2775, 'T1_250ms.list']) 251 self.input_info.append([0.5550, 'T1_500ms.list']) 252 self.input_info.append([0.5550, 'T1_500ms_b.list']) 253 self.input_info.append([1.1100, 'T1_1000ms.list']) 254 self.input_info.append([1.1100, 'T1_1000ms_b.list']) 255 self.input_info.append([1.6650, 'T1_1500ms.list']) 256 257 # Unresolved residues. 258 self.unresolved = [31, 52, 83, 84, 93, 95, 117, 120, 131, 134, 150, 153]
259