mailr8155 - /1.3/prompt/noe.py


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

Header


Content

Posted by edward on December 05, 2008 - 21:11:
Author: bugman
Date: Fri Dec  5 21:11:38 2008
New Revision: 8155

URL: http://svn.gna.org/viewcvs/relax?rev=8155&view=rev
Log:
Implemented the interface of the noe.read() user function.


Modified:
    1.3/prompt/noe.py

Modified: 1.3/prompt/noe.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/noe.py?rev=8155&r1=8154&r2=8155&view=diff
==============================================================================
--- 1.3/prompt/noe.py (original)
+++ 1.3/prompt/noe.py Fri Dec  5 21:11:38 2008
@@ -29,7 +29,7 @@
 
 # relax module imports.
 import help
-from relax_errors import RelaxStrError
+from relax_errors import RelaxNoneIntError, RelaxStrError
 from specific_fns.setup import noe_obj
 
 
@@ -44,6 +44,94 @@
 
         # Place relax in the class namespace.
         self.__relax__ = relax
+
+
+    def read(self, file=None, dir=None, proton1_col=None, proton2_col=None, 
lower_col=None, upper_col=None, sep=None):
+        """Read NOESY or ROESY constraints from a file.
+
+        Keyword Arguments
+        ~~~~~~~~~~~~~~~~~
+
+        file:  The name of the file containing the relaxation data.
+
+        dir:  The directory where the file is located.
+
+        proton1_col:  The column containing the first proton of the NOE or 
ROE cross peak.
+
+        proton2_col:  The column containing the second proton of the NOE or 
ROE cross peak.
+
+        lower_col:  The column containing the lower NOE bound.
+
+        upper_col:  The column containing the upper NOE bound.
+
+        sep:  The column separator (the default is white space).
+
+
+        Description
+        ~~~~~~~~~~~
+
+        This function can automatically determine the format of the file, 
for example Xplor
+        formatted constraint files.  A generically formatted file is also 
supported if it contains
+        minimally four columns with the two proton names and the upper and 
lower bounds, as
+        specified by the *_col arguments.
+
+
+        Examples
+        ~~~~~~~~
+
+        To read the Xplor formatted constraint file 'NOE.xpl', type one of:
+
+        relax> noe.read('NOE.xpl')
+        relax> noe.read(file='NOE.xpl')
+
+
+        To read the generic formatted file 'noes', type one of:
+
+        relax> noe.read(file='NOE.xpl', proton1_col=0, proton2_col=1, 
lower_col=2, upper_col=3)
+        """
+
+        # Function intro text.
+        if self.__relax__.interpreter.intro:
+            text = sys.ps3 + "noe.read("
+            text = text + "file=" + `file`
+            text = text + ", dir=" + `dir`
+            text = text + ", proton1_col=" + `proton1_col`
+            text = text + ", proton2_col=" + `proton2_col`
+            text = text + ", lower_col=" + `lower_col`
+            text = text + ", upper_col=" + `upper_col`
+            text = text + ", sep=" + `sep` + ")"
+            print text
+
+        # The file name.
+        if type(file) != str:
+            raise RelaxStrError, ('file', file)
+
+        # Directory.
+        if dir != None and type(dir) != str:
+            raise RelaxNoneStrError, ('directory name', dir)
+
+        # First proton column.
+        if proton1_col != None and type(proton1_col) != int:
+            raise RelaxNoneIntError, ('first proton column', proton1_col)
+
+        # Second proton column.
+        if proton2_col != None and type(proton2_col) != int:
+            raise RelaxNoneIntError, ('second proton column', proton2_col)
+
+        # Lower bound column.
+        if lower_col != None and type(lower_col) != int:
+            raise RelaxNoneIntError, ('lower bound column', lower_col)
+
+        # Upper bound column.
+        if upper_col != None and type(upper_col) != int:
+            raise RelaxNoneIntError, ('upper bound column', upper_col)
+
+        # Column separator.
+        if sep != None and type(sep) != str:
+            raise RelaxNoneStrError, ('column separator', sep)
+
+        # Execute the functional code.
+        noe.read(frq=frq, file=file, dir=dir, proton1_col=proton1_col, 
proton2_col=proton2_col, lower_col=lower_col, upper_col=upper_col, sep=sep)
 
 
     def spectrum_type(self, spectrum_type=None, spectrum_id=None):




Related Messages


Powered by MHonArc, Updated Fri Dec 05 21:20:02 2008