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