mailr3779 - /1.3/prompt/sequence.py


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

Header


Content

Posted by edward on November 22, 2007 - 00:40:
Author: bugman
Date: Thu Nov 22 00:40:09 2007
New Revision: 3779

URL: http://svn.gna.org/viewcvs/relax?rev=3779&view=rev
Log:
Converted the sequence.read() user function to the new relax design.

This function now allows for sequences of molecules, residues, and spins to 
be read into the
program.


Modified:
    1.3/prompt/sequence.py

Modified: 1.3/prompt/sequence.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/sequence.py?rev=3779&r1=3778&r2=3779&view=diff
==============================================================================
--- 1.3/prompt/sequence.py (original)
+++ 1.3/prompt/sequence.py Thu Nov 22 00:40:09 2007
@@ -25,6 +25,7 @@
 
 # relax module imports.
 import help
+from generic_fns import sequence
 from relax_errors import RelaxBinError, RelaxIntError, RelaxNoneStrError, 
RelaxStrError
 
 
@@ -64,21 +65,25 @@
         self.__relax__.generic.sequence.display(run=run)
 
 
-    def read(self, run=None, file=None, dir=None, num_col=0, name_col=1, 
sep=None):
-        """Function for reading sequence data.
+    def read(self, file=None, dir=None, mol_name_col=None, res_num_col=0, 
res_name_col=1, spin_num_col=None, spin_name_col=None, sep=None):
+        """Function for reading sequences of molecules, residues, and spins.
 
         Keyword Arguments
         ~~~~~~~~~~~~~~~~~
 
-        run:  The name of the run.
-
         file:  The name of the file containing the sequence data.
 
         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).
 
         sep:  The column separator (the default is white space).
 
@@ -93,44 +98,51 @@
         ~~~~~~~~
 
         The following commands will read the sequence data out of a file 
called 'seq' where the
-        residue numbers and names are in the first and second columns 
respectively and assign it to
-        the run 'm1'.
-
-        relax> sequence.read('m1', 'seq')
-        relax> sequence.read('m1', 'seq', num_col=0, name_col=1)
-        relax> sequence.read(run='m1', file='seq', num_col=0, name_col=1, 
sep=None)
-
-
-        The following commands will read the sequence out of the file 
'noe.out' which also contains
-        the NOE values.
-
-        relax> sequence.read('m1', 'noe.out')
-        relax> sequence.read('m1', 'noe.out', num_col=0, name_col=1)
-        relax> sequence.read(run='m1', file='noe.out', num_col=0, name_col=1)
+        residue numbers and names are in the first and second columns 
respectively:
+
+        relax> sequence.read('seq')
+        relax> sequence.read('seq', num_col=0, name_col=1)
+        relax> sequence.read(file='seq', num_col=0, name_col=1, sep=None)
+
+
+        The following commands will read the residue sequence out of the 
file 'noe.out' which also
+        contains the NOE values:
+
+        relax> sequence.read('noe.out')
+        relax> sequence.read('noe.out', num_col=0, name_col=1)
+        relax> sequence.read(file='noe.out', num_col=0, name_col=1)
 
 
         The following commands will read the sequence out of the file 
'noe.600.out' where the
         residue numbers are in the second column, the names are in the sixth 
column and the columns
-        are separated by commas and assign it to the run 'm5'.
-
-        relax> sequence.read('m5', 'noe.600.out', num_col=1, name_col=5, 
sep=',')
-        relax> sequence.read(run='m5', file='noe.600.out', num_col=1, 
name_col=5, sep=',')
+        are separated by commas:
+
+        relax> sequence.read('noe.600.out', num_col=1, name_col=5, sep=',')
+        relax> sequence.read(file='noe.600.out', num_col=1, name_col=5, 
sep=',')
+
+
+        The following commands will read the RNA residues and atoms 
(including C2, C5, C6, C8, N1,
+        and N3) from the file '500.NOE', where the residue number, residue 
name, spin number, and
+        spin name are in the first to fourth columns respectively:
+
+        relax> sequence.read('500.NOE', spin_num_col=2, spin_name_col=3)
+        relax> sequence.read('500.NOE', num_col=0, name_col=1, 
spin_num_col=2, spin_name_col=3)
+        relax> sequence.read(file='500.NOE', spin_num_col=2, spin_name_col=3)
+        relax> sequence.read(file='500.NOE', num_col=0, name_col=1, 
spin_num_col=2, spin_name_col=3)
         """
 
         # Function intro text.
         if self.__relax__.interpreter.intro:
             text = sys.ps3 + "sequence.read("
-            text = text + "run=" + `run`
-            text = text + ", file=" + `file`
+            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 + ", sep=" + `sep` + ")"
             print text
-
-        # The run argument.
-        if type(run) != str:
-            raise RelaxStrError, ('run', run)
 
         # The file name.
         if type(file) != str:
@@ -140,20 +152,32 @@
         if dir != None and type(dir) != str:
             raise RelaxNoneStrError, ('directory name', dir)
 
-        # Number column.
-        if type(num_col) != int:
-            raise RelaxIntError, ('residue number column', num_col)
-
-        # Name column.
-        if type(name_col) != int:
-            raise RelaxIntError, ('residue name column', name_col)
+        # Molecule name column.
+        if mol_name_col != None or type(mol_name_col) != int:
+            raise RelaxNoneIntError, ('molecule name column', mol_name_col)
+
+        # Residue number column.
+        if res_name_col != None or type(res_num_col) != int:
+            raise RelaxNoneIntError, ('residue number column', res_num_col)
+
+        # Residue name column.
+        if res_name_col != None or type(res_name_col) != int:
+            raise RelaxNoneIntError, ('residue name column', res_name_col)
+
+        # Spin number column.
+        if spin_name_col != None or type(spin_num_col) != int:
+            raise RelaxNoneIntError, ('spin number column', spin_num_col)
+
+        # Spin name column.
+        if spin_name_col != None or type(spin_name_col) != int:
+            raise RelaxNoneIntError, ('spin name column', spin_name_col)
 
         # Column separator.
         if sep != None and type(sep) != str:
             raise RelaxNoneStrError, ('column separator', sep)
 
         # Execute the functional code.
-        self.__relax__.generic.sequence.read(run=run, file=file, dir=dir, 
num_col=num_col, name_col=name_col, sep=sep)
+        sequence.read(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, sep=sep)
 
 
     def write(self, run=None, file=None, dir=None, force=0):




Related Messages


Powered by MHonArc, Updated Thu Nov 22 01:00:27 2007