Author: bugman Date: Tue Oct 13 20:00:34 2009 New Revision: 9763 URL: http://svn.gna.org/viewcvs/relax?rev=9763&view=rev Log: The BMRB SoftwareCitation tag category is now being created. This points back to the relevant Citation saveframe. Modified: branches/bmrb/bmrblib/experimental_details/software.py branches/bmrb/data/exp_info.py branches/bmrb/generic_fns/bmrb.py branches/bmrb/generic_fns/exp_info.py branches/bmrb/prompt/bmrb.py Modified: branches/bmrb/bmrblib/experimental_details/software.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/experimental_details/software.py?rev=9763&r1=9762&r2=9763&view=diff ============================================================================== --- branches/bmrb/bmrblib/experimental_details/software.py (original) +++ branches/bmrb/bmrblib/experimental_details/software.py Tue Oct 13 20:00:34 2009 @@ -53,7 +53,7 @@ self.add_tag_categories() - def add(self, name, version=None, vendor_name=None, vendor_address=None, vendor_eaddress=None, task=None): + def add(self, name, version=None, vendor_name=None, vendor_address=None, vendor_eaddress=None, task=None, cite_ids=None): """Add the software info to the data nodes. @param name: The name of the software program. @@ -68,6 +68,8 @@ @type vendor_eaddress: None or str @keyword task: The task of the software. @type task: str + @keyword cite_ids: The citation ID numbers. + @type cite_ids: None or list of int """ # Check. @@ -81,6 +83,7 @@ self.vendor_address = translate(vendor_address) self.vendor_eaddress = translate(vendor_eaddress) self.task = translate(task) + self.cite_ids = translate(cite_ids) # Increment the ID number. self.software_num = self.software_num + 1 @@ -94,6 +97,7 @@ # Create the tag categories. self.Software.create() + self.Software_citation.create() self.Vendor.create() self.Task.create() @@ -116,7 +120,7 @@ """Base class for the Software tag category.""" def create(self): - """Create the ChemShiftAnisotropy tag category.""" + """Create the Software tag category.""" # The save frame category. self.sf.frame.tagtables.append(self.create_tag_table([['SfCategory', 'cat_name']], free=True)) @@ -153,6 +157,43 @@ class SoftwareCitation(TagCategory): """Base class for the SoftwareCitation tag category.""" + + + def create(self): + """Create the Software tag category.""" + + # Keys and objects. + info = [ + ['CitationID', 'cite_ids'], + ['SoftwareID', 'software_id_num'] + ] + + # Get the TabTable. + table = self.create_tag_table(info) + + # Add the tagtable to the save frame. + self.sf.frame.tagtables.append(table) + + + def tag_setup(self, tag_category_label=None, sep=None): + """Replacement method for setting up the tag names. + + @keyword tag_category_label: The tag name prefix specific for the tag category. + @type tag_category_label: None or str + @keyword sep: The string separating the tag name prefix and suffix. + @type sep: str + """ + + # Category label. + if not tag_category_label: + tag_category_label='Software_citation' + + # Execute the base class tag_setup() method. + TagCategory.tag_setup(self, tag_category_label=tag_category_label, sep=sep) + + # Tag names for the relaxation data. + self.tag_names['CitationID'] = 'Citation_ID' + self.tag_names['SoftwareID'] = 'Software_ID' class Task(TagCategory): Modified: branches/bmrb/data/exp_info.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/data/exp_info.py?rev=9763&r1=9762&r2=9763&view=diff ============================================================================== --- branches/bmrb/data/exp_info.py (original) +++ branches/bmrb/data/exp_info.py Tue Oct 13 20:00:34 2009 @@ -121,7 +121,7 @@ return len(self.citations) - def software_setup(self, name, version=None, url=None, vendor_name=None, cite=None, tasks=None): + def software_setup(self, name, version=None, url=None, vendor_name=None, cite_ids=None, tasks=None): """Set up the software information. @param name: The name of the software program. @@ -132,8 +132,8 @@ @type url: None or str @keyword vendor_name: The name of the company or person behind the program. @type vendor_name: str - @keyword cite: The literature citation. - @type cite: None or str + @keyword cite_ids: The citation ID numbers. + @type cite_ids: None or str @keyword tasks: The tasks performed by the program. @type tasks: list of str """ @@ -163,7 +163,7 @@ software.url = url software.version = version software.vendor_name = vendor_name - software.cite = cite + software.cite_ids = cite_ids software.tasks = tasks # Append the container. Modified: branches/bmrb/generic_fns/bmrb.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/bmrb.py?rev=9763&r1=9762&r2=9763&view=diff ============================================================================== --- branches/bmrb/generic_fns/bmrb.py (original) +++ branches/bmrb/generic_fns/bmrb.py Tue Oct 13 20:00:34 2009 @@ -29,9 +29,11 @@ # relax module imports. from data import Relax_data_store; ds = Relax_data_store() from data.exp_info import ExpInfo +from generic_fns import exp_info from relax_errors import RelaxError, RelaxFileError, RelaxFileOverwriteError, RelaxNoPipeError from relax_io import get_file_path, mkdir_nofail from specific_fns.setup import get_specific_fn +from version import version_full def display(version='3.1'): @@ -100,5 +102,12 @@ # Create the directories. mkdir_nofail(directory, verbosity=0) + # Add the relax citations. + cite1 = cdp.exp_info.add_citation(authors=exp_info.RELAX_CITE1_AUTHORS, doi=exp_info.RELAX_CITE1_DOI, pubmed_id=exp_info.RELAX_CITE1_PUBMED_ID, full_citation=exp_info.RELAX_CITE1_FULL_CITATION, title=exp_info.RELAX_CITE1_TITLE, status=exp_info.RELAX_CITE1_STATUS, type=exp_info.RELAX_CITE1_TYPE, journal_abbrev=exp_info.RELAX_CITE1_JOURNAL_ABBREV, journal_full=exp_info.RELAX_CITE1_JOURNAL_FULL, volume=exp_info.RELAX_CITE1_VOLUME, issue=exp_info.RELAX_CITE1_ISSUE, page_first=exp_info.RELAX_CITE1_PAGE_FIRST, page_last=exp_info.RELAX_CITE1_PAGE_LAST, year=exp_info.RELAX_CITE1_YEAR) + cite2 = cdp.exp_info.add_citation(authors=exp_info.RELAX_CITE2_AUTHORS, doi=exp_info.RELAX_CITE2_DOI, pubmed_id=exp_info.RELAX_CITE2_PUBMED_ID, full_citation=exp_info.RELAX_CITE2_FULL_CITATION, title=exp_info.RELAX_CITE2_TITLE, status=exp_info.RELAX_CITE2_STATUS, type=exp_info.RELAX_CITE2_TYPE, journal_abbrev=exp_info.RELAX_CITE2_JOURNAL_ABBREV, journal_full=exp_info.RELAX_CITE2_JOURNAL_FULL, volume=exp_info.RELAX_CITE2_VOLUME, issue=exp_info.RELAX_CITE2_ISSUE, page_first=exp_info.RELAX_CITE2_PAGE_FIRST, page_last=exp_info.RELAX_CITE2_PAGE_LAST, year=exp_info.RELAX_CITE2_YEAR) + + # Add the relax software package. + cdp.exp_info.software_setup(name=exp_info.RELAX_NAME, version=version_full(), vendor_name=exp_info.RELAX_AUTHORS, url=exp_info.RELAX_URL, cite_ids=[cite1, cite2], tasks=exp_info.RELAX_TASKS) + # Execute the specific BMRB writing code. write_function(file_path, version=version) Modified: branches/bmrb/generic_fns/exp_info.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/exp_info.py?rev=9763&r1=9762&r2=9763&view=diff ============================================================================== --- branches/bmrb/generic_fns/exp_info.py (original) +++ branches/bmrb/generic_fns/exp_info.py Tue Oct 13 20:00:34 2009 @@ -87,10 +87,6 @@ @type star: NMR_STAR instance """ - # First add relax. - cite1 = cdp.exp_info.add_citation(authors=RELAX_CITE1_AUTHORS, doi=RELAX_CITE1_DOI, pubmed_id=RELAX_CITE1_PUBMED_ID, full_citation=RELAX_CITE1_FULL_CITATION, title=RELAX_CITE1_TITLE, status=RELAX_CITE1_STATUS, type=RELAX_CITE1_TYPE, journal_abbrev=RELAX_CITE1_JOURNAL_ABBREV, journal_full=RELAX_CITE1_JOURNAL_FULL, volume=RELAX_CITE1_VOLUME, issue=RELAX_CITE1_ISSUE, page_first=RELAX_CITE1_PAGE_FIRST, page_last=RELAX_CITE1_PAGE_LAST, year=RELAX_CITE1_YEAR) - cite2 = cdp.exp_info.add_citation(authors=RELAX_CITE2_AUTHORS, doi=RELAX_CITE2_DOI, pubmed_id=RELAX_CITE2_PUBMED_ID, full_citation=RELAX_CITE2_FULL_CITATION, title=RELAX_CITE2_TITLE, status=RELAX_CITE2_STATUS, type=RELAX_CITE2_TYPE, journal_abbrev=RELAX_CITE2_JOURNAL_ABBREV, journal_full=RELAX_CITE2_JOURNAL_FULL, volume=RELAX_CITE2_VOLUME, issue=RELAX_CITE2_ISSUE, page_first=RELAX_CITE2_PAGE_FIRST, page_last=RELAX_CITE2_PAGE_LAST, year=RELAX_CITE2_YEAR) - # Loop over the citations. if hasattr(cdp, 'exp_info') and hasattr(cdp.exp_info, 'citations'): for citations in cdp.exp_info.citations: @@ -104,14 +100,11 @@ @type star: NMR_STAR instance """ - # First add relax. - star.software.add(name=RELAX_NAME, version=version_full(), vendor_name=RELAX_AUTHORS, vendor_eaddress=RELAX_URL, task=RELAX_TASKS) - # Loop over the software. if hasattr(cdp, 'exp_info') and hasattr(cdp.exp_info, 'software'): for software in cdp.exp_info.software: # The program info. - star.software.add(name=software.name, version=software.version, vendor_name=software.vendor_name, vendor_eaddress=software.url, task=software.tasks) + star.software.add(name=software.name, version=software.version, vendor_name=software.vendor_name, vendor_eaddress=software.url, task=software.tasks, cite_ids=software.cite_ids) # relax cannot be the only program used! else: @@ -156,10 +149,10 @@ cdp.exp_info = ExpInfo() # Place the data in the container. - cdp.exp_info.add_citation(authors=authors, doi=doi, pubmed_id=pubmed_id, full_citation=full_citation, title=title, status=status, type=type, journal_abbrev=journal_abbrev, journal_full=journal_full, volume=volume, issue=issue, page_first=page_first, page_last=page_last, year=year) - - -def software(name=None, version=None, url=None, vendor_name=None, cite=None, tasks=None): + return cdp.exp_info.add_citation(authors=authors, doi=doi, pubmed_id=pubmed_id, full_citation=full_citation, title=title, status=status, type=type, journal_abbrev=journal_abbrev, journal_full=journal_full, volume=volume, issue=issue, page_first=page_first, page_last=page_last, year=year) + + +def software(name=None, version=None, url=None, vendor_name=None, cite_ids=None, tasks=None): """Select by name the software used in the analysis. @param name: The name of the software program. @@ -170,8 +163,8 @@ @type url: None or str @keyword vendor_name: The name of the company or person behind the program. @type vendor_name: str - @keyword cite: The literature citation. - @type cite: None or str + @keyword cite_ids: The citation ID numbers. + @type cite:_ids None or str @keyword tasks: The tasks performed by the program. @type tasks: list of str """ @@ -181,7 +174,7 @@ cdp.exp_info = ExpInfo() # Place the data in the container. - cdp.exp_info.software_setup(name=name, version=version, url=url, vendor_name=vendor_name, cite=cite, tasks=tasks) + cdp.exp_info.software_setup(name=name, version=version, url=url, vendor_name=vendor_name, cite_ids=cite_ids, tasks=tasks) def software_select(name, version=None): @@ -208,7 +201,7 @@ cite2 = cdp.exp_info.add_citation(authors=RELAX_CITE2_AUTHORS, doi=RELAX_CITE2_DOI, pubmed_id=RELAX_CITE2_PUBMED_ID, full_citation=RELAX_CITE2_FULL_CITATION, title=RELAX_CITE2_TITLE, status=RELAX_CITE2_STATUS, type=RELAX_CITE2_TYPE, journal_abbrev=RELAX_CITE2_JOURNAL_ABBREV, journal_full=RELAX_CITE2_JOURNAL_FULL, volume=RELAX_CITE2_VOLUME, issue=RELAX_CITE2_ISSUE, page_first=RELAX_CITE2_PAGE_FIRST, page_last=RELAX_CITE2_PAGE_LAST, year=RELAX_CITE2_YEAR) # Add the software info. - cdp.exp_info.software_setup(name=RELAX_NAME, version=version_full(), vendor_name=RELAX_AUTHORS, url=RELAX_URL, cite=[cite1, cite2], tasks=RELAX_TASKS) + cdp.exp_info.software_setup(name=RELAX_NAME, version=version_full(), vendor_name=RELAX_AUTHORS, url=RELAX_URL, cite_ids=[cite1, cite2], tasks=RELAX_TASKS) # NMRPipe. if name == 'NMRPipe': @@ -216,7 +209,7 @@ #cite_index = cdp.exp_info.add_citation(authors=[["The relax development team", None, None, None]]) cite_index = 1 - cdp.exp_info.software_setup(name=NMRPIPE_NAME, version=version, vendor_name=NMRPIPE_AUTHORS, url=NMRPIPE_URL, cite=cite_index, tasks=NMRPIPE_TASKS) + cdp.exp_info.software_setup(name=NMRPIPE_NAME, version=version, vendor_name=NMRPIPE_AUTHORS, url=NMRPIPE_URL, cite_ids=[cite_index], tasks=NMRPIPE_TASKS) # Sparky. elif name == 'Sparky': @@ -229,4 +222,4 @@ cite_index = 1 # Add the data. - cdp.exp_info.software_setup(name=SPARKY_NAME, version=version, vendor_name=SPARKY_AUTHORS, url=SPARKY_URL, cite=cite_index, tasks=SPARKY_TASKS) + cdp.exp_info.software_setup(name=SPARKY_NAME, version=version, vendor_name=SPARKY_AUTHORS, url=SPARKY_URL, cite_ids=[cite_index], tasks=SPARKY_TASKS) Modified: branches/bmrb/prompt/bmrb.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/prompt/bmrb.py?rev=9763&r1=9762&r2=9763&view=diff ============================================================================== --- branches/bmrb/prompt/bmrb.py (original) +++ branches/bmrb/prompt/bmrb.py Tue Oct 13 20:00:34 2009 @@ -158,7 +158,7 @@ check.is_int(year, 'publication year') # Execute the functional code. - exp_info.citation(authors=authors, doi=doi, pubmed_id=pubmed_id, full_citation=full_citation, title=title, status=status, type=type, journal_abbrev=journal_abbrev, journal_full=journal_full, volume=volume, issue=issue, page_first=page_first, page_last=page_last, year=year) + return exp_info.citation(authors=authors, doi=doi, pubmed_id=pubmed_id, full_citation=full_citation, title=title, status=status, type=type, journal_abbrev=journal_abbrev, journal_full=journal_full, volume=volume, issue=issue, page_first=page_first, page_last=page_last, year=year) def display(self, version='3.1'): @@ -208,7 +208,7 @@ bmrb.read(file=file, directory=dir, version=version) - def software(self, name=None, version=None, url=None, vendor_name=None, cite=None, tasks=None): + def software(self, name=None, version=None, url=None, vendor_name=None, cite_ids=None, tasks=None): """Specify the software used in the analysis. Keyword Arguments @@ -222,7 +222,7 @@ vendor_name: The name of the company or person behind the program. - cite: The literature citation for the software. + cite_ids: A list of the citation ID numbers. tasks: A list of all the tasks performed by the software. @@ -251,10 +251,11 @@ For BMRB deposition, to say that Sparky was used in the analysis, type: + relax> cite_id = bmrb.citation(authors=[['Tom', 'Goddard', 'T.', 'D.'], ['D', 'Kneller', + 'D.', 'G.']], title=""Goddard, T. D. and Kneller, D. G., SPARKY 3, University of + California, San Francisco." relax> bmrb.software('Sparky', version='3.110', url="http://www.cgl.ucsf.edu/home/sparky/", - vendor_name="Goddard, T. D.", cite="Goddard, T. D. and Kneller, D. G., - SPARKY 3, University of California, San Francisco.", - tasks=["spectral analysis"]) + vendor_name="Goddard, T. D.", cite_ids=[cite_id], tasks=["spectral analysis"]) """ # Function intro text. @@ -264,7 +265,7 @@ text = text + ", version=" + repr(version) text = text + ", url=" + repr(url) text = text + ", vendor_name=" + repr(vendor_name) - text = text + ", cite=" + repr(cite) + text = text + ", cite_ids=" + repr(cite_ids) text = text + ", tasks=" + repr(tasks) + ")" print(text) @@ -273,11 +274,11 @@ check.is_str(version, 'version', can_be_none=True) check.is_str(url, 'url', can_be_none=True) check.is_str(vendor_name, 'vendor_name', can_be_none=True) - check.is_str(cite, 'cite', can_be_none=True) + check.is_int_list(cite_ids, 'citation ID numbers', can_be_none=True) check.is_str_list(tasks, 'tasks', can_be_none=True) # Execute the functional code. - exp_info.software(name=name, version=version, url=url, vendor_name=vendor_name, cite=cite, tasks=tasks) + exp_info.software(name=name, version=version, url=url, vendor_name=vendor_name, cite_ids=cite_ids, tasks=tasks) def software_select(self, name=None, version=None):