mailr9843 - in /branches/bmrb: data/exp_info.py generic_fns/exp_info.py prompt/bmrb.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 - 14:31:
Author: bugman
Date: Thu Oct 29 14:31:33 2009
New Revision: 9843

URL: http://svn.gna.org/viewcvs/relax?rev=9843&view=rev
Log:
Created the bmrb.script() user function for specifying the scripts used in 
the analysis.


Modified:
    branches/bmrb/data/exp_info.py
    branches/bmrb/generic_fns/exp_info.py
    branches/bmrb/prompt/bmrb.py

Modified: branches/bmrb/data/exp_info.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/data/exp_info.py?rev=9843&r1=9842&r2=9843&view=diff
==============================================================================
--- branches/bmrb/data/exp_info.py (original)
+++ branches/bmrb/data/exp_info.py Thu Oct 29 14:31:33 2009
@@ -169,6 +169,73 @@
                 return self.temp_control[i].method
 
 
+    def setup_thiol(self, state):
+        """Set up the thiol state of the system.
+
+        @param thiol_state:     The thiol state of the molecule.
+        @type thiol_state:      str
+        """
+
+        # Check.
+        if hasattr(self, "thiol_state"):
+            raise RelaxError("The thiol state has already been specified")
+
+        # Set the attribute.
+        self.thiol_state = state
+
+
+    def setup_script(self, file=None, text=None, analysis_type=None, 
model_selection=None, engine=None, model_elim=False, 
universal_solution=False):
+        """Specify the scripts used in the analysis.
+
+        @param file:                    The name of the script file.
+        @type file:                     str
+        @param text:                    The script text.
+        @type text:                     str
+        @keyword analysis_type:         The type of analysis performed.
+        @type analysis_type:            str
+        @keyword model_selection:       The model selection technique used, 
if relevant.
+        @type model_selection:          None or str
+        @keyword engine:                The software engine used in the 
analysis.
+        @type engine:                   str
+        @keyword model_elim:            A model-free specific flag 
specifying if model elimination was performed.
+        @type model_elim:               bool
+        @keyword universal_solution:    A model-free specific flag 
specifying if the universal solution was sought after.
+        @type universal_solution:       bool
+        """
+
+        # Initialise the container if needed.
+        if not hasattr(self, "scripts"):
+            # The list.
+            self.scripts = ContainerList()
+
+            # The name of the container.
+            self.scripts.container_name = "script_list"
+
+            # The description of the container.
+            self.scripts.container_desc = "List of scripts used for the 
analysis"
+
+        # Init the container.
+        script = Element()
+
+        # The name of the container.
+        script.element_name = "script"
+
+        # The description of the container.
+        script.element_desc = "Script used for the analysis"
+
+        # Set the attributes.
+        script.file = file
+        script.text = text
+        script.analysis_type = analysis_type
+        script.model_selection = model_selection
+        script.engine = engine
+        script.model_elim = model_elim
+        script.universal_solution = universal_solution
+
+        # Append the container.
+        self.scripts.append(script)
+
+
     def software_setup(self, name, version=None, url=None, vendor_name=None, 
cite_ids=None, tasks=None):
         """Set up the software information.
 
@@ -306,18 +373,3 @@
 
         # Append the container.
         self.temp_control.append(temp_control)
-
-
-    def setup_thiol(self, state):
-        """Set up the thiol state of the system.
-
-        @param thiol_state:     The thiol state of the molecule.
-        @type thiol_state:      str
-        """
-
-        # Check.
-        if hasattr(self, "thiol_state"):
-            raise RelaxError("The thiol state has already been specified")
-
-        # Set the attribute.
-        self.thiol_state = state

Modified: branches/bmrb/generic_fns/exp_info.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/exp_info.py?rev=9843&r1=9842&r2=9843&view=diff
==============================================================================
--- branches/bmrb/generic_fns/exp_info.py (original)
+++ branches/bmrb/generic_fns/exp_info.py Thu Oct 29 14:31:33 2009
@@ -26,6 +26,7 @@
 # relax module imports.
 from data.exp_info import ExpInfo
 from relax_errors import RelaxError
+from relax_io import open_read_file
 from version import version_full
 
 
@@ -189,6 +190,50 @@
     cdp.exp_info.add_citation(cite_id=cite_id, 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 script(file=None, dir=None, analysis_type=None, model_selection=None, 
engine=None, model_elim=False, universal_solution=False):
+    """Specify the scripts used in the analysis.
+
+    @param file:                    The name of the file to open.
+    @type file:                     str
+    @param dir:                     The directory containing the file 
(defaults to the current directory if None).
+    @type dir:                      None or str
+    @keyword analysis_type:         The type of analysis performed.
+    @type analysis_type:            str
+    @keyword model_selection:       The model selection technique used, if 
relevant.
+    @type model_selection:          None or str
+    @keyword engine:                The software engine used in the analysis.
+    @type engine:                   str
+    @keyword model_elim:            A model-free specific flag specifying if 
model elimination was performed.
+    @type model_elim:               bool
+    @keyword universal_solution:    A model-free specific flag specifying if 
the universal solution was sought after.
+    @type universal_solution:       bool
+    """
+
+    # Check.
+    allowed = ['frame order',
+               'jw',
+               'mf',
+               'N-state',
+               'noe',
+               'relax_fit',
+               'srls'
+    ]
+    if analysis_type not in allowed:
+        raise RelaxError("The analysis type '%s' should be one of %s." % 
(analysis_type, allowed))
+
+    # Set up the experimental info data container, if needed.
+    if not hasattr(cdp, 'exp_info'):
+        cdp.exp_info = ExpInfo()
+
+    # Extract the text.
+    file = open_read_file(file, dir)
+    text = file.read()
+    file.close()
+
+    # Place the data in the container.
+    cdp.exp_info.setup_script(file=file, text=text, 
analysis_type=analysis_type, model_selection=model_selection, engine=engine, 
model_elim=model_elim, universal_solution=universal_solution)
+
+
 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.
 

Modified: branches/bmrb/prompt/bmrb.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/prompt/bmrb.py?rev=9843&r1=9842&r2=9843&view=diff
==============================================================================
--- branches/bmrb/prompt/bmrb.py (original)
+++ branches/bmrb/prompt/bmrb.py Thu Oct 29 14:31:33 2009
@@ -212,6 +212,117 @@
         bmrb.read(file=file, directory=dir, version=version)
 
 
+    def script(self, file='reduced', dir=None, analysis_type=None, 
model_selection=None, engine='relax', model_elim=False, 
universal_solution=False):
+        """Specify the scripts used in the analysis.
+
+        Keyword Arguments
+        ~~~~~~~~~~~~~~~~~
+
+        file:  The script file name.
+
+        dir:  The directory name.
+
+        analysis_type:  The type of analysis performed.
+
+        model_selection:  The model selection technique used, if relevant.
+
+        engine:  The software engine used in the analysis.
+
+        model_elim:  A model-free specific flag specifying if model 
elimination was performed.
+
+        universal_solution:  A model-free specific flag specifying if the 
universal solution was
+            sought after.
+
+
+        Description
+        ~~~~~~~~~~~
+
+        This user function allows scripts used in the analysis to be 
included in the BMRB
+        deposition.  The following addition information may need to be 
specified with the script.
+
+        The analysis_type must be set.  Allowable values include all the 
data pipe types used in
+        relax, ie:
+
+            'frame order':  The Frame Order theories,
+            'jw':  Reduced spectral density mapping,
+            'mf':  Model-free analysis,
+            'N-state':  N-state model of domain motions,
+            'noe':  Steady state NOE calculation,
+            'relax_fit':  Relaxation curve fitting,
+            'srls':  SRLS analysis.
+
+        The model_selection argument only needs to be set if the script 
selects between different
+        mathematical models.  This can be anything, but the following are 
recommended:
+
+            'AIC':  Akaike's Information Criteria.
+            'AICc':  Small sample size corrected AIC.
+            'BIC':  Bayesian or Schwarz Information Criteria.
+            'Bootstrap':  Bootstrap model selection.
+            'CV':  Single-item-out cross-validation.
+            'Expect':  The expected overall discrepancy (the true values of 
the parameters are
+                      required).
+            'Farrow':  Old model-free method by Farrow et al., 1994.
+            'Palmer':  Old model-free method by Mandel et al., 1995.
+            'Overall':  The realised overall discrepancy (the true values of 
the parameters are
+                      required).
+
+        The engine is the software used in the calculation, optimisation, 
etc.  This can be
+        anything, but those recognised by relax (automatic program info, 
citations, etc. added)
+        include:
+
+            'relax':  hence relax was used for the full analysis.
+            'modelfree4':  Art Palmer's Modelfree4 program was used for 
optimising the model-free
+                parameter values.
+            'dasha':  The Dasha program was used for optimising the 
model-free parameter values.
+            'curvefit':  Art Palmer's curvefit program was used to determine 
the R1 or R2 values.
+
+        The model_elim flag is model-free specific and should be set if the 
methods from
+        "d'Auvergne, E. J. and Gooley, P. R. (2006). Model-free model 
elimination: A new step in the
+        model-free dynamic analysis of NMR relaxation data. J. Biomol. NMR, 
35(2), 117-135." were
+        used.  This should be set to True for the full_analysis.py script.
+
+        The universal_solution flag is model-free specific and should be set 
if the methods from
+        "d'Auvergne E. J., Gooley P. R. (2007). Set theory formulation of 
the model-free problem and
+        the diffusion seeded model-free paradigm. Mol. Biosyst., 3(7), 
483-494." were used.  This
+        should be set to True for the full_analysis.py script.
+
+
+        Examples
+        ~~~~~~~~
+
+        For BMRB deposition, to specify that the full_analysis.py script was 
used, type one of:
+
+        relax> bmrb.script('full_analysis.py', 'model-free', 'AIC', 'relax', 
True, True)
+        relax> bmrb.script(file='full_analysis.py', dir=None, 
analysis_type='model-free',
+                           model_selection='AIC', engine='relax', 
model_elim=True,
+                           universal_solution=True)
+        """
+
+        # Function intro text.
+        if self.__relax__.interpreter.intro:
+            text = sys.ps3 + "bmrb.script("
+            text = text + "file=" + repr(file)
+            text = text + ", dir=" + repr(dir)
+            text = text + ", analysis_type=" + repr(analysis_type)
+            text = text + ", model_selection=" + repr(model_selection)
+            text = text + ", engine=" + repr(engine)
+            text = text + ", model_elim=" + repr(model_elim)
+            text = text + ", universal_solution=" + repr(universal_solution) 
+ ")"
+            print(text)
+
+        # The argument checks.
+        check.is_str(file, 'script file')
+        check.is_str(dir, 'directory', can_be_none=True)
+        check.is_str(analysis_type, 'analysis type')
+        check.is_str(model_selection, 'model selection', can_be_none=True)
+        check.is_str(engine, 'engine')
+        check.is_bool(model_elim, 'model elimination flag')
+        check.is_bool(universal_solution, 'universal solution flag')
+
+        # Execute the functional code.
+        exp_info.script(file=file, dir=dir, analysis_type=analysis_type, 
model_selection=model_selection, engine=engine, model_elim=model_elim, 
universal_solution=universal_solution)
+
+
     def software(self, name=None, version=None, url=None, vendor_name=None, 
cite_ids=None, tasks=None):
         """Specify the software used in the analysis.
 




Related Messages


Powered by MHonArc, Updated Thu Oct 29 15:00:02 2009