mailr9722 - in /branches/bmrb: generic_fns/bmrb.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 11, 2009 - 15:59:
Author: bugman
Date: Sun Oct 11 15:59:38 2009
New Revision: 9722

URL: http://svn.gna.org/viewcvs/relax?rev=9722&view=rev
Log:
Shifted the software() and software_select() functions into their own module, 
'generic_fns.exp_info'.


Added:
    branches/bmrb/generic_fns/exp_info.py
      - copied, changed from r9721, branches/bmrb/generic_fns/bmrb.py
Modified:
    branches/bmrb/generic_fns/bmrb.py
    branches/bmrb/prompt/bmrb.py

Modified: branches/bmrb/generic_fns/bmrb.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/bmrb.py?rev=9722&r1=9721&r2=9722&view=diff
==============================================================================
--- branches/bmrb/generic_fns/bmrb.py (original)
+++ branches/bmrb/generic_fns/bmrb.py Sun Oct 11 15:59:38 2009
@@ -73,62 +73,6 @@
     read_function(file_path, version=version)
 
 
-def software(name=None, version=None, url=None, vendor_name=None, cite=None, 
tasks=None):
-    """Select by name the software used in the analysis.
-
-    @param name:            The name of the software program.
-    @type name:             str
-    @keyword version:       The program version.
-    @type version:          None or str
-    @keyword url:           The program's URL.
-    @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 tasks:         The tasks performed by the program.
-    @type tasks:            list of str
-    """
-
-    # Set up the experimental info data container, if needed.
-    if not hasattr(cdp, 'exp_info'):
-        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)
-
-
-def software_select(name, version=None):
-    """Select by name the software used in the analysis.
-
-    @param name:        The name of the software program.
-    @type name:         str
-    @keyword version:   The program version.
-    @type version:      None or str
-    """
-
-    # Unknown program.
-    if name not in ['NMRPipe', 'Sparky']:
-        raise RelaxError("The software '%s' is unknown.  Please use the user 
function for manually specifying software details instead." % name)
-
-    # Set up the experimental info data container, if needed.
-    if not hasattr(cdp, 'exp_info'):
-        cdp.exp_info = ExpInfo()
-
-    # NMRPipe.
-    if name == 'NMRPipe':
-        cdp.exp_info.software_setup('NMRPipe', version=version, 
url="http://spin.niddk.nih.gov/NMRPipe/";, vendor_name="Delaglio, F.", 
cite="Delaglio, F., Grzesiek, S., Vuister, G. W., Zhu, G., Pfeifer, J., and 
Bax, A. (1995).  NMRPipe: a multidimensional spectral processing system based 
on UNIX pipes.  J. Biomol. NMR. 6, 277-293.", tasks=["processing"])
-
-    # Sparky.
-    elif name == 'Sparky':
-        # Check if the version information has been supplied.
-        if not version:
-            raise RelaxError("The Sparky version number has not been 
supplied.")
-
-        # Add the data.
-        cdp.exp_info.software_setup('Sparky', version=version, 
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"])
-
-
 def write(file=None, directory=None, version='3.1', force=False):
     """Create a BMRB NMR-STAR formatted file."""
 

Copied: branches/bmrb/generic_fns/exp_info.py (from r9721, 
branches/bmrb/generic_fns/bmrb.py)
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/exp_info.py?p2=branches/bmrb/generic_fns/exp_info.py&p1=branches/bmrb/generic_fns/bmrb.py&r1=9721&r2=9722&rev=9722&view=diff
==============================================================================
--- branches/bmrb/generic_fns/bmrb.py (original)
+++ branches/bmrb/generic_fns/exp_info.py Sun Oct 11 15:59:38 2009
@@ -21,56 +21,11 @@
 
###############################################################################
 
 # Module docstring.
-"""Module containing functions for BMRB support."""
-
-# Python module imports.
-from os import F_OK, access
+"""Module containing functions for specifying the experimental details."""
 
 # relax module imports.
-from data import Relax_data_store; ds = Relax_data_store()
 from data.exp_info import ExpInfo
-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
-
-
-def display(version='3.1'):
-    """Display the results in the BMRB NMR-STAR format."""
-
-    # Test if the current data pipe exists.
-    if not ds.current_pipe:
-        raise RelaxNoPipeError
-
-    # Specific results writing function.
-    write_function = get_specific_fn('bmrb_write', 
ds[ds.current_pipe].pipe_type, raise_error=False)
-
-    # Write the results.
-    write_function(sys.stdout, version=version)
-
-
-def read(file=None, directory=None, version='3.1'):
-    """Read the contents of a BMRB NMR-STAR formatted file."""
-
-    # Test if the current data pipe exists.
-    if not ds.current_pipe:
-        raise RelaxNoPipeError
-
-    # Make sure that the data pipe is empty.
-    if not ds[ds.current_pipe].is_empty():
-        raise RelaxError("The current data pipe is not empty.")
-
-    # Get the full file path.
-    file_path = get_file_path(file_name=file, dir=directory)
-
-    # Fail if the file does not exist.
-    if not access(file_path, F_OK):
-        raise RelaxFileError(file_path)
-
-    # Specific results reading function.
-    read_function = get_specific_fn('bmrb_read', 
ds[ds.current_pipe].pipe_type)
-
-    # Read the results.
-    read_function(file_path, version=version)
+from relax_errors import RelaxError
 
 
 def software(name=None, version=None, url=None, vendor_name=None, cite=None, 
tasks=None):
@@ -127,34 +82,3 @@
 
         # Add the data.
         cdp.exp_info.software_setup('Sparky', version=version, 
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"])
-
-
-def write(file=None, directory=None, version='3.1', force=False):
-    """Create a BMRB NMR-STAR formatted file."""
-
-    # Test if the current data pipe exists.
-    if not ds.current_pipe:
-        raise RelaxNoPipeError
-
-    # The special data pipe name directory.
-    if directory == 'pipe_name':
-        directory = ds.current_pipe
-
-    # Specific results writing function.
-    write_function = get_specific_fn('bmrb_write', 
ds[ds.current_pipe].pipe_type)
-
-    # Get the full file path.
-    file_path = get_file_path(file, directory)
-
-    # Fail if the file already exists and the force flag is False.
-    if access(file_path, F_OK) and not force:
-        raise RelaxFileOverwriteError(file_path, 'force flag')
-
-    # Print out.
-    print("Opening the file '%s' for writing." % file_path)
-
-    # Create the directories.
-    mkdir_nofail(directory, verbosity=0)
-
-    # Execute the specific BMRB writing code.
-    write_function(file_path, version=version)

Modified: branches/bmrb/prompt/bmrb.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/prompt/bmrb.py?rev=9722&r1=9721&r2=9722&view=diff
==============================================================================
--- branches/bmrb/prompt/bmrb.py (original)
+++ branches/bmrb/prompt/bmrb.py Sun Oct 11 15:59:38 2009
@@ -30,7 +30,7 @@
 # relax module imports.
 from base_class import User_fn_class
 import check
-from generic_fns import bmrb
+from generic_fns import bmrb, exp_info
 from relax_errors import RelaxBoolError, RelaxIntError, RelaxNoneStrError, 
RelaxStrError, RelaxStrFileError
 
 
@@ -153,7 +153,7 @@
         check.is_str_list(tasks, 'tasks', can_be_none=True)
 
         # Execute the functional code.
-        bmrb.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=cite, tasks=tasks)
 
 
     def software_select(self, name=None, version=None):
@@ -203,7 +203,7 @@
         check.is_str(version, 'version', can_be_none=True)
 
         # Execute the functional code.
-        bmrb.software_select(name=name, version=version)
+        exp_info.software_select(name=name, version=version)
 
 
     def write(self, file=None, dir='pipe_name', version='3.1', force=False):




Related Messages


Powered by MHonArc, Updated Sun Oct 11 16:20:02 2009