1   
  2   
  3   
  4   
  5   
  6   
  7   
  8   
  9   
 10   
 11   
 12   
 13   
 14   
 15   
 16   
 17   
 18   
 19   
 20   
 21   
 22   
 23   
 24  """Module holding the experimental information data container.""" 
 25   
 26   
 27  from data_classes import RelaxListType, Element 
 28  from relax_errors import RelaxError 
 29   
 30   
 32      """The experimental information data container.""" 
 33   
 35          """Initialise the data container.""" 
 36   
 37           
 38          self.name = "exp_info" 
 39   
 40           
 41          self.desc = "Experimental information" 
 42   
 43           
 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           
 83          if not hasattr(self, "citations"): 
 84               
 85              self.citations = RelaxListType() 
 86   
 87               
 88              self.citations.container_name = "citation_list" 
 89   
 90               
 91              self.citations.container_desc = "List of citations" 
 92   
 93           
 94          cite = Element() 
 95   
 96           
 97          cite.name = "citation" 
 98   
 99           
100          cite.desc = "Literature citation" 
101   
102           
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           
120          self.citations.append(cite) 
 121   
122   
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           
133          for i in range(len(self.citations)): 
134               
135              if self.citations[i].cite_id == cite_id: 
136                  return i + 1 
 137   
138   
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           
149          if not hasattr(self, "peak_intensity_type"): 
150              self.peak_intensity_type = {} 
151   
152           
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           
157          self.peak_intensity_type[ri_id] = type 
 158   
159   
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           
168          if hasattr(self, "thiol_state"): 
169              raise RelaxError("The thiol state has already been specified") 
170   
171           
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           
199          if not hasattr(self, "scripts"): 
200               
201              self.scripts = RelaxListType() 
202   
203               
204              self.scripts.container_name = "script_list" 
205   
206               
207              self.scripts.container_desc = "List of scripts used for the analysis" 
208   
209           
210          script = Element() 
211   
212           
213          script.name = "script" 
214   
215           
216          script.desc = "Script used for the analysis" 
217   
218           
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           
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           
251          if not hasattr(self, "software"): 
252               
253              self.software = RelaxListType() 
254   
255               
256              self.software.container_name = "software_list" 
257   
258               
259              self.software.container_desc = "List of software programs used in the analysis" 
260   
261           
262          software = Element() 
263   
264           
265          software.name = "software" 
266   
267           
268          software.desc = "Software program used in the analysis" 
269   
270           
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           
279          self.software.append(software) 
 280   
281   
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           
292          if not hasattr(self, "temp_calibration"): 
293              self.temp_calibration = {} 
294   
295           
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           
300          self.temp_calibration[ri_id] = method 
 301   
302   
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           
313          if not hasattr(self, "temp_control"): 
314              self.temp_control = {} 
315   
316           
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           
321          self.temp_control[ri_id] = method 
  322