Author: bugman Date: Fri Aug 1 14:07:34 2008 New Revision: 7064 URL: http://svn.gna.org/viewcvs/relax?rev=7064&view=rev Log: Modified write_header() to write extra columns as well. 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=7064&r1=7063&r2=7064&view=diff ============================================================================== --- 1.3/generic_fns/sequence.py (original) +++ 1.3/generic_fns/sequence.py Fri Aug 1 14:07:34 2008 @@ -399,13 +399,18 @@ write_line(file, mol_name, res_num, res_name, spin.num, spin.name, sep=sep, mol_name_flag=mol_name_flag, res_num_flag=res_num_flag, res_name_flag=res_name_flag, spin_num_flag=spin_num_flag, spin_name_flag=spin_name_flag) -def write_header(file, sep=None, mol_name_flag=False, res_num_flag=False, res_name_flag=False, spin_num_flag=False, spin_name_flag=False): - """Function for writing to the given file object the molecule, residue, and/or sequence data. +def write_header(file, sep=None, extra_format=None, extra_values=None, mol_name_flag=False, res_num_flag=False, res_name_flag=False, spin_num_flag=False, spin_name_flag=False): + """Write to the file object the molecule, residue, and spin data, as well as any extra columns. @param file: The file to write the data to. @type file: writable file object @keyword sep: The column seperator which, if None, defaults to whitespace. @type sep: str or None + @keyword extra_format: The formatting string for any extra columns. This should match the + extra_values argument. + @type extra_format: str + @keyword extra_values: The values to place into the extra columns, corresponding to extra_format. + @type extra_values: tuple of str @keyword mol_name_flag: A flag which if True will cause the molecule name column to be written. @type mol_name_flag: bool @@ -426,7 +431,7 @@ if sep == None: sep = '' - # Write the header. + # Write the start of the header line. if mol_name_flag: file.write("%-10s " % ("Mol_name"+sep)) if res_num_flag: @@ -437,6 +442,12 @@ file.write("%-10s " % ("Spin_num"+sep)) if spin_name_flag: file.write("%-10s " % ("Spin_name"+sep)) + + # Extra columns. + if extra_format: + file.write(extra_format % extra_values) + + # Line termination. file.write('\n')