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

Source Code for Module user_functions.noe

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2004,2006,2008-2009,2012,2019 Edward d'Auvergne               # 
  4  # Copyright (C) 2008 Sebastien Morin                                          # 
  5  #                                                                             # 
  6  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  7  #                                                                             # 
  8  # This program is free software: you can redistribute it and/or modify        # 
  9  # it under the terms of the GNU General Public License as published by        # 
 10  # the Free Software Foundation, either version 3 of the License, or           # 
 11  # (at your option) any later version.                                         # 
 12  #                                                                             # 
 13  # This program is distributed in the hope that it will be useful,             # 
 14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 16  # GNU General Public License for more details.                                # 
 17  #                                                                             # 
 18  # You should have received a copy of the GNU General Public License           # 
 19  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  # Module docstring. 
 24  """The noe user function definitions.""" 
 25   
 26  # relax module imports. 
 27  from graphics import ANALYSIS_IMAGE_PATH 
 28  from pipe_control import noesy, spectrum 
 29  from specific_analyses.noe.uf import spectrum_type 
 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('noe') 
 36  uf_class.title = "Class for handling steady-state NOE and NOESY data." 
 37  uf_class.menu_text = "&noe" 
 38  uf_class.gui_icon = "relax.noe" 
 39   
 40   
 41  # The noe.read_restraints user function. 
 42  uf = uf_info.add_uf('noe.read_restraints') 
 43  uf.title = "Read NOESY or ROESY restraints from a file." 
 44  uf.title_short = "Restraint reading." 
 45  uf.add_keyarg( 
 46      name = "file", 
 47      arg_type = "file sel read", 
 48      desc_short = "file name", 
 49      desc = "The name of the file containing the restraint data.", 
 50  ) 
 51  uf.add_keyarg( 
 52      name = "dir", 
 53      arg_type = "dir", 
 54      desc_short = "directory name", 
 55      desc = "The directory where the file is located.", 
 56      can_be_none = True 
 57  ) 
 58  uf.add_keyarg( 
 59      name = "proton1_col", 
 60      basic_types = ["int"], 
 61      desc_short = "first proton column", 
 62      desc = "The column containing the first proton of the NOE or ROE cross peak.", 
 63      wiz_element_type = "text", 
 64      can_be_none = True 
 65  ) 
 66  uf.add_keyarg( 
 67      name = "proton2_col", 
 68      basic_types = ["int"], 
 69      desc_short = "second proton column", 
 70      desc = "The column containing the second proton of the NOE or ROE cross peak.", 
 71      wiz_element_type = "text", 
 72      can_be_none = True 
 73  ) 
 74  uf.add_keyarg( 
 75      name = "lower_col", 
 76      basic_types = ["int"], 
 77      desc_short = "lower bound column", 
 78      desc = "The column containing the lower NOE bound.", 
 79      wiz_element_type = "text", 
 80      can_be_none = True 
 81  ) 
 82  uf.add_keyarg( 
 83      name = "upper_col", 
 84      basic_types = ["int"], 
 85      desc_short = "upper bound column", 
 86      desc = "The column containing the upper NOE bound.", 
 87      wiz_element_type = "text", 
 88      can_be_none = True 
 89  ) 
 90  uf.add_keyarg( 
 91      name = "sep", 
 92      basic_types = ["str"], 
 93      desc_short = "column separator", 
 94      desc = "The column separator (the default is white space).", 
 95      wiz_element_type = "combo", 
 96      wiz_combo_choices = [",", ";", "\\t"], 
 97      can_be_none = True 
 98  ) 
 99  # Description. 
100  uf.desc.append(Desc_container()) 
101  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.") 
102  # Prompt examples. 
103  uf.desc.append(Desc_container("Prompt examples")) 
104  uf.desc[-1].add_paragraph("To read the Xplor formatted restraint file 'NOE.xpl', type one of:") 
105  uf.desc[-1].add_prompt("relax> noe.read_restraints('NOE.xpl')") 
106  uf.desc[-1].add_prompt("relax> noe.read_restraints(file='NOE.xpl')") 
107  uf.desc[-1].add_paragraph("To read the generic formatted file 'noes', type one of:") 
108  uf.desc[-1].add_prompt("relax> noe.read_restraints(file='NOE.xpl', proton1_col=0, proton2_col=1, lower_col=2, upper_col=3)") 
109  uf.backend = noesy.read_restraints 
110  uf.menu_text = "&read_restraints" 
111  uf.gui_icon = "oxygen.actions.document-open" 
112  uf.wizard_size = (800, 600) 
113  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'noe_200x200.png' 
114   
115   
116  # The noe.spectrum_type user function. 
117  uf = uf_info.add_uf('noe.spectrum_type') 
118  uf.title = "Set the steady-state NOE spectrum type for pre-loaded peak intensities." 
119  uf.title_short = "Steady-state NOE spectrum type." 
120  uf.add_keyarg( 
121      name = "spectrum_type", 
122      basic_types = ["str"], 
123      desc_short = "spectrum type", 
124      desc = "The type of steady-state NOE spectrum, one of 'ref' for the reference spectrum or 'sat' for the saturated spectrum.", 
125      wiz_element_type = "combo", 
126      wiz_combo_choices = ["Reference spectrum", "Saturated spectrum"], 
127      wiz_combo_data = ["ref", "sat"], 
128      wiz_read_only = True, 
129  ) 
130  uf.add_keyarg( 
131      name = "spectrum_id", 
132      basic_types = ["str"], 
133      desc_short = "spectrum ID string", 
134      desc = "The spectrum ID string.", 
135      wiz_element_type = 'combo', 
136      wiz_combo_iter = spectrum.get_ids, 
137      wiz_read_only = True 
138  ) 
139  # Description. 
140  uf.desc.append(Desc_container()) 
141  uf.desc[-1].add_paragraph("The spectrum type can be one of the following:") 
142  uf.desc[-1].add_list_element("The steady-state NOE reference spectrum.") 
143  uf.desc[-1].add_list_element("The steady-state NOE spectrum with proton saturation turned on.") 
144  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.") 
145  uf.backend = spectrum_type 
146  uf.menu_text = "&spectrum_type" 
147  uf.gui_icon = "oxygen.actions.edit-rename" 
148  uf.wizard_height_desc = 350 
149  uf.wizard_size = (800, 600) 
150  uf.wizard_image = ANALYSIS_IMAGE_PATH + 'noe_200x200.png' 
151