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

Source Code for Module prompt.pipe

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2004-2011 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 'pipe' user function class.""" 
 25  __docformat__ = 'plaintext' 
 26   
 27  # relax module imports. 
 28  from base_class import User_fn_class, _build_doc 
 29  import arg_check 
 30  from generic_fns import pipes 
 31  from relax_errors import RelaxError 
 32  from specific_fns.setup import hybrid_obj 
 33   
 34   
35 -class Pipe(User_fn_class):
36 """Class for holding the functions for manipulating data pipes.""" 37
38 - def copy(self, pipe_from=None, pipe_to=None):
39 # Function intro text. 40 if self._exec_info.intro: 41 text = self._exec_info.ps3 + "pipe.copy(" 42 text = text + "pipe_from=" + repr(pipe_from) 43 text = text + ", pipe_to=" + repr(pipe_to) + ")" 44 print(text) 45 46 # The argument checks. 47 arg_check.is_str(pipe_from, 'pipe from', can_be_none=True) 48 arg_check.is_str(pipe_to, 'pipe to', can_be_none=True) 49 50 # Both pipe arguments cannot be None. 51 if pipe_from == None and pipe_to == None: 52 raise RelaxError("The pipe_from and pipe_to arguments cannot both be set to None.") 53 54 # Execute the functional code. 55 pipes.copy(pipe_from=pipe_from, pipe_to=pipe_to)
56 57 # The function doc info. 58 copy._doc_title = "Copy a data pipe." 59 copy._doc_title_short = "Data pipe copying." 60 copy._doc_args = [ 61 ["pipe_from", "The name of the source data pipe to copy the data from."], 62 ["pipe_to", "The name of the target data pipe to copy the data to."] 63 ] 64 copy._doc_desc = """ 65 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. 66 """ 67 copy._doc_examples = """ 68 To copy the contents of the 'm1' data pipe to the 'm2' data pipe, type: 69 70 relax> pipe.copy('m1', 'm2') 71 relax> pipe.copy(pipe_from='m1', pipe_to='m2') 72 73 If the current data pipe is 'm1', then the following command can be used: 74 75 relax> pipe.copy(pipe_to='m2') 76 """ 77 _build_doc(copy) 78 79
80 - def create(self, pipe_name=None, pipe_type=None):
81 # Function intro text. 82 if self._exec_info.intro: 83 text = self._exec_info.ps3 + "pipe.create(" 84 text = text + "pipe_name=" + repr(pipe_name) 85 text = text + ", pipe_type=" + repr(pipe_type) + ")" 86 print(text) 87 88 # The argument checks. 89 arg_check.is_str(pipe_name, 'data pipe name') 90 arg_check.is_str(pipe_type, 'data pipe type') 91 92 # Execute the functional code. 93 pipes.create(pipe_name=pipe_name, pipe_type=pipe_type)
94 95 # The function doc info. 96 create._doc_title = "Add a new data pipe to the relax data store." 97 create._doc_title_short = "Data pipe creation." 98 create._doc_args = [ 99 ["pipe_name", "The name of the data pipe."], 100 ["pipe_type", "The type of data pipe."] 101 ] 102 create._doc_desc = """ 103 The data pipe name can be any string however the data pipe type can only be one of the following: 104 105 'ct': Consistency testing, 106 'frame order': The Frame Order theories, 107 'jw': Reduced spectral density mapping, 108 'hybrid': A special hybrid pipe, 109 'mf': Model-free analysis, 110 'N-state': N-state model of domain motions, 111 'noe': Steady state NOE calculation, 112 'relax_fit': Relaxation curve fitting, 113 """ 114 create._doc_examples = """ 115 To set up a model-free analysis data pipe with the name 'm5', type: 116 117 relax> pipe.create('m5', 'mf') 118 """ 119 _build_doc(create) 120 121
122 - def current(self):
123 # Function intro text. 124 if self._exec_info.intro: 125 text = self._exec_info.ps3 + "pipe.current()" 126 print(text) 127 128 # Execute the functional code. 129 pipes.current()
130 131 # The function doc info. 132 current._doc_title = "Print the name of the current data pipe." 133 current._doc_title_short = "Current data pipe printing." 134 current._doc_examples = """ 135 To run the user function, type: 136 137 relax> pipe.current() 138 """ 139 _build_doc(current) 140 141
142 - def delete(self, pipe_name=None):
143 # Function intro text. 144 if self._exec_info.intro: 145 text = self._exec_info.ps3 + "pipe.delete(" 146 text = text + "pipe_name=" + repr(pipe_name) + ")" 147 print(text) 148 149 # The argument checks. 150 arg_check.is_str(pipe_name, 'data pipe name', can_be_none=True) 151 152 # Execute the functional code. 153 pipes.delete(pipe_name=pipe_name)
154 155 # The function doc info. 156 delete._doc_title = "Delete a data pipe from the relax data store." 157 delete._doc_title_short = "Data pipe deletion." 158 delete._doc_args = [ 159 ["pipe_name", "The name of the data pipe to delete."] 160 ] 161 delete._doc_desc = """ 162 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. 163 """ 164 _build_doc(delete) 165 166
167 - def display(self):
168 # Function intro text. 169 if self._exec_info.intro: 170 text = self._exec_info.ps3 + "pipe.display()" 171 print(text) 172 173 # Execute the functional code. 174 pipes.display()
175 176 # The function doc info. 177 display._doc_title = "Print a list of all the data pipes." 178 display._doc_title_short = "Data pipe listing." 179 display._doc_examples = """ 180 To run the user function, type: 181 182 relax> pipe.display() 183 """ 184 _build_doc(display) 185 186
187 - def hybridise(self, hybrid=None, pipes=None):
188 # Function intro text. 189 if self._exec_info.intro: 190 text = self._exec_info.ps3 + "pipe.hybridise(" 191 text = text + "hybrid=" + repr(hybrid) 192 text = text + ", pipes=" + repr(pipes) + ")" 193 print(text) 194 195 # The argument checks. 196 arg_check.is_str(hybrid, 'hybrid pipe name') 197 arg_check.is_str_list(pipes, 'data pipes') 198 199 # Execute the functional code. 200 hybrid_obj._hybridise(hybrid=hybrid, pipe_list=pipes)
201 202 # The function doc info. 203 hybridise._doc_title = "Create a hybrid data pipe by fusing a number of other data pipes." 204 hybridise._doc_title_short = "Hybrid data pipe creation." 205 hybridise._doc_args = [ 206 ["hybrid", "The name of the hybrid data pipe to create."], 207 ["pipes", "An array containing the names of all data pipes to hybridise."] 208 ] 209 hybridise._doc_desc = """ 210 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. 211 212 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. 213 """ 214 hybridise._doc_examples = """ 215 The two data pipes 'N_sphere' and 'C_ellipsoid' could be hybridised into a single data pipe 216 called 'mixed model' by typing: 217 218 relax> pipe.hybridise('mixed model', ['N_sphere', 'C_ellipsoid']) 219 relax> pipe.hybridise(hybrid='mixed model', pipes=['N_sphere', 'C_ellipsoid']) 220 """ 221 _build_doc(hybridise) 222 223
224 - def switch(self, pipe_name=None):
225 # Function intro text. 226 if self._exec_info.intro: 227 text = self._exec_info.ps3 + "pipe.switch(" 228 text = text + "pipe_name=" + repr(pipe_name) + ")" 229 print(text) 230 231 # The argument checks. 232 arg_check.is_str(pipe_name, 'data pipe name') 233 234 # Execute the functional code. 235 pipes.switch(pipe_name=pipe_name)
236 237 # The function doc info. 238 switch._doc_title = "Switch between the data pipes of the relax data store." 239 switch._doc_title_short = "Data pipe switching." 240 switch._doc_args = [ 241 ["pipe_name", "The name of the data pipe."] 242 ] 243 switch._doc_desc = """ 244 This will switch between the various data pipes within the relax data store. 245 """ 246 switch._doc_examples = """ 247 To switch to the 'ellipsoid' data pipe, type: 248 249 relax> pipe.switch('ellipsoid') 250 relax> pipe.switch(pipe_name='ellipsoid') 251 """ 252 _build_doc(switch)
253