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

Source Code for Module data.exp_info

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