1   
  2   
  3   
  4   
  5   
  6   
  7   
  8   
  9   
 10   
 11   
 12   
 13   
 14   
 15   
 16   
 17   
 18   
 19   
 20   
 21   
 22   
 23  """The palmer user function definitions for controlling the Modelfree4 software.""" 
 24   
 25   
 26  import dep_check 
 27  if dep_check.wx_module: 
 28      from wx import FD_OPEN 
 29  else: 
 30      FD_OPEN = -1 
 31   
 32   
 33  from graphics import WIZARD_IMAGE_PATH 
 34  from pipe_control import palmer 
 35  from user_functions.data import Uf_info; uf_info = Uf_info() 
 36  from user_functions.objects import Desc_container 
 37   
 38   
 39   
 40  uf_class = uf_info.add_class('palmer') 
 41  uf_class.title = "Class for interfacing with Art Palmer's Modelfree 4." 
 42  uf_class.menu_text = "&palmer" 
 43  uf_class.gui_icon = "relax.modelfree4" 
 44   
 45   
 46   
 47  uf = uf_info.add_uf('palmer.create') 
 48  uf.title = "Create the Modelfree4 input files." 
 49  uf.title_short = "Modelfree4 input file creation." 
 50  uf.add_keyarg( 
 51      name = "dir", 
 52      py_type = "str", 
 53      arg_type = "dir sel", 
 54      desc_short = "directory name", 
 55      desc = "The directory to place the files.", 
 56      can_be_none = True 
 57  ) 
 58  uf.add_keyarg( 
 59      name = "force", 
 60      default = False, 
 61      py_type = "bool", 
 62      desc_short = "force flag", 
 63      desc = "A flag which if set to True will cause the results file to be overwritten if it already exists." 
 64  ) 
 65  uf.add_keyarg( 
 66      name = "binary", 
 67      default = "modelfree4", 
 68      py_type = "str", 
 69      arg_type = "file sel", 
 70      desc_short = "Modelfree executable file", 
 71      desc = "The name of the executable Modelfree program file.", 
 72      wiz_filesel_style = FD_OPEN, 
 73      wiz_filesel_preview = False 
 74  ) 
 75  uf.add_keyarg( 
 76      name = "diff_search", 
 77      default = "none", 
 78      py_type = "str", 
 79      desc_short = "diffusion search", 
 80      desc = "See the Modelfree4 manual for 'diffusion_search'." 
 81  ) 
 82  uf.add_keyarg( 
 83      name = "sims", 
 84      default = 0, 
 85      py_type = "int", 
 86      desc_short = "Monte Carlo simulation number", 
 87      desc = "The number of Monte Carlo simulations." 
 88  ) 
 89  uf.add_keyarg( 
 90      name = "sim_type", 
 91      default = "pred", 
 92      py_type = "str", 
 93      desc_short = "simulation type", 
 94      desc = "See the Modelfree4 manual." 
 95  ) 
 96  uf.add_keyarg( 
 97      name = "trim", 
 98      default = 0, 
 99      py_type = "num", 
100      desc_short = "trimming", 
101      desc = "See the Modelfree4 manual." 
102  ) 
103  uf.add_keyarg( 
104      name = "steps", 
105      default = 20, 
106      py_type = "int", 
107      desc_short = "grid search steps", 
108      desc = "See the Modelfree4 manual." 
109  ) 
110  uf.add_keyarg( 
111      name = "constraints", 
112      default = True, 
113      py_type = "bool", 
114      desc_short = "constraints flag", 
115      desc = "A flag specifying whether the parameters should be constrained.  The default is to turn constraints on (constraints=True)." 
116  ) 
117  uf.add_keyarg( 
118      name = "heteronuc_type", 
119      default = "15N", 
120      py_type = "str", 
121      desc_short = "heteronucleus", 
122      desc = "A three letter string describing the heteronucleus type, ie '15N', '13C', etc." 
123  ) 
124  uf.add_keyarg( 
125      name = "atom1", 
126      default = "N", 
127      py_type = "str", 
128      desc_short = "atom1", 
129      desc = "The symbol of the X heteronucleus in the PDB file." 
130  ) 
131  uf.add_keyarg( 
132      name = "atom2", 
133      default = "H", 
134      py_type = "str", 
135      desc_short = "atom2", 
136      desc = "The symbol of the H nucleus in the PDB file." 
137  ) 
138  uf.add_keyarg( 
139      name = "spin_id", 
140      py_type = "str", 
141      desc_short = "spin ID string", 
142      desc = "The spin identification string.", 
143      can_be_none = True 
144  ) 
145   
146  uf.desc.append(Desc_container()) 
147  uf.desc[-1].add_paragraph("The following files are created") 
148  uf.desc[-1].add_list_element("'dir/mfin'") 
149  uf.desc[-1].add_list_element("'dir/mfdata'") 
150  uf.desc[-1].add_list_element("'dir/mfpar'") 
151  uf.desc[-1].add_list_element("'dir/mfmodel'") 
152  uf.desc[-1].add_list_element("'dir/run.sh'") 
153  uf.desc[-1].add_paragraph("The file 'dir/run.sh' contains the single command,") 
154  uf.desc[-1].add_item_list_element(None, "'modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out',") 
155  uf.desc[-1].add_paragraph("which can be used to execute modelfree4.") 
156  uf.desc[-1].add_paragraph("If you would like to use a different Modelfree executable file, change the binary name to the appropriate file name.  If the file is not located within the environment's path, include the full path in front of the binary file name.") 
157  uf.backend = palmer.create 
158  uf.menu_text = "&create" 
159  uf.gui_icon = "oxygen.actions.list-add-relax-blue" 
160  uf.wizard_height_desc = 230 
161  uf.wizard_size = (1000, 750) 
162  uf.wizard_apply_button = False 
163  uf.wizard_image = WIZARD_IMAGE_PATH + 'modelfree4.png' 
164   
165   
166   
167  uf = uf_info.add_uf('palmer.execute') 
168  uf.title = "Perform a model-free optimisation using Modelfree4." 
169  uf.title_short = "Modelfree4 execution." 
170  uf.add_keyarg( 
171      name = "dir", 
172      py_type = "str", 
173      arg_type = "dir sel", 
174      desc_short = "directory name", 
175      desc = "The directory to place the files.", 
176      can_be_none = True 
177  ) 
178   
179  uf.add_keyarg( 
180      name = "force", 
181      default = False, 
182      py_type = "bool", 
183      desc_short = "force flag", 
184      desc = "A flag which if set to True will cause the results file to be overwritten if it already exists." 
185  ) 
186   
187  uf.add_keyarg( 
188      name = "binary", 
189      default = "modelfree4", 
190      py_type = "str", 
191      arg_type = "file sel", 
192      desc_short = "Modelfree4 executable file", 
193      desc = "The name of the executable Modelfree program file.", 
194      wiz_filesel_style = FD_OPEN, 
195      wiz_filesel_preview = False 
196  ) 
197   
198  uf.desc.append(Desc_container()) 
199  uf.desc[-1].add_paragraph("Modelfree 4 will be executed as") 
200  uf.desc[-1].add_prompt("$ modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out") 
201  uf.desc[-1].add_paragraph("If a PDB file is loaded and non-isotropic diffusion is selected, then the file name will be placed on the command line as '-s pdb_file_name'.") 
202  uf.desc[-1].add_paragraph("If you would like to use a different Modelfree executable file, change the binary name to the appropriate file name.  If the file is not located within the environment's path, include the full path in front of the binary file name.") 
203  uf.backend = palmer.execute 
204  uf.gui_icon = "oxygen.categories.applications-education" 
205  uf.menu_text = "&execute" 
206  uf.wizard_size = (800, 600) 
207  uf.wizard_apply_button = False 
208  uf.wizard_image = WIZARD_IMAGE_PATH + 'modelfree4.png' 
209   
210   
211   
212  uf = uf_info.add_uf('palmer.extract') 
213  uf.title = "Extract data from the Modelfree4 'mfout' star formatted file." 
214  uf.title_short = "Modelfree4 data extraction." 
215  uf.add_keyarg( 
216      name = "dir", 
217      py_type = "str", 
218      arg_type = "dir sel", 
219      desc_short = "directory name", 
220      desc = "The directory where the file 'mfout' is found.", 
221      can_be_none = True 
222  ) 
223   
224  uf.desc.append(Desc_container()) 
225  uf.desc[-1].add_paragraph("The model-free results will be extracted from the Modelfree4 results file 'mfout' located in the given directory.") 
226  uf.backend = palmer.extract 
227  uf.menu_text = "ex&tract" 
228  uf.gui_icon = "oxygen.actions.archive-extract" 
229  uf.wizard_apply_button = False 
230  uf.wizard_image = WIZARD_IMAGE_PATH + 'modelfree4.png' 
231