Package data :: Module exp_info
[hide private]
[frames] | no frames]

Source Code for Module data.exp_info

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2009-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  """Module holding the experimental information data container.""" 
 25   
 26  # relax module imports. 
 27  from data_classes import RelaxListType, Element 
 28  from relax_errors import RelaxError 
 29   
 30   
31 -class ExpInfo(Element):
32 """The experimental information data container.""" 33
34 - def __init__(self):
35 """Initialise the data container.""" 36 37 # The name of the container. 38 self.name = "exp_info" 39 40 # The description of the container. 41 self.desc = "Experimental information" 42 43 # Blacklisted objects. 44 self.blacklist = ["citations", "software", "temp_calibration", "temp_control"]
45 46
47 - def add_citation(self, cite_id=None, authors=None, doi=None, pubmed_id=None, full_citation=None, title=None, status=None, type=None, journal_abbrev=None, journal_full=None, volume=None, issue=None, page_first=None, page_last=None, year=None):
48 """Store a citation. 49 50 @keyword cite_id: The citation ID string. 51 @type cite_id: str 52 @keyword authors: The list of authors. Each author element is a list of four elements: the first name, last name, first initial, and middle initials. 53 @type authors: list of lists of str 54 @keyword doi: The DOI number, e.g. "10.1000/182". 55 @type doi: None or str 56 @keyword pubmed_id: The identification code assigned to the publication by PubMed. 57 @type pubmed_id: None or int 58 @keyword full_citation: A full citation in a format similar to that used in a journal article by either cutting and pasting from another document or by typing. Please include author names, title, journal, page numbers, and year or equivalent information for the type of publication given. 59 @type full_citation: str 60 @keyword title: The title of the publication. 61 @type title: str 62 @keyword status: The publication status. Can be one of in "preparation", "in press", "published", "retracted", or "submitted". 63 @type status: str 64 @keyword type: The publication type. Can be one of "abstract", "BMRB only", "book", "book chapter", "internet", "journal", "personal communication", or "thesis". 65 @type type: str 66 @keyword journal_abbrev: A standard journal abbreviation as defined by the Chemical Abstract Services for the journal where the data are or will be published. If the data in the deposition are related to a J. Biomol. NMR paper, the value must be 'J. Biomol. NMR' to alert the BMRB annotators so that the deposition is properly processed. If the depositor truly does not know the journal, a value of 'not known' or 'na' is acceptable. 67 @type journal_abbrev: str 68 @keyword journal_full: The full journal name. 69 @type journal_full: str 70 @keyword volume: The volume number. 71 @type volume: int 72 @keyword issue: The issue number. 73 @type issue: int 74 @keyword page_first: The first page number. 75 @type page_first: int 76 @keyword page_last: The last page number. 77 @type page_last: int 78 @keyword year: The publication year. 79 @type year: int 80 """ 81 82 # Initialise the list container if needed. 83 if not hasattr(self, "citations"): 84 # The list. 85 self.citations = RelaxListType() 86 87 # The name of the container. 88 self.citations.container_name = "citation_list" 89 90 # The description of the container. 91 self.citations.container_desc = "List of citations" 92 93 # Init the container. 94 cite = Element() 95 96 # The name of the container. 97 cite.name = "citation" 98 99 # The description of the container. 100 cite.desc = "Literature citation" 101 102 # Set the attributes. 103 cite.cite_id = cite_id 104 cite.authors = authors 105 cite.doi = doi 106 cite.pubmed_id = pubmed_id 107 cite.full_citation = full_citation 108 cite.title = title 109 cite.status = status 110 cite.type = type 111 cite.journal_abbrev = journal_abbrev 112 cite.journal_full = journal_full 113 cite.volume = volume 114 cite.issue = issue 115 cite.page_first = page_first 116 cite.page_last = page_last 117 cite.year = year 118 119 # Append the container. 120 self.citations.append(cite)
121 122
123 - def get_cite_id_num(self, cite_id):
124 """Return the citation ID number for the given citation ID string. 125 126 @param cite_id: The citation ID string. 127 @type cite_id: str 128 @return: The citation ID number. 129 @rtype: int 130 """ 131 132 # Loop over the citations. 133 for i in range(len(self.citations)): 134 # Match. 135 if self.citations[i].cite_id == cite_id: 136 return i + 1
137 138
139 - def setup_peak_intensity_type(self, ri_id, type):
140 """Store the peak intensity type. 141 142 @param ri_id: The relaxation data ID string. 143 @type ri_id: str 144 @param type: The peak intensity type, one of 'height' or 'volume'. 145 @type type: str 146 """ 147 148 # Initialise the container if needed. 149 if not hasattr(self, "peak_intensity_type"): 150 self.peak_intensity_type = {} 151 152 # Find if the type has already been set. 153 if ri_id in self.peak_intensity_type.keys(): 154 raise RelaxError("The peak intensity type for the '%s' relaxation data ID string has already been set.") 155 156 # Set the type. 157 self.peak_intensity_type[ri_id] = type
158 159
160 - def setup_thiol(self, state):
161 """Set up the thiol state of the system. 162 163 @param state: The thiol state of the molecule. 164 @type state: str 165 """ 166 167 # Check. 168 if hasattr(self, "thiol_state"): 169 raise RelaxError("The thiol state has already been specified") 170 171 # Set the attribute. 172 self.thiol_state = state
173 174
175 - def setup_script(self, file=None, dir=None, cite_ids=None, text=None, analysis_type=None, model_selection=None, engine=None, model_elim=False, universal_solution=False):
176 """Specify the scripts used in the analysis. 177 178 @keyword file: The name of the script file. 179 @type file: str 180 @keyword dir: The directory containing the file (defaults to the current directory if None). 181 @type dir: None or str 182 @keyword cite_ids: The citation ID numbers. 183 @type cite_ids: None or str 184 @param text: The script text. 185 @type text: str 186 @keyword analysis_type: The type of analysis performed. 187 @type analysis_type: str 188 @keyword model_selection: The model selection technique used, if relevant. 189 @type model_selection: None or str 190 @keyword engine: The software engine used in the analysis. 191 @type engine: str 192 @keyword model_elim: A model-free specific flag specifying if model elimination was performed. 193 @type model_elim: bool 194 @keyword universal_solution: A model-free specific flag specifying if the universal solution was sought after. 195 @type universal_solution: bool 196 """ 197 198 # Initialise the container if needed. 199 if not hasattr(self, "scripts"): 200 # The list. 201 self.scripts = RelaxListType() 202 203 # The name of the container. 204 self.scripts.container_name = "script_list" 205 206 # The description of the container. 207 self.scripts.container_desc = "List of scripts used for the analysis" 208 209 # Init the container. 210 script = Element() 211 212 # The name of the container. 213 script.name = "script" 214 215 # The description of the container. 216 script.desc = "Script used for the analysis" 217 218 # Set the attributes. 219 script.file = file 220 script.dir = dir 221 script.cite_ids = cite_ids 222 script.text = text 223 script.analysis_type = analysis_type 224 script.model_selection = model_selection 225 script.engine = engine 226 script.model_elim = model_elim 227 script.universal_solution = universal_solution 228 229 # Append the container. 230 self.scripts.append(script)
231 232
233 - def software_setup(self, name, version=None, url=None, vendor_name=None, cite_ids=None, tasks=None):
234 """Set up the software information. 235 236 @param name: The name of the software program. 237 @type name: str 238 @keyword version: The program version. 239 @type version: None or str 240 @keyword url: The program's URL. 241 @type url: None or str 242 @keyword vendor_name: The name of the company or person behind the program. 243 @type vendor_name: str 244 @keyword cite_ids: The citation ID numbers. 245 @type cite_ids: None or str 246 @keyword tasks: The tasks performed by the program. 247 @type tasks: list of str 248 """ 249 250 # Initialise the container if needed. 251 if not hasattr(self, "software"): 252 # The list. 253 self.software = RelaxListType() 254 255 # The name of the container. 256 self.software.container_name = "software_list" 257 258 # The description of the container. 259 self.software.container_desc = "List of software programs used in the analysis" 260 261 # Init the container. 262 software = Element() 263 264 # The name of the container. 265 software.name = "software" 266 267 # The description of the container. 268 software.desc = "Software program used in the analysis" 269 270 # Set the attributes. 271 software.name = name 272 software.url = url 273 software.version = version 274 software.vendor_name = vendor_name 275 software.cite_ids = cite_ids 276 software.tasks = tasks 277 278 # Append the container. 279 self.software.append(software)
280 281
282 - def temp_calibration_setup(self, ri_id, method):
283 """Store the temperature calibration method. 284 285 @param ri_id: The relaxation data ID string. 286 @type ri_id: str 287 @param method: The temperature calibration method. 288 @type method: str 289 """ 290 291 # Initialise the container if needed. 292 if not hasattr(self, "temp_calibration"): 293 self.temp_calibration = {} 294 295 # Find if the method has already been set. 296 if ri_id in self.temp_calibration.keys(): 297 raise RelaxError("The temperature calibration method for the '%s' relaxation data ID string has already been set.") 298 299 # Set the method. 300 self.temp_calibration[ri_id] = method
301 302
303 - def temp_control_setup(self, ri_id, method):
304 """Store the temperature control method. 305 306 @param ri_id: The relaxation data ID string. 307 @type ri_id: str 308 @param method: The temperature control method. 309 @type method: str 310 """ 311 312 # Initialise the container if needed. 313 if not hasattr(self, "temp_control"): 314 self.temp_control = {} 315 316 # Find if the method has already been set. 317 if ri_id in self.temp_control.keys(): 318 raise RelaxError("The temperature control method for the '%s' relaxation data ID string has already been set.") 319 320 # Set the method. 321 self.temp_control[ri_id] = method
322