mailr12507 - /branches/bmrb/specific_fns/model_free/bmrb.py


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

Header


Content

Posted by edward on February 02, 2011 - 16:53:
Author: bugman
Date: Wed Feb  2 16:53:10 2011
New Revision: 12507

URL: http://svn.gna.org/viewcvs/relax?rev=12507&view=rev
Log:
The model-free bmrb_read() now accepts a sample conditions arg and checks 
that only one is loaded.


Modified:
    branches/bmrb/specific_fns/model_free/bmrb.py

Modified: branches/bmrb/specific_fns/model_free/bmrb.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/specific_fns/model_free/bmrb.py?rev=12507&r1=12506&r2=12507&view=diff
==============================================================================
--- branches/bmrb/specific_fns/model_free/bmrb.py (original)
+++ branches/bmrb/specific_fns/model_free/bmrb.py Wed Feb  2 16:53:10 2011
@@ -278,11 +278,15 @@
                 setattr(spin, 'csa', data['csa'][i] * 1e-6)
 
 
-    def bmrb_read(self, file_path, version='3.1'):
+    def bmrb_read(self, file_path, version=None, sample_conditions=None):
         """Read the model-free results from a BMRB NMR-STAR v3.1 formatted 
file.
 
-        @param file_path:   The full file path.
-        @type file_path:    str
+        @param file_path:           The full file path.
+        @type file_path:            str
+        @keyword version:           The BMRB version to force the reading.
+        @type version:              None or str
+        @keyword sample_conditions: The sample condition label to read.  
Only one sample condition can be read per data pipe.
+        @type sample_conditions:    None or str
         """
 
         # Initialise the NMR-STAR data object.
@@ -290,6 +294,13 @@
 
         # Read the contents of the STAR formatted file.
         star.read()
+
+        # The sample conditions.
+        sample_conds = bmrb.list_sample_conditions(star)
+        if sample_conditions and sample_conditions not in sample_conds:
+            raise RelaxError("The sample conditions label '%s' does not 
correspond to any of the labels in the file: %s" % (sample_conditions, 
sample_conds))
+        if not sample_conditions and len(sample_conds) > 1:
+            raise RelaxError("Only one of the sample conditions in %s can be 
loaded per relax data pipe." % sample_conds)
 
         # The diffusion tensor.
         diffusion_tensor.bmrb_read(star)




Related Messages


Powered by MHonArc, Updated Wed Feb 02 17:20:02 2011