Package user_functions :: Module pipe'
[hide private]
[frames] | no frames]

Source Code for Module user_functions.pipe'

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2004-2012 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  """The pipe user function definitions.""" 
 25   
 26  # relax module imports. 
 27  from graphics import WIZARD_IMAGE_PATH 
 28  from generic_fns import pipes 
 29  from specific_fns.setup import hybrid_obj 
 30  from user_functions.data import Uf_info; uf_info = Uf_info() 
 31  from user_functions.objects import Desc_container 
 32   
 33   
 34  # The user function class. 
 35  uf_class = uf_info.add_class('pipe') 
 36  uf_class.title = "Class holding the user functions for manipulating data pipes." 
 37  uf_class.menu_text = "&pipe" 
 38  uf_class.gui_icon = "relax.pipe" 
 39   
 40   
 41  # The pipe.bundle user function. 
 42  uf = uf_info.add_uf('pipe.bundle') 
 43  uf.title = "The grouping of data pipes into a bundle." 
 44  uf.title_short = "Data pipe bundling." 
 45  uf.add_keyarg( 
 46      name = "bundle", 
 47      py_type = "str", 
 48      desc_short = "pipe bundle", 
 49      desc = "The pipe bundle is a special grouping or clustering of data pipes.", 
 50      wiz_element_type = 'combo', 
 51      wiz_combo_iter = pipes.bundle_names, 
 52      wiz_read_only = False 
 53  ) 
 54  uf.add_keyarg( 
 55      name = "pipe", 
 56      py_type = "str", 
 57      desc_short = "data pipe", 
 58      desc = "The name of the data pipe to add to the bundle.", 
 59      wiz_element_type = 'combo', 
 60      wiz_combo_iter = pipes.pipe_names, 
 61      wiz_read_only = True 
 62  ) 
 63  # Description. 
 64  uf.desc.append(Desc_container()) 
 65  uf.desc[-1].add_paragraph("Data pipes can be grouped or clustered together through special structures known as pipe bundles.  If the specified data pipe bundle does not currently exist, it will be created.") 
 66  # Prompt examples. 
 67  uf.desc.append(Desc_container("Prompt examples")) 
 68  uf.desc[-1].add_paragraph("To add the data pipes 'test 1', 'test 2', and 'test 3' to the bundle 'first analysis', type the following:") 
 69  uf.desc[-1].add_prompt("relax> pipe.bundle('first analysis 1', 'test 1')") 
 70  uf.desc[-1].add_prompt("relax> pipe.bundle('first analysis 1', 'test 2')") 
 71  uf.desc[-1].add_prompt("relax> pipe.bundle('first analysis 1', 'test 3')") 
 72  uf.backend = pipes.bundle 
 73  uf.menu_text = "&bundle" 
 74  uf.gui_icon = "relax.pipe_bundle" 
 75  uf.wizard_image = WIZARD_IMAGE_PATH + 'pipe_bundle.png' 
 76   
 77           
 78  # The pipe.copy user function. 
 79  uf = uf_info.add_uf('pipe.copy') 
 80  uf.title = "Copy a data pipe." 
 81  uf.title_short = "Data pipe copying." 
 82  uf.add_keyarg( 
 83      name = "pipe_from", 
 84      py_type = "str", 
 85      desc_short = "source data pipe", 
 86      desc = "The name of the source data pipe to copy the data from.", 
 87      wiz_element_type = 'combo', 
 88      wiz_combo_iter = pipes.pipe_names, 
 89      wiz_read_only = True, 
 90      can_be_none = True 
 91  ) 
 92  uf.add_keyarg( 
 93      name = "pipe_to", 
 94      py_type = "str", 
 95      desc_short = "destination data pipe", 
 96      desc = "The name of the target data pipe to copy the data to.", 
 97      can_be_none = True 
 98  ) 
 99  uf.add_keyarg( 
100      name = "bundle_to", 
101      py_type = "str", 
102      desc_short = "destination pipe bundle", 
103      desc = "If given, the new data pipe will be grouped into this bundle.", 
104      wiz_element_type = 'combo', 
105      wiz_combo_iter = pipes.bundle_names, 
106      wiz_read_only = False, 
107      can_be_none = True 
108  ) 
109  # Description. 
110  uf.desc.append(Desc_container()) 
111  uf.desc[-1].add_paragraph("This allows the contents of a data pipe to be copied.  If the source data pipe is not set, the current data pipe will be assumed.  The target data pipe must not yet exist.") 
112  uf.desc[-1].add_paragraph("The optional bundling allows the newly created data pipe to be placed into either a new or existing data pipe bundle.  If not specified, then the copied data pipe will not be associated with a bundle.") 
113  # Prompt examples. 
114  uf.desc.append(Desc_container("Prompt examples")) 
115  uf.desc[-1].add_paragraph("To copy the contents of the 'm1' data pipe to the 'm2' data pipe, type:") 
116  uf.desc[-1].add_prompt("relax> pipe.copy('m1', 'm2')") 
117  uf.desc[-1].add_prompt("relax> pipe.copy(pipe_from='m1', pipe_to='m2')") 
118  uf.desc[-1].add_paragraph("If the current data pipe is 'm1', then the following command can be used:") 
119  uf.desc[-1].add_prompt("relax> pipe.copy(pipe_to='m2')") 
120  uf.backend = pipes.copy 
121  uf.menu_text = "&copy" 
122  uf.gui_icon = "oxygen.actions.list-add" 
123  uf.wizard_size = (800, 500) 
124  uf.wizard_image = WIZARD_IMAGE_PATH + 'pipe.png' 
125   
126   
127  # The pipe.create user function. 
128  uf = uf_info.add_uf('pipe.create') 
129  uf.title = "Add a new data pipe to the relax data store." 
130  uf.title_short = "Data pipe creation." 
131  uf.add_keyarg( 
132      name = "pipe_name", 
133      py_type = "str", 
134      desc_short = "data pipe name", 
135      desc = "The name of the data pipe.", 
136  ) 
137  uf.add_keyarg( 
138      name = "pipe_type", 
139      py_type = "str", 
140      desc_short = "type of data pipe", 
141      desc = "The type of data pipe.", 
142      wiz_element_type = 'combo', 
143      wiz_combo_choices = pipes.PIPE_DESC_LIST, 
144      wiz_combo_data = pipes.VALID_TYPES, 
145      wiz_read_only = True 
146  ) 
147  uf.add_keyarg( 
148      name = "bundle", 
149      py_type = "str", 
150      desc_short = "pipe bundle", 
151      desc = "The optional pipe bundle is a special grouping or clustering of data pipes.  If this is specified, the newly created data pipe will be added to this bundle.", 
152      wiz_element_type = 'combo', 
153      wiz_combo_iter = pipes.bundle_names, 
154      wiz_read_only = False, 
155      can_be_none = True 
156  ) 
157  uf.backend = pipes.create 
158  # Description. 
159  uf.desc.append(Desc_container()) 
160  uf.desc[-1].add_paragraph("The data pipe name can be any string however the data pipe type can only be one of the following:") 
161  uf.desc[-1].add_item_list_element("'ct'", "Consistency testing,") 
162  uf.desc[-1].add_item_list_element("'frame order'", "The Frame Order theories,") 
163  uf.desc[-1].add_item_list_element("'jw'", "Reduced spectral density mapping,") 
164  uf.desc[-1].add_item_list_element("'hybrid'", "A special hybrid pipe,") 
165  uf.desc[-1].add_item_list_element("'mf'", "Model-free analysis,") 
166  uf.desc[-1].add_item_list_element("'N-state'", "N-state model of domain motions,") 
167  uf.desc[-1].add_item_list_element("'noe'", "Steady state NOE calculation,") 
168  uf.desc[-1].add_item_list_element("'relax_fit'", "Relaxation curve fitting,") 
169  uf.desc[-1].add_paragraph("The pipe bundling concept is simply a way of grouping data pipes together.  This is useful for a number of purposes:") 
170  uf.desc[-1].add_list_element("The grouping or categorisation of data pipes, for example when multiple related analyses are performed.") 
171  uf.desc[-1].add_list_element("In the auto-analyses, as all the data pipes that they spawn are bound together within the original bundle.") 
172  uf.desc[-1].add_list_element("In the graphical user interface mode as analysis tabs are linked to specific pipe bundles.") 
173  # Prompt examples. 
174  uf.desc.append(Desc_container("Prompt examples")) 
175  uf.desc[-1].add_paragraph("To set up a model-free analysis data pipe with the name 'm5', type:") 
176  uf.desc[-1].add_prompt("relax> pipe.create('m5', 'mf')") 
177  uf.menu_text = "crea&te" 
178  uf.gui_icon = "oxygen.actions.list-add-relax-blue" 
179  uf.wizard_height_desc = 500 
180  uf.wizard_size = (1000, 750) 
181  uf.wizard_image = WIZARD_IMAGE_PATH + 'pipe.png' 
182   
183   
184  # The pipe.current user function. 
185  uf = uf_info.add_uf('pipe.current') 
186  uf.title = "Print the name of the current data pipe." 
187  uf.title_short = "Current data pipe printing." 
188  uf.display = True 
189  uf.backend = pipes.current 
190  # Prompt examples. 
191  uf.desc.append(Desc_container("Prompt examples")) 
192  uf.desc[-1].add_paragraph("To run the user function, type:") 
193  uf.desc[-1].add_prompt("relax> pipe.current()") 
194  uf.menu_text = "c&urrent" 
195  uf.gui_icon = "oxygen.actions.document-preview" 
196  uf.wizard_size = (600, 300) 
197  uf.wizard_image = WIZARD_IMAGE_PATH + 'pipe.png' 
198   
199   
200  # The pipe.delete user function. 
201  uf = uf_info.add_uf('pipe.delete') 
202  uf.title = "Delete a data pipe from the relax data store." 
203  uf.title_short = "Data pipe deletion." 
204  uf.add_keyarg( 
205      name = "pipe_name", 
206      py_type = "str", 
207      desc_short = "data pipe", 
208      desc = "The name of the data pipe to delete.", 
209      wiz_element_type = 'combo', 
210      wiz_combo_iter = pipes.pipe_names, 
211      can_be_none = True 
212  ) 
213  # Description. 
214  uf.desc.append(Desc_container()) 
215  uf.desc[-1].add_paragraph("This will permanently remove the data pipe and all of its contents from the relax data store.  If the pipe name is not given, then all data pipes will be deleted.") 
216  uf.backend = pipes.delete 
217  uf.menu_text = "&delete" 
218  uf.gui_icon = "oxygen.actions.list-remove" 
219  uf.wizard_image = WIZARD_IMAGE_PATH + 'pipe.png' 
220  uf.gui_sync = True    # Force synchronous operation to avoid the GUI from blowing up. 
221   
222   
223  # The pipe.display user function. 
224  uf = uf_info.add_uf('pipe.display') 
225  uf.title = "Print a list of all the data pipes." 
226  uf.title_short = "Data pipe listing." 
227  uf.display = True 
228  uf.backend = pipes.display 
229  # Prompt examples. 
230  uf.desc.append(Desc_container("Prompt examples")) 
231  uf.desc[-1].add_paragraph("To run the user function, type:") 
232  uf.desc[-1].add_prompt("relax> pipe.display()") 
233  uf.menu_text = "di&splay" 
234  uf.gui_icon = "oxygen.actions.document-preview" 
235  uf.wizard_size = (600, 300) 
236  uf.wizard_image = WIZARD_IMAGE_PATH + 'pipe.png' 
237   
238   
239  # The pipe.hybridise user function. 
240  uf = uf_info.add_uf('pipe.hybridise') 
241  uf.title = "Create a hybrid data pipe by fusing a number of other data pipes." 
242  uf.title_short = "Hybrid data pipe creation." 
243  uf.add_keyarg( 
244      name = "hybrid", 
245      py_type = "str", 
246      desc_short = "hybrid pipe name", 
247      desc = "The name of the hybrid data pipe to create." 
248  ) 
249  uf.add_keyarg( 
250      name = "pipes", 
251      py_type = "str_list", 
252      desc_short = "data pipes to hybridise", 
253      desc = "An array containing the names of all data pipes to hybridise.", 
254      wiz_element_type = 'combo_list', 
255      wiz_combo_iter = pipes.pipe_names, 
256      wiz_combo_list_min = 2 
257  ) 
258  uf.backend = hybrid_obj._hybridise 
259  # Description. 
260  uf.desc.append(Desc_container()) 
261  uf.desc[-1].add_paragraph("This user function can be used to construct hybrid models.  An example of the use of a hybrid model could be if the protein consists of two independent domains.  These two domains could be analysed separately, each having their own optimised diffusion tensors.  The N-terminal domain data pipe could be called 'N_sphere' while the C-terminal domain could be called 'C_ellipsoid'.  These two data pipes could then be hybridised into a single data pipe.  This hybrid data pipe can then be compared via model selection to a data pipe whereby the entire protein is assumed to have a single diffusion tensor.") 
262  uf.desc[-1].add_paragraph("The requirements for data pipes to be hybridised is that the molecules, sequences, and spin systems for all the data pipes is the same, and that no spin system is allowed to be selected in two or more data pipes.  The selections must not overlap to allow for rigorous statistical comparisons.") 
263  # Prompt examples. 
264  uf.desc.append(Desc_container("Prompt examples")) 
265  uf.desc[-1].add_paragraph("The two data pipes 'N_sphere' and 'C_ellipsoid' could be hybridised into a single data pipe called 'mixed model' by typing:") 
266  uf.desc[-1].add_prompt("relax> pipe.hybridise('mixed model', ['N_sphere', 'C_ellipsoid'])") 
267  uf.desc[-1].add_prompt("relax> pipe.hybridise(hybrid='mixed model', pipes=['N_sphere', 'C_ellipsoid'])") 
268  uf.menu_text = "&hybridise" 
269  uf.gui_icon = "relax.pipe_hybrid" 
270  uf.wizard_height_desc = 350 
271  uf.wizard_size = (1000, 750) 
272  uf.wizard_image = WIZARD_IMAGE_PATH + 'pipe_hybrid.png' 
273   
274   
275  # The pipe.switch user function. 
276  uf = uf_info.add_uf('pipe.switch') 
277  uf.title = "Switch between the data pipes of the relax data store." 
278  uf.title_short = "Data pipe switching." 
279  uf.add_keyarg( 
280      name = "pipe_name", 
281      py_type = "str", 
282      desc_short = "data pipe", 
283      desc = "The name of the data pipe.", 
284      wiz_element_type = 'combo', 
285      wiz_combo_iter = pipes.pipe_names 
286  ) 
287  uf.backend = pipes.switch 
288  # Description. 
289  uf.desc.append(Desc_container()) 
290  uf.desc[-1].add_paragraph("This will switch between the various data pipes within the relax data store.") 
291  # Prompt examples. 
292  uf.desc.append(Desc_container("Prompt examples")) 
293  uf.desc[-1].add_paragraph("To switch to the 'ellipsoid' data pipe, type:") 
294  uf.desc[-1].add_prompt("relax> pipe.switch('ellipsoid')") 
295  uf.desc[-1].add_prompt("relax> pipe.switch(pipe_name='ellipsoid')") 
296  uf.menu_text = "&switch" 
297  uf.gui_icon = "oxygen.actions.system-switch-user" 
298  uf.wizard_size = (700, 500) 
299  uf.wizard_apply_button = False 
300  uf.wizard_image = WIZARD_IMAGE_PATH + 'pipe_switch.png' 
301