mailr5529 - /1.3/generic_fns/sequence.py


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

Header


Content

Posted by edward on April 10, 2008 - 11:45:
Author: bugman
Date: Thu Apr 10 11:45:30 2008
New Revision: 5529

URL: http://svn.gna.org/viewcvs/relax?rev=5529&view=rev
Log:
Created the write_header() function.


Modified:
    1.3/generic_fns/sequence.py

Modified: 1.3/generic_fns/sequence.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/sequence.py?rev=5529&r1=5528&r2=5529&view=diff
==============================================================================
--- 1.3/generic_fns/sequence.py (original)
+++ 1.3/generic_fns/sequence.py Thu Apr 10 11:45:30 2008
@@ -326,3 +326,40 @@
         if spin_name_col != None:
             file.write("%-10s " % (str(spin.name)+sep))
         file.write('\n')
+
+
+def write_header(file, mol_name_flag=True, res_num_flag=True, 
res_name_flag=True, spin_num_flag=True, spin_name_flag=True, sep=None):
+    """Function for writing to the given file object the molecule, residue, 
and/or sequence data.
+
+    @param file:            The file to write the data to.
+    @type file:             writable file object
+    @param mol_name_flag:   A flag which if True will cause the molecule 
name column to be written.
+    @type mol_name_flag:    bool
+    @param res_num_flag:    A flag which if True will cause the residue 
number column to be written.
+    @type res_num_flag:     bool
+    @param res_name_flag:   A flag which if True will cause the residue name 
column to be written.
+    @type res_name_flag:    bool
+    @param spin_name_flag:  A flag which if True will cause the spin name 
column to be written.
+    @type spin_name_flag:   bool
+    @param spin_num_flag:   A flag which if True will cause the spin number 
column to be written.
+    @type spin_num_flag:    bool
+    @param sep:             The column seperator which, if None, defaults to 
whitespace.
+    @type sep:              str or None
+    """
+
+    # No special seperator character.
+    if sep == None:
+        sep = ''
+
+    # Write the header.
+    if mol_name_flag:
+        file.write("%-10s " % ("Mol_name"+sep))
+    if res_num_flag:
+        file.write("%-10s " % ("Res_num"+sep))
+    if res_name_flag:
+        file.write("%-10s " % ("Res_name"+sep))
+    if spin_num_flag:
+        file.write("%-10s " % ("Spin_num"+sep))
+    if spin_name_flag:
+        file.write("%-10s " % ("Spin_name"+sep))
+    file.write('\n')




Related Messages


Powered by MHonArc, Updated Thu Apr 10 12:00:17 2008