mailr9838 - in /branches/bmrb/bmrblib/experimental_details: __init__.py method.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on October 29, 2009 - 11:23:
Author: bugman
Date: Thu Oct 29 11:23:53 2009
New Revision: 9838

URL: http://svn.gna.org/viewcvs/relax?rev=9838&view=rev
Log:
Added support for the method saveframe.


Added:
    branches/bmrb/bmrblib/experimental_details/method.py
      - copied, changed from r9831, 
branches/bmrb/bmrblib/experimental_details/software.py
Modified:
    branches/bmrb/bmrblib/experimental_details/__init__.py

Modified: branches/bmrb/bmrblib/experimental_details/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/experimental_details/__init__.py?rev=9838&r1=9837&r2=9838&view=diff
==============================================================================
--- branches/bmrb/bmrblib/experimental_details/__init__.py (original)
+++ branches/bmrb/bmrblib/experimental_details/__init__.py Thu Oct 29 
11:23:53 2009
@@ -27,4 +27,6 @@
 http://www.bmrb.wisc.edu/dictionary/3.1html/SuperGroupPage.html.
 """
 
-__all__ = []
+__all__ = ['method',
+           'software'
+]

Copied: branches/bmrb/bmrblib/experimental_details/method.py (from r9831, 
branches/bmrb/bmrblib/experimental_details/software.py)
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/experimental_details/method.py?p2=branches/bmrb/bmrblib/experimental_details/method.py&p1=branches/bmrb/bmrblib/experimental_details/software.py&r1=9831&r2=9838&rev=9838&view=diff
==============================================================================
--- branches/bmrb/bmrblib/experimental_details/software.py (original)
+++ branches/bmrb/bmrblib/experimental_details/method.py Thu Oct 29 11:23:53 
2009
@@ -21,9 +21,9 @@
 
###############################################################################
 
 # Module docstring.
-"""The software saveframe category.
-
-For example, see 
http://www.bmrb.wisc.edu/dictionary/3.1html_frame/frame_SaveFramePage.html#software
+"""The method saveframe category.
+
+For example, see 
http://www.bmrb.wisc.edu/dictionary/3.1html_frame/frame_SaveFramePage.html#method
 """
 
 # relax module imports.
@@ -33,8 +33,8 @@
 from bmrblib.misc import translate
 
 
-class SoftwareSaveframe(BaseSaveframe):
-    """The software saveframe class."""
+class MethodSaveframe(BaseSaveframe):
+    """The method saveframe class."""
 
     def __init__(self, datanodes):
         """Initialise the class, placing the pystarlib data nodes into the 
namespace.
@@ -46,131 +46,116 @@
         # Place the data nodes into the namespace.
         self.datanodes = datanodes
 
-        # The number of software programs used.
-        self.software_num = 0
+        # The number of methods used.
+        self.method_num = 0
 
         # Add the specific tag category objects.
         self.add_tag_categories()
 
 
-    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.
+    def add(self, name=None, details=None, cite_ids=None, file_name=None, 
file_text=None, param_file_name=None, param_file_text=None):
+        """Add the method info to the data nodes.
+
+        @keyword name:              The unique name describing this method.
         @type name:                 str
-        @keyword version:           The software version.
-        @type version:              None or str
-        @keyword vendor_name:       The vendor or developers of the software.
-        @type vendor_name:          None or str
-        @keyword vendor_address:    The vendor address.
-        @type vendor_address:       None or str
-        @keyword vendor_eaddress:   The vendor electronic address.
-        @type vendor_eaddress:      None or str
-        @keyword task:              The task of the software.
-        @type task:                 str
+        @keyword details:           Text description providing additional 
information about the reported method.
+        @type details:              None or str
         @keyword cite_ids:          The citation ID numbers.
         @type cite_ids:             None or list of int
-        @return:                    The software ID number.
-        @rtype:                     int
-        """
+        @keyword file_name:         The name of the file containing the 
source code or protocol for the reported method.
+        @type file_name:            str
+        @keyword file_text:         The method provided as an ASCII text 
document that is included in the NMR-STAR file.
+        @type file_text:            str
+        @keyword param_file_name:   The name of the file that contains 
parameters required to execute the method.
+        @type param_file_name:      None or str
+        @keyword param_file_text:   The text of the parameter file.
+        @type param_file_text:      None or str
+        """
+
+        # Check that nothing is missing.
+        no_missing(name, 'method name')
 
         # Check.
-        if not isinstance(task, list):
-            raise NameError, "The task argument '%s' is invalid." % task
+        if not isinstance(cite_ids, list):
+            raise NameError, "The cite_ids argument '%s' should be a list." 
% cite_ids
 
         # Place the args into the namespace.
-        self.program_name = name
-        self.program_version = version
-        self.vendor_name = translate(vendor_name)
-        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
-        self.software_id_num = [str(translate(self.software_num))]
+        self.method_num = self.method_num + 1
+        self.method_id_num = [str(translate(self.method_num))]
 
         # The category name.
-        self.cat_name = ['Software']
+        self.cat_name = ['Method']
 
         # Initialise the save frame.
-        self.frame = SaveFrame(title=self.program_name)
+        self.frame = SaveFrame(title='method')
 
         # Create the tag categories.
-        self.Software.create()
-        self.Software_citation.create()
-        self.Vendor.create()
-        self.Task.create()
+        self.Method.create()
+        self.Method_citation.create()
+        self.Method_file.create()
+        self.Method_parameter_file.create()
 
         # Add the saveframe to the data nodes.
         self.datanodes.append(self.frame)
 
-        # Return the software ID number.
-        return self.software_num
-
 
     def add_tag_categories(self):
         """Create the tag categories."""
 
         # The tag category objects.
-        self.Software = Software(self)
-        self.Software_citation = SoftwareCitation(self)
-        self.Task = Task(self)
-        self.Vendor = Vendor(self)
-
-
-
-class Software(TagCategory):
-    """Base class for the Software tag category."""
-
-    def create(self):
-        """Create the Software tag category."""
-
-        # The save frame category.
+        self.Method = Method(self)
+        self.Method_citation = MethodCitation(self)
+        self.Method_file = MethodFile(self)
+        self.Method_parameter_file = MethodParam(self)
+
+
+
+class Method(TagCategory):
+    """Base class for the Method tag category."""
+
+    def create(self):
+        """Create the Method tag category."""
+
+        # The tags.
         self.sf.frame.tagtables.append(self.create_tag_table([['SfCategory', 
'cat_name']], free=True))
-
-        # Software ID number.
-        self.sf.frame.tagtables.append(TagTable(free=True, 
tagnames=[self.tag_names_full['SoftwareID']], 
tagvalues=[[str(self.sf.software_num)]]))
-
-        # The program name.
-        self.sf.frame.tagtables.append(TagTable(free=True, 
tagnames=[self.tag_names_full['Name']], tagvalues=[[self.sf.program_name]]))
-
-        # The program version.
-        if self.sf.program_version:
-            self.sf.frame.tagtables.append(TagTable(free=True, 
tagnames=[self.tag_names_full['Version']], 
tagvalues=[[self.sf.program_version]]))
-
-
-    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
-        """
-
-        # Execute the base class tag_setup() method.
-        TagCategory.tag_setup(self, tag_category_label='Software', sep=sep)
+        self.sf.frame.tagtables.append(TagTable(free=True, 
tagnames=[self.tag_names_full['SfFramecode']], 
tagvalues=[[str(self.sf.method_name)]]))
+        self.sf.frame.tagtables.append(TagTable(free=True, 
tagnames=[self.tag_names_full['MethodID']], 
tagvalues=[[str(self.sf.method_num)]]))
+        self.sf.frame.tagtables.append(TagTable(free=True, 
tagnames=[self.tag_names_full['Details']], tagvalues=[[self.sf.details]]))
+
+
+    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
+        """
+
+        # Execute the base class tag_setup() method.
+        TagCategory.tag_setup(self, tag_category_label='Method', sep=sep)
 
         # Tag names for the relaxation data.
         self.tag_names['SfCategory'] = 'Sf_category'
-        self.tag_names['SoftwareID'] = 'ID'
-        self.tag_names['Name'] = 'Name'
-        self.tag_names['Version'] = 'Version'
-
-
-class SoftwareCitation(TagCategory):
-    """Base class for the SoftwareCitation tag category."""
-
-
-    def create(self):
-        """Create the Software tag category."""
+        self.tag_names['SfFramecode'] = 'Sf_framecode'
+        self.tag_names['MethodID'] = 'ID'
+        self.tag_names['Details'] = 'Details'
+
+
+class MethodCitation(TagCategory):
+    """Base class for the MethodCitation tag category."""
+
+
+    def create(self):
+        """Create the Method tag category."""
 
         # Keys and objects.
         info = [
             ['CitationID',      'cite_ids'],
-            ['SoftwareID',      'software_id_num']
+            ['MethodID',        'method_id_num']
         ]
 
         # Get the TabTable.
@@ -191,26 +176,27 @@
 
         # Category label.
         if not tag_category_label:
-            tag_category_label='Software_citation'
+            tag_category_label='Method_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):
-    """Base class for the Task tag category."""
-
-    def create(self):
-        """Create the Task tag category."""
+        self.tag_names['MethodID'] = 'Method_ID'
+
+
+class MethodFile(TagCategory):
+    """Base class for the MethodFile tag category."""
+
+    def create(self):
+        """Create the MethodFile tag category."""
 
         # Keys and objects.
         info = [
-            ['Task',                'task'],
-            ['SoftwareID',          'software_id_num']
+            ['Name',                'file_name'],
+            ['Text',                'text'],
+            ['MethodID',            'method_id_num']
         ]
 
         # Get the TabTable.
@@ -230,25 +216,26 @@
         """
 
         # Execute the base class tag_setup() method.
-        TagCategory.tag_setup(self, tag_category_label='Task', sep=sep)
-
-        # Tag names for the relaxation data.
-        self.tag_names['Task'] = 'Task'
-        self.tag_names['SoftwareID'] = 'SoftwareID'
-
-
-class Vendor(TagCategory):
-    """Base class for the Vendor tag category."""
-
-    def create(self):
-        """Create the Vendor tag category."""
+        TagCategory.tag_setup(self, tag_category_label='Method_file', 
sep=sep)
+
+        # Tag names for the relaxation data.
+        self.tag_names['Name'] = 'Name'
+        self.tag_names['Text'] = 'Text'
+        self.tag_names['MethodID'] = 'Method_ID'
+
+
+class MethodParam(TagCategory):
+    """Base class for the MethodParam tag category."""
+
+    def create(self):
+        """Create the MethodParam tag category."""
 
         # Keys and objects.
         info = [
-            ['Name',                'vendor_name'],
-            ['Address',             'vendor_address'],
-            ['ElectronicAddress',   'vendor_eaddress'],
-            ['SoftwareID',          'software_id_num']
+            ['FileName',            'param_file_name'],
+            ['TextFormat',          'text_format'],
+            ['Text',                'param_file_text'],
+            ['MethodID',            'method_id_num']
         ]
 
         # Get the TabTable.
@@ -268,10 +255,10 @@
         """
 
         # Execute the base class tag_setup() method.
-        TagCategory.tag_setup(self, tag_category_label='Vendor', sep=sep)
-
-        # Tag names for the relaxation data.
-        self.tag_names['Name'] = 'Name'
-        self.tag_names['Address'] = 'Address'
-        self.tag_names['ElectronicAddress'] = 'Electronic_address'
-        self.tag_names['SoftwareID'] = 'SoftwareID'
+        TagCategory.tag_setup(self, tag_category_label='Method_param', 
sep=sep)
+
+        # Tag names for the relaxation data.
+        self.tag_names['FileName'] =    'File_name'
+        self.tag_names['TextFormat'] =  'Text_format'
+        self.tag_names['Text'] =        'Text'
+        self.tag_names['MethodID'] =    'Method_ID'




Related Messages


Powered by MHonArc, Updated Thu Oct 29 11:40:03 2009