mailr8858 - in /branches/bmrb/bmrblib: __init__.py kinetics/heteronucl_T1_relaxation.py misc.py nmr_star_dict.py


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

Header


Content

Posted by edward on February 22, 2009 - 19:44:
Author: bugman
Date: Sun Feb 22 19:44:35 2009
New Revision: 8858

URL: http://svn.gna.org/viewcvs/relax?rev=8858&view=rev
Log:
Values of 'None' are now translated to the '?' string.


Added:
    branches/bmrb/bmrblib/misc.py
Modified:
    branches/bmrb/bmrblib/__init__.py
    branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py
    branches/bmrb/bmrblib/nmr_star_dict.py

Modified: branches/bmrb/bmrblib/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/__init__.py?rev=8858&r1=8857&r2=8858&view=diff
==============================================================================
--- branches/bmrb/bmrblib/__init__.py (original)
+++ branches/bmrb/bmrblib/__init__.py Sun Feb 22 19:44:35 2009
@@ -24,4 +24,7 @@
 """Package for interfacing with the BMRB (http://www.bmrb.wisc.edu/) by 
handling NMR-STAR formatted files."""
 
 
-__all__ = ['nmr_star_dict']
+__all__ = ['misc',
+           'nmr_star_dict',
+           'nmr_star_dict_v3_1',
+           'tag_category']

Modified: branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py?rev=8858&r1=8857&r2=8858&view=diff
==============================================================================
--- branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py (original)
+++ branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py Sun Feb 22 
19:44:35 2009
@@ -27,6 +27,7 @@
 """
 
 # relax module imports.
+from bmrblib.misc import translate
 from bmrblib.tag_category import TagCategory
 from pystarlib.SaveFrame import SaveFrame
 from pystarlib.TagTable import TagTable
@@ -75,11 +76,11 @@
 
         # Place the args into the namespace.
         self.frq = frq
-        self.res_nums = res_nums
-        self.res_names = res_names
-        self.atom_names = atom_names
-        self.data = data
-        self.errors = errors
+        self.res_nums = translate(res_nums)
+        self.res_names = translate(res_names)
+        self.atom_names = translate(atom_names)
+        self.data = translate(data)
+        self.errors = translate(errors)
 
         # Set up the R1 specific variables.
         self.r1_inc = self.r1_inc + 1

Added: branches/bmrb/bmrblib/misc.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/misc.py?rev=8858&view=auto
==============================================================================
--- branches/bmrb/bmrblib/misc.py (added)
+++ branches/bmrb/bmrblib/misc.py Sun Feb 22 19:44:35 2009
@@ -1,0 +1,46 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2009 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax.                                    
 #
+#                                                                            
 #
+# relax is free software; you can redistribute it and/or modify              
 #
+# it under the terms of the GNU General Public License as published by       
 #
+# the Free Software Foundation; either version 2 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# relax is distributed in the hope that it will be useful,                   
 #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
+# GNU General Public License for more details.                               
 #
+#                                                                            
 #
+# You should have received a copy of the GNU General Public License          
 #
+# along with relax; if not, write to the Free Software                       
 #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
 #
+#                                                                            
 #
+###############################################################################
+
+# Module docstring.
+"""Functions for manipulating NMR-STAR dictionary data."""
+
+
+def translate(data):
+    """Translate all None values into the '?' string.
+
+    @param data:    The data to translate.
+    @type data:     anything
+    """
+
+    # List data.
+    if type(data) == list:
+        # Loop over the data.
+        for i in range(len(data)):
+            if data[i] == None or data[i] == 'None':
+                data[i] = '?'
+
+    # None.
+    if data == None:
+        data = '?'
+
+    # Return the translated result.
+    return data

Modified: branches/bmrb/bmrblib/nmr_star_dict.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/nmr_star_dict.py?rev=8858&r1=8857&r2=8858&view=diff
==============================================================================
--- branches/bmrb/bmrblib/nmr_star_dict.py (original)
+++ branches/bmrb/bmrblib/nmr_star_dict.py Sun Feb 22 19:44:35 2009
@@ -28,7 +28,7 @@
 """
 
 # relax module imports.
-#from bmrblib.kinetics.heteronucl_NOEs import HeteronuclNOESaveframe
+from bmrblib.kinetics.heteronucl_NOEs import HeteronuclNOESaveframe
 from bmrblib.kinetics.heteronucl_T1_relaxation import HeteronuclT1Saveframe
 from bmrblib.kinetics.heteronucl_T2_relaxation import HeteronuclT2Saveframe
 from pystarlib.File import File




Related Messages


Powered by MHonArc, Updated Sun Feb 22 20:00:02 2009