mailr12579 - in /1.3: ./ generic_fns/ prompt/ pystarlib/ specific_fns/ specific_fns/model_free/ test_suite/system_tests/


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

Header


Content

Posted by edward on February 19, 2011 - 14:39:
Author: bugman
Date: Sat Feb 19 14:39:23 2011
New Revision: 12579

URL: http://svn.gna.org/viewcvs/relax?rev=12579&view=rev
Log:
Merged revisions 8153,8369-8388 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/branches/bmrb

........
  r8153 | bugman | 2008-12-05 20:44:46 +0100 (Fri, 05 Dec 2008) | 3 lines
  
  Import fix!
........
  r8369 | bugman | 2009-01-11 10:52:13 +0100 (Sun, 11 Jan 2009) | 11 lines
  
  Added a directory for packaging the pystarlib STAR format reader/writer 
library with relax.
  
  The pystarlib project by Jurgen F. Doreleijers (jurgenfd att gmail dot com) 
is located at
  http://code.google.com/p/pystarlib/.
  
  This packaging with relax is temporary until relax can fully use the 
library to read and write STAR
  files containing relaxation analysis results (model-free for now) for 
submission to the BMRB.  The
  pystarlib library also needs to be packaged with distutils for easy 
installation, prior to
  reseparation.
........
  r8370 | bugman | 2009-01-11 10:55:33 +0100 (Sun, 11 Jan 2009) | 6 lines
  
  Added all the pystarlib code.
  
  The original SVN repository path for this code is 
http://pystarlib.googlecode.com/svn/trunk/src/STAR
  and the code was copied at r15.
........
  r8371 | bugman | 2009-01-11 12:20:07 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  Created a system test for the writing and reading of a BRMB STAR formatted 
file.
........
  r8372 | bugman | 2009-01-11 12:26:41 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  A few fixes for the BMRB system test.
........
  r8373 | bugman | 2009-01-11 13:50:12 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  Added a missing import.
........
  r8374 | bugman | 2009-01-11 13:54:24 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  Some more missing imports.
........
  r8375 | bugman | 2009-01-11 13:57:26 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  A RelaxError is now raised if the specific_fns BMRB methods do not exist.
........
  r8376 | bugman | 2009-01-11 14:01:28 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  Added a stub bmrb_write() model-free method.
........
  r8377 | bugman | 2009-01-11 14:03:58 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  The bmrb_write() method is now in the model-free specific object.
........
  r8378 | bugman | 2009-01-11 14:05:52 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  Activated the specific bmrb_write() methods.
........
  r8379 | bugman | 2009-01-11 14:06:26 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  Activated the specific bmrb_read() methods.
........
  r8380 | bugman | 2009-01-11 15:46:03 +0100 (Sun, 11 Jan 2009) | 5 lines
  
  Import fixes for pystarlib, as they were all screwed up.
  
  This allows the unit test framework to function and allows importing of the 
code into relax.
........
  r8381 | bugman | 2009-01-11 15:57:41 +0100 (Sun, 11 Jan 2009) | 5 lines
  
  Removed the BMRB STAR file compression abilities from the user functions.
  
  The pystarlib does not support this.
........
  r8382 | bugman | 2009-01-11 16:28:13 +0100 (Sun, 11 Jan 2009) | 5 lines
  
  Redesigned the generic BMRB write() function for the pystarlib.File.File 
class object.
  
  The open_write_file() function should not be used as pystarlib already 
creates the file.
........
  r8383 | bugman | 2009-01-11 16:30:33 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  Added a printout for the write() function.
........
  r8384 | bugman | 2009-01-11 16:41:13 +0100 (Sun, 11 Jan 2009) | 5 lines
  
  The pystarlib File object is now initialised and the write() method called.
  
  This produces a relatively empty file.
........
  r8385 | bugman | 2009-01-11 17:17:49 +0100 (Sun, 11 Jan 2009) | 5 lines
  
  Fix for the test_rw_bmrb_model_free() system test.
  
  The dir name was being set to the data pipe name!
........
  r8386 | bugman | 2009-01-11 17:27:34 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  Fixes for the read() function.
........
  r8387 | bugman | 2009-01-11 17:29:45 +0100 (Sun, 11 Jan 2009) | 3 lines
  
  Fix for the write() function.  The directory for placing the file into is 
now created.
........
  r8388 | bugman | 2009-01-11 17:33:47 +0100 (Sun, 11 Jan 2009) | 6 lines
  
  Wrote a basic model-free bmrb_read() method.
  
  This simply parses the STAR formatted file, but does not yet put the 
contents into the relax data
  store.
........

Added:
    1.3/pystarlib/
      - copied from r8388, branches/bmrb/pystarlib/
    1.3/specific_fns/model_free/bmrb.py
      - copied unchanged from r8388, 
branches/bmrb/specific_fns/model_free/bmrb.py
    1.3/test_suite/system_tests/bmrb.py
      - copied unchanged from r8388, 
branches/bmrb/test_suite/system_tests/bmrb.py
Modified:
    1.3/   (props changed)
    1.3/generic_fns/bmrb.py
    1.3/prompt/bmrb.py
    1.3/prompt/interpreter.py
    1.3/specific_fns/model_free/__init__.py
    1.3/specific_fns/setup.py
    1.3/test_suite/system_tests/__init__.py

Propchange: 1.3/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Feb 19 14:39:23 2011
@@ -1,1 +1,1 @@
-/branches/bmrb:1-7041,7043-7046
+/branches/bmrb:1-7041,7043-7046,8153-8388

Modified: 1.3/generic_fns/bmrb.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/bmrb.py?rev=12579&r1=12578&r2=12579&view=diff
==============================================================================
--- 1.3/generic_fns/bmrb.py (original)
+++ 1.3/generic_fns/bmrb.py Sat Feb 19 14:39:23 2011
@@ -23,9 +23,14 @@
 # Module docstring.
 """Module for interfacing with the BMRB (http://www.bmrb.wisc.edu/) by 
handling NMR-STAR v3.1 files."""
 
+# Python module imports.
+from os import F_OK, access
+
 # relax module imports.
 from data import Relax_data_store; ds = Relax_data_store()
-from relax_errors import RelaxError, RelaxNoPipeError
+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():
@@ -53,20 +58,21 @@
     if not ds[ds.current_pipe].is_empty():
         raise RelaxError, "The current data pipe is not empty."
 
-    # Get the full file path, for later use.
+    # Get the full file path.
     file_path = get_file_path(file_name=file, dir=directory)
 
-    # Open the file.
-    file = open_read_file(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, raise_error=False)
+    read_function = get_specific_fn('bmrb_read', 
ds[ds.current_pipe].pipe_type)
 
     # Read the results.
-    read_function(file)
+    read_function(file_path)
 
 
-def write(file=None, directory=None, force=False, compress_type=0, 
verbosity=1):
+def write(file=None, directory=None, force=False):
     """Create a BMRB NMR-STAR v3.1 formatted file."""
 
     # Test if the current data pipe exists.
@@ -78,13 +84,20 @@
         directory = ds.current_pipe
 
     # Specific results writing function.
-    write_function = get_specific_fn('bmrb_write', 
ds[ds.current_pipe].pipe_type, raise_error=False)
+    write_function = get_specific_fn('bmrb_write', 
ds[ds.current_pipe].pipe_type)
 
-    # Open the file for writing.
-    results_file = open_write_file(file_name=file, dir=directory, 
force=force, compress_type=compress_type, verbosity=verbosity)
+    # Get the full file path.
+    file_path = get_file_path(file, directory)
 
-    # Write the results.
-    write_function(results_file)
+    # 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')
 
-    # Close the results file.
-    results_file.close()
+    # 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)

Modified: 1.3/prompt/bmrb.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/bmrb.py?rev=12579&r1=12578&r2=12579&view=diff
==============================================================================
--- 1.3/prompt/bmrb.py (original)
+++ 1.3/prompt/bmrb.py Sat Feb 19 14:39:23 2011
@@ -70,11 +70,6 @@
         ~~~~~~~~~~~
 
         To search for the results file in the current working directory, set 
dir to None.
-
-        This function is able to handle uncompressed, bzip2 compressed 
files, or gzip compressed
-        files automatically.  The full file name including extension can be 
supplied, however, if
-        the file cannot be found, this function will search for the file 
name with '.bz2' appended
-        followed by the file name with '.gz' appended.
         """
 
         # Function intro text.
@@ -96,7 +91,7 @@
         bmrb.read(file=file, directory=dir)
 
 
-    def write(self, file=None, dir='pipe_name', force=False, 
compress_type=0):
+    def write(self, file=None, dir='pipe_name', force=False):
         """Write the results to a BMRB NMR-STAR v3.1 formatted file.
 
         Keyword Arguments
@@ -109,8 +104,6 @@
 
         force:  A flag which if True will cause the any pre-existing file to 
be overwritten.
 
-        compress_type:  The type of compression to use when creating the 
file.
-
 
         Description
         ~~~~~~~~~~~
@@ -118,16 +111,6 @@
         To place the BMRB file in the current working directory, set dir to 
None.  If dir is set
         to the special name 'pipe_name', then the results file will be 
placed into a directory with
         the same name as the current data pipe.
-
-        The default behaviour of this function is to create an uncompressed 
BMRB file.  The file can
-        however be saved in compressed format.  This is controlled by the 
compress_type argument
-        which can be set to one of:
-
-            0:  No compression (no file extension),
-            1:  bzip2 compression ('.bz2' file extension),
-            2:  gzip compression ('.gz' file extension).
-
-        The complementary read function will automatically handle the 
compressed files.
         """
 
         # Function intro text.
@@ -135,8 +118,7 @@
             text = sys.ps3 + "bmrb.write("
             text = text + "file=" + `file`
             text = text + ", dir=" + `dir`
-            text = text + ", force=" + `force`
-            text = text + ", compress_type=" + `compress_type` + ")"
+            text = text + ", force=" + `force` + ")"
             print text
 
         # File.
@@ -151,9 +133,5 @@
         if type(force) != bool:
             raise RelaxBoolError, ('force flag', force)
 
-        # Compression type.
-        if type(compress_type) != int:
-            raise RelaxIntError, ('compression type', compress_type)
-
         # Execute the functional code.
-        bmrb.write(file=file, directory=dir, force=force, 
compress_type=compress_type)
+        bmrb.write(file=file, directory=dir, force=force)

Modified: 1.3/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/interpreter.py?rev=12579&r1=12578&r2=12579&view=diff
==============================================================================
--- 1.3/prompt/interpreter.py (original)
+++ 1.3/prompt/interpreter.py Sat Feb 19 14:39:23 2011
@@ -63,7 +63,7 @@
 from temperature import Temp
 
 # User classes.
-from bmrb import Align_tensor
+from align_tensor import Align_tensor
 from bmrb import BMRB
 from consistency_tests import Consistency_tests
 from dasha import Dasha

Modified: 1.3/specific_fns/model_free/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/__init__.py?rev=12579&r1=12578&r2=12579&view=diff
==============================================================================
--- 1.3/specific_fns/model_free/__init__.py (original)
+++ 1.3/specific_fns/model_free/__init__.py Sat Feb 19 14:39:23 2011
@@ -31,6 +31,7 @@
             'results']
 
 # relax module imports.
+from bmrb import Bmrb
 from main import Model_free_main
 from mf_minimise import Mf_minimise
 from molmol import Molmol
@@ -39,7 +40,7 @@
 from specific_fns.api_common import API_common
 
 
-class Model_free(Model_free_main, Mf_minimise, Molmol, Results, API_base, 
API_common):
+class Model_free(Model_free_main, Mf_minimise, Molmol, Results, Bmrb, 
API_base, API_common):
     """Parent class containing all the model-free specific functions."""
 
     def __init__(self):

Modified: 1.3/specific_fns/setup.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/setup.py?rev=12579&r1=12578&r2=12579&view=diff
==============================================================================
--- 1.3/specific_fns/setup.py (original)
+++ 1.3/specific_fns/setup.py Sat Feb 19 14:39:23 2011
@@ -65,6 +65,14 @@
         if eqi == 'base_data_loop':
             function = inst.base_data_loop
 
+        # BMRB NMR-STAR v3.1 reading function.
+        if eqi == 'bmrb_read':
+            function = inst.bmrb_read
+
+        # BMRB NMR-STAR v3.1 writing function.
+        if eqi == 'bmrb_write':
+            function = inst.bmrb_write
+
         # Calculate function.
         if eqi == 'calculate':
             function = inst.calculate

Modified: 1.3/test_suite/system_tests/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/__init__.py?rev=12579&r1=12578&r2=12579&view=diff
==============================================================================
--- 1.3/test_suite/system_tests/__init__.py (original)
+++ 1.3/test_suite/system_tests/__init__.py Sat Feb 19 14:39:23 2011
@@ -34,6 +34,7 @@
 # relax system/functional test module imports.
 from align_tensor import Align_tensor
 from angles import Angles
+from bmrb import Bmrb
 from consistency_tests import Ct
 from dasha import Dasha
 from diffusion_tensor import Diffusion_tensor
@@ -62,6 +63,7 @@
 
 __all__ = ['align_tensor',
            'angles',
+           'brmb',
            'consistency_tests',
            'dasha'
            'diffusion_tensor',
@@ -124,6 +126,7 @@
         # All tests.
         if not tests:
             
suite_array.append(TestLoader().loadTestsFromTestCase(Align_tensor))
+            suite_array.append(TestLoader().loadTestsFromTestCase(Bmrb))
             suite_array.append(TestLoader().loadTestsFromTestCase(Angles))
             suite_array.append(TestLoader().loadTestsFromTestCase(Ct))
             suite_array.append(TestLoader().loadTestsFromTestCase(Dasha))




Related Messages


Powered by MHonArc, Updated Sat Feb 19 15:00:01 2011