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

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