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

Source Code for Module user_functions.noe'

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