Package user_functions :: Module noe
[hide private]
[frames] | no frames]

Source Code for Module user_functions.noe

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2004-2014 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 noe user function definitions.""" 
 24   
 25  # Python module imports. 
 26  import dep_check 
 27  if dep_check.wx_module: 
 28      from wx import FD_OPEN 
 29  else: 
 30      FD_OPEN = -1 
 31   
 32  # relax module imports. 
 33  from graphics import ANALYSIS_IMAGE_PATH 
 34  from pipe_control import noesy, spectrum 
 35  from specific_analyses.noe.uf import spectrum_type 
 36  from user_functions.data import Uf_info; uf_info = Uf_info() 
 37  from user_functions.objects import Desc_container 
 38   
 39   
 40  # The user function class. 
 41  uf_class = uf_info.add_class('noe') 
 42  uf_class.title = "Class for handling steady-state NOE and NOESY data." 
 43  uf_class.menu_text = "&noe" 
 44  uf_class.gui_icon = "relax.noe" 
 45   
 46   
 47  # The noe.read_restraints user function. 
 48  uf = uf_info.add_uf('noe.read_restraints') 
 49  uf.title = "Read NOESY or ROESY restraints from a file." 
 50  uf.title_short = "Restraint reading." 
 51  uf.add_keyarg( 
 52      name = "file", 
 53      py_type = "str", 
 54      arg_type = "file sel", 
 55      desc_short = "file name", 
 56      desc = "The name of the file containing the restraint data.", 
 57      wiz_filesel_style = FD_OPEN 
 58  ) 
 59  uf.add_keyarg( 
 60      name = "dir", 
 61      py_type = "str", 
 62      arg_type = "dir", 
 63      desc_short = "directory name", 
 64      desc = "The directory where the file is located.", 
 65      can_be_none = True 
 66  ) 
 67  uf.add_keyarg( 
 68      name = "proton1_col", 
 69      py_type = "int", 
 70      desc_short = "first proton column", 
 71      desc = "The column containing the first proton of the NOE or ROE cross peak.", 
 72      wiz_element_type = "text", 
 73      can_be_none = True 
 74  ) 
 75  uf.add_keyarg( 
 76      name = "proton2_col", 
 77      py_type = "int", 
 78      desc_short = "second proton column", 
 79      desc = "The column containing the second proton of the NOE or ROE cross peak.", 
 80      wiz_element_type = "text", 
 81      can_be_none = True 
 82  ) 
 83  uf.add_keyarg( 
 84      name = "lower_col", 
 85      py_type = "int", 
 86      desc_short = "lower bound column", 
 87      desc = "The column containing the lower NOE bound.", 
 88      wiz_element_type = "text", 
 89      can_be_none = True 
 90  ) 
 91  uf.add_keyarg( 
 92      name = "upper_col", 
 93      py_type = "int", 
 94      desc_short = "upper bound column", 
 95      desc = "The column containing the upper NOE bound.", 
 96      wiz_element_type = "text", 
 97      can_be_none = True 
 98  ) 
 99  uf.add_keyarg( 
100      name = "sep", 
101      py_type = "str", 
102      desc_short = "column separator", 
103      desc = "The column separator (the default is white space).", 
104      wiz_element_type = "combo", 
105      wiz_combo_choices = [",", ";", "\\t"], 
106      can_be_none = True 
107  ) 
108  # Description. 
109  uf.desc.append(Desc_container()) 
110  uf.desc[-1].add_paragraph("The format of the file will be automatically determined, for example Xplor formatted restraint files.  A generically formatted file is also supported if it contains minimally four columns with the two proton names and the upper and lower bounds, as specified by the column numbers.  The proton names need to be in the spin ID string format.") 
111  # Prompt examples. 
112  uf.desc.append(Desc_container("Prompt examples")) 
113  uf.desc[-1].add_paragraph("To read the Xplor formatted restraint file 'NOE.xpl', type one of:") 
114  uf.desc[-1].add_prompt("relax> noe.read_restraints('NOE.xpl')") 
115  uf.desc[-1].add_prompt("relax> noe.read_restraints(file='NOE.xpl')") 
116  uf.desc[-1].add_paragraph("To read the generic formatted file 'noes', type one of:") 
117  uf.desc[-1].add_prompt("relax> noe.read_restraints(file='NOE.xpl', proton1_col=0, proton2_col=1, lower_col=2, upper_col=3)") 
118  uf.backend = noesy.read_restraints 
119  uf.menu_text = "&read_restraints" 
120  uf.gui_icon = "oxygen.actions.document-open" 
121  uf.wizard_size = (800, 600) 
122  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'noe_200x200.png' 
123   
124   
125  # The noe.spectrum_type user function. 
126  uf = uf_info.add_uf('noe.spectrum_type') 
127  uf.title = "Set the steady-state NOE spectrum type for pre-loaded peak intensities." 
128  uf.title_short = "Steady-state NOE spectrum type." 
129  uf.add_keyarg( 
130      name = "spectrum_type", 
131      py_type = "str", 
132      desc_short = "spectrum type", 
133      desc = "The type of steady-state NOE spectrum, one of 'ref' for the reference spectrum or 'sat' for the saturated spectrum.", 
134      wiz_element_type = "combo", 
135      wiz_combo_choices = ["Reference spectrum", "Saturated spectrum"], 
136      wiz_combo_data = ["ref", "sat"], 
137      wiz_read_only = True, 
138  ) 
139  uf.add_keyarg( 
140      name = "spectrum_id", 
141      py_type = "str", 
142      desc_short = "spectrum ID string", 
143      desc = "The spectrum ID string.", 
144      wiz_element_type = 'combo', 
145      wiz_combo_iter = spectrum.get_ids, 
146      wiz_read_only = True 
147  ) 
148  # Description. 
149  uf.desc.append(Desc_container()) 
150  uf.desc[-1].add_paragraph("The spectrum type can be one of the following:") 
151  uf.desc[-1].add_list_element("The steady-state NOE reference spectrum.") 
152  uf.desc[-1].add_list_element("The steady-state NOE spectrum with proton saturation turned on.") 
153  uf.desc[-1].add_paragraph("Peak intensities should be loaded before this user function via the spectrum.read_intensities user function.  The intensity values will then be associated with a spectrum ID string which can be used here.") 
154  uf.backend = spectrum_type 
155  uf.menu_text = "&spectrum_type" 
156  uf.gui_icon = "oxygen.actions.edit-rename" 
157  uf.wizard_height_desc = 350 
158  uf.wizard_size = (800, 600) 
159  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'noe_200x200.png' 
160