Author: bugman Date: Wed Oct 7 14:31:29 2009 New Revision: 9628 URL: http://svn.gna.org/viewcvs/relax?rev=9628&view=rev Log: Deleted the write_body(), write_header(), and write_line() functions from generic_fns.sequence. This should accelerate the switch to relax_io.write_spin_data_file(). 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=9628&r1=9627&r2=9628&view=diff ============================================================================== --- 1.3/generic_fns/sequence.py (original) +++ 1.3/generic_fns/sequence.py Wed Oct 7 14:31:29 2009 @@ -399,153 +399,3 @@ # Close the results file. seq_file.close() - - - -def write_body(file=None, 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. - - @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 mol_name_flag: A flag which if True will cause the molecule name column to be - written. - @type mol_name_flag: bool - @keyword res_num_flag: A flag which if True will cause the residue number column to be - written. - @type res_num_flag: bool - @keyword res_name_flag: A flag which if True will cause the residue name column to be - written. - @type res_name_flag: bool - @keyword spin_name_flag: A flag which if True will cause the spin name column to be written. - @type spin_name_flag: bool - @keyword spin_num_flag: A flag which if True will cause the spin number column to be - written. - @type spin_num_flag: bool - """ - - # No special seperator character. - if sep == None: - sep = '' - - # Write the header. - write_header(file, 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) - - # Loop over the spins. - for spin, mol_name, res_num, res_name in spin_loop(full_info=True): - 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, 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 - @keyword res_num_flag: A flag which if True will cause the residue number column to be - written. - @type res_num_flag: bool - @keyword res_name_flag: A flag which if True will cause the residue name column to be - written. - @type res_name_flag: bool - @keyword spin_name_flag: A flag which if True will cause the spin name column to be written. - @type spin_name_flag: bool - @keyword spin_num_flag: A flag which if True will cause the spin number column to be - written. - @type spin_num_flag: bool - """ - - # No special seperator character. - if sep == None: - sep = '' - - # Write the start of the header line. - 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)) - - # Extra columns. - if extra_format: - file.write(extra_format % extra_values) - - # Line termination. - file.write('\n') - - -def write_line(file, mol_name, res_num, res_name, spin_num, spin_name, 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 given file object a single line of molecule, residue, and spin data. - - @param file: The file to write the data to. - @type file: writable file object - @param mol_name: The molecule name. - @type mol_name: anything - @param res_num: The residue number. - @type res_num: anything - @param res_name: The residue name. - @type res_name: anything - @param spin_num: The spin number. - @type spin_num: anything - @param spin_name: The spin name. - @type spin_name: anything - @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 - @keyword res_num_flag: A flag which if True will cause the residue number column to be - written. - @type res_num_flag: bool - @keyword res_name_flag: A flag which if True will cause the residue name column to be - written. - @type res_name_flag: bool - @keyword spin_name_flag: A flag which if True will cause the spin name column to be written. - @type spin_name_flag: bool - @keyword spin_num_flag: A flag which if True will cause the spin number column to be - written. - @type spin_num_flag: bool - """ - - # No special seperator character. - if sep == None: - sep = '' - - # Write the start of the line. - if mol_name_flag: - file.write("%-10s " % (str(mol_name)+sep)) - if res_num_flag: - file.write("%-10s " % (str(res_num)+sep)) - if res_name_flag: - file.write("%-10s " % (str(res_name)+sep)) - if spin_num_flag: - file.write("%-10s " % (str(spin_num)+sep)) - if spin_name_flag: - file.write("%-10s " % (str(spin_name)+sep)) - - # Extra columns. - if extra_format: - file.write(extra_format % extra_values) - - # Line termination. - file.write('\n')