mailr4064 - /1.3/prompt/relax_data.py


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

Header


Content

Posted by edward on November 26, 2007 - 19:58:
Author: bugman
Date: Mon Nov 26 19:58:45 2007
New Revision: 4064

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


Modified:
    1.3/prompt/relax_data.py

Modified: 1.3/prompt/relax_data.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/relax_data.py?rev=4064&r1=4063&r2=4064&view=diff
==============================================================================
--- 1.3/prompt/relax_data.py (original)
+++ 1.3/prompt/relax_data.py Mon Nov 26 19:58:45 2007
@@ -244,14 +244,12 @@
         self.__relax__.specific.relax_data.display(run=run, 
ri_label=ri_label, frq_label=frq_label)
 
 
-    def read(self, run=None, ri_label=None, frq_label=None, frq=None, 
file=None, dir=None, num_col=0, name_col=1, data_col=2, error_col=3, 
sep=None):
+    def read(self, ri_label=None, frq_label=None, frq=None, file=None, 
dir=None, mol_name_col=None, res_num_col=0, res_name_col=1, spin_num_col=0, 
spin_name_col=1, data_col=2, error_col=3, sep=None):
         """Function for reading R1, R2, or NOE relaxation data from a file.
 
         Keyword Arguments
         ~~~~~~~~~~~~~~~~~
 
-        run:  The name of the run.
-
         ri_label:  The relaxation data type, ie 'R1', 'R2', or 'NOE'.
 
         frq_label:  The field strength label.
@@ -262,9 +260,15 @@
 
         dir:  The directory where the file is located.
 
-        num_col:  The residue number column (the default is 0, ie the first 
column).
-
-        name_col:  The residue name column (the default is 1).
+        mol_name_col:  The molecule name column (this defaults to no column).
+
+        res_num_col:  The residue number column (the default is 0, i.e. the 
first column).
+
+        res_name_col:  The residue name column (the default is 1, i.e. the 
second column).
+
+        spin_num_col:  The spin number column (this defaults to no column).
+
+        spin_name_col:  The spin name column (this defaults to no column).
 
         data_col:  The relaxation data column (the default is 2).
 
@@ -283,51 +287,47 @@
         Examples
         ~~~~~~~~
 
-        The following commands will read the NOE relaxation data collected 
at 600 MHz out of a file
-        called 'noe.600.out' where the residue numbers, residue names, data, 
errors are in the
-        first, second, third, and forth columns respectively.
-
-        relax> relax_data.read('m1', 'NOE', '600', 599.7 * 1e6, 
'noe.600.out')
-        relax> relax_data.read('m1', ri_label='NOE', frq_label='600', 
frq=600.0 * 1e6,
-                               file='noe.600.out')
+        The following commands will read the protein NOE relaxation data 
collected at 600 MHz out of
+        a file called 'noe.600.out' where the residue numbers, residue 
names, data, errors are in
+        the first, second, third, and forth columns respectively.
+
+        relax> relax_data.read('NOE', '600', 599.7 * 1e6, 'noe.600.out')
+        relax> relax_data.read(ri_label='NOE', frq_label='600', frq=600.0 * 
1e6, file='noe.600.out')
 
 
         The following commands will read the R2 data out of the file 
'r2.out' where the residue
         numbers, residue names, data, errors are in the second, third, 
fifth, and sixth columns
         respectively.  The columns are separated by commas.
 
-        relax> relax_data.read('m1', 'R2', '800 MHz', 8.0 * 1e8, 'r2.out', 
1, 2, 4, 5, ',')
-        relax> relax_data.read('m1', ri_label='R2', frq_label='800 MHz', 
frq=8.0*1e8,
-                               file='r2.out', num_col=1, name_col=2, 
data_col=4, error_col=5,
-                               sep=',')
+        relax> relax_data.read('R2', '800 MHz', 8.0 * 1e8, 'r2.out', 1, 2, 
4, 5, ',')
+        relax> relax_data.read(ri_label='R2', frq_label='800 MHz', 
frq=8.0*1e8, file='r2.out',
+                               res_num_col=1, res_name_col=2, data_col=4, 
error_col=5, sep=',')
 
 
         The following commands will read the R1 data out of the file 
'r1.out' where the columns are
         separated by the symbol '%'
 
-        relax> relax_data.read('m1', 'R1', '300', 300.1 * 1e6, 'r1.out', 
sep='%')
+        relax> relax_data.read('R1', '300', 300.1 * 1e6, 'r1.out', sep='%')
         """
 
         # Function intro text.
         if self.__relax__.interpreter.intro:
             text = sys.ps3 + "relax_data.read("
-            text = text + "run=" + `run`
-            text = text + ", ri_label=" + `ri_label`
+            text = text + "ri_label=" + `ri_label`
             text = text + ", frq_label=" + `frq_label`
             text = text + ", frq=" + `frq`
             text = text + ", file=" + `file`
             text = text + ", dir=" + `dir`
-            text = text + ", num_col=" + `num_col`
-            text = text + ", name_col=" + `name_col`
+            text = text + ", mol_name_col=" + `mol_name_col`
+            text = text + ", res_num_col=" + `res_num_col`
+            text = text + ", res_name_col=" + `res_name_col`
+            text = text + ", spin_num_col=" + `spin_num_col`
+            text = text + ", spin_name_col=" + `spin_name_col`
             text = text + ", data_col=" + `data_col`
             text = text + ", error_col=" + `error_col`
             text = text + ", sep=" + `sep` + ")"
             print text
 
-        # The run name.
-        if type(run) != str:
-            raise RelaxStrError, ('run', run)
-
         # Relaxation data type.
         if type(ri_label) != str:
             raise RelaxStrError, ('relaxation label', ri_label)
@@ -348,13 +348,25 @@
         if dir != None and type(dir) != str:
             raise RelaxNoneStrError, ('directory name', dir)
 
-        # The number column.
-        if type(num_col) != int:
-            raise RelaxIntError, ('residue number column', num_col)
-
-        # The name column.
-        if type(name_col) != int:
-            raise RelaxIntError, ('residue name column', name_col)
+        # Molecule name column.
+        if mol_name_col != None and type(mol_name_col) != int:
+            raise RelaxNoneIntError, ('molecule name column', mol_name_col)
+
+        # Residue number column.
+        if res_name_col != None and type(res_num_col) != int:
+            raise RelaxNoneIntError, ('residue number column', res_num_col)
+
+        # Residue name column.
+        if res_name_col != None and type(res_name_col) != int:
+            raise RelaxNoneIntError, ('residue name column', res_name_col)
+
+        # Spin number column.
+        if spin_num_col != None and type(spin_num_col) != int:
+            raise RelaxNoneIntError, ('spin number column', spin_num_col)
+
+        # Spin name column.
+        if spin_name_col != None and type(spin_name_col) != int:
+            raise RelaxNoneIntError, ('spin name column', spin_name_col)
 
         # The data column.
         if type(data_col) != int:
@@ -369,7 +381,7 @@
             raise RelaxNoneStrError, ('column separator', sep)
 
         # Execute the functional code.
-        self.__relax__.specific.relax_data.read(run=run, ri_label=ri_label, 
frq_label=frq_label, frq=frq, file=file, dir=dir, num_col=num_col, 
name_col=name_col, data_col=data_col, error_col=error_col, sep=sep)
+        relax_data.read(ri_label=ri_label, frq_label=frq_label, frq=frq, 
file=file, dir=dir, mol_name_col=mol_name_col, res_num_col=res_num_col, 
res_name_col=res_name_col, spin_num_col=spin_num_col, 
spin_name_col=spin_name_col, data_col=data_col, error_col=error_col, sep=sep)
 
 
     def write(self, run=None, ri_label=None, frq_label=None, file=None, 
dir=None, force=0):




Related Messages


Powered by MHonArc, Updated Mon Nov 26 20:20:33 2007