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 # Set the type. 153 self.peak_intensity_type[ri_id] = type
154 155
156 - def setup_thiol(self, state):
157 """Set up the thiol state of the system. 158 159 @param state: The thiol state of the molecule. 160 @type state: str 161 """ 162 163 # Set the attribute. 164 self.thiol_state = state
165 166
167 - 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):
168 """Specify the scripts used in the analysis. 169 170 @keyword file: The name of the script file. 171 @type file: str 172 @keyword dir: The directory containing the file (defaults to the current directory if None). 173 @type dir: None or str 174 @keyword cite_ids: The citation ID numbers. 175 @type cite_ids: None or str 176 @param text: The script text. 177 @type text: str 178 @keyword analysis_type: The type of analysis performed. 179 @type analysis_type: str 180 @keyword model_selection: The model selection technique used, if relevant. 181 @type model_selection: None or str 182 @keyword engine: The software engine used in the analysis. 183 @type engine: str 184 @keyword model_elim: A model-free specific flag specifying if model elimination was performed. 185 @type model_elim: bool 186 @keyword universal_solution: A model-free specific flag specifying if the universal solution was sought after. 187 @type universal_solution: bool 188 """ 189 190 # Initialise the container if needed. 191 if not hasattr(self, "scripts"): 192 # The list. 193 self.scripts = RelaxListType() 194 195 # The name of the container. 196 self.scripts.container_name = "script_list" 197 198 # The description of the container. 199 self.scripts.container_desc = "List of scripts used for the analysis" 200 201 # Init the container. 202 script = Element() 203 204 # The name of the container. 205 script.name = "script" 206 207 # The description of the container. 208 script.desc = "Script used for the analysis" 209 210 # Set the attributes. 211 script.file = file 212 script.dir = dir 213 script.cite_ids = cite_ids 214 script.text = text 215 script.analysis_type = analysis_type 216 script.model_selection = model_selection 217 script.engine = engine 218 script.model_elim = model_elim 219 script.universal_solution = universal_solution 220 221 # Append the container. 222 self.scripts.append(script)
223 224
225 - def software_setup(self, name, version=None, url=None, vendor_name=None, cite_ids=None, tasks=None):
226 """Set up the software information. 227 228 @param name: The name of the software program. 229 @type name: str 230 @keyword version: The program version. 231 @type version: None or str 232 @keyword url: The program's URL. 233 @type url: None or str 234 @keyword vendor_name: The name of the company or person behind the program. 235 @type vendor_name: str 236 @keyword cite_ids: The citation ID numbers. 237 @type cite_ids: None or str 238 @keyword tasks: The tasks performed by the program. 239 @type tasks: list of str 240 """ 241 242 # Initialise the container if needed. 243 if not hasattr(self, "software"): 244 # The list. 245 self.software = RelaxListType() 246 247 # The name of the container. 248 self.software.container_name = "software_list" 249 250 # The description of the container. 251 self.software.container_desc = "List of software programs used in the analysis" 252 253 # Init the container. 254 software = Element() 255 256 # The name of the container. 257 software.name = "software" 258 259 # The description of the container. 260 software.desc = "Software program used in the analysis" 261 262 # Set the attributes. 263 software.name = name 264 software.url = url 265 software.version = version 266 software.vendor_name = vendor_name 267 software.cite_ids = cite_ids 268 software.tasks = tasks 269 270 # Append the container. 271 self.software.append(software)
272 273
274 - def temp_calibration_setup(self, ri_id, method):
275 """Store the temperature calibration method. 276 277 @param ri_id: The relaxation data ID string. 278 @type ri_id: str 279 @param method: The temperature calibration method. 280 @type method: str 281 """ 282 283 # Initialise the container if needed. 284 if not hasattr(self, "temp_calibration"): 285 self.temp_calibration = {} 286 287 # Set the method. 288 self.temp_calibration[ri_id] = method
289 290
291 - def temp_control_setup(self, ri_id, method):
292 """Store the temperature control method. 293 294 @param ri_id: The relaxation data ID string. 295 @type ri_id: str 296 @param method: The temperature control method. 297 @type method: str 298 """ 299 300 # Initialise the container if needed. 301 if not hasattr(self, "temp_control"): 302 self.temp_control = {} 303 304 # Set the method. 305 self.temp_control[ri_id] = method
306