Author: bugman Date: Tue Aug 2 17:05:44 2011 New Revision: 14073 URL: http://svn.gna.org/viewcvs/relax?rev=14073&view=rev Log: Merged revisions 14071 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3 ........ r14071 | bugman | 2011-08-02 16:54:53 +0200 (Tue, 02 Aug 2011) | 5 lines generic_fns.sequence.validate_sequence() now also checks for the spin ID, data and error columns. This is now used by relax_io.read_spin_data(). ........ Modified: branches/gui_testing/ (props changed) branches/gui_testing/generic_fns/sequence.py branches/gui_testing/relax_io.py Propchange: branches/gui_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Tue Aug 2 17:05:44 2011 @@ -1,1 +1,1 @@ -/1.3:1-14013 +/1.3:1-14071 Modified: branches/gui_testing/generic_fns/sequence.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/sequence.py?rev=14073&r1=14072&r2=14073&view=diff ============================================================================== --- branches/gui_testing/generic_fns/sequence.py (original) +++ branches/gui_testing/generic_fns/sequence.py Tue Aug 2 17:05:44 2011 @@ -306,7 +306,7 @@ write_spin_data(sys.stdout, mol_names=mol_names, res_nums=res_nums, res_names=res_names, spin_nums=spin_nums, spin_names=spin_names) -def validate_sequence(data, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None): +def validate_sequence(data, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, data_col=None, error_col=None): """Test if the sequence data is valid. The only function this performs is to raise a RelaxError if the data is invalid. @@ -314,6 +314,8 @@ @param data: The sequence data. @type data: list of lists. + @keyword spin_id_col: The column containing the spin ID strings. + @type spin_id_col: int or None @param mol_name_col: The column containing the molecule name information. @type mol_name_col: int or None @param res_name_col: The column containing the residue name information. @@ -326,6 +328,13 @@ @type spin_num_col: int or None """ + # Spin ID. + if spin_id_col: + try: + data[spin_id_col-1] + except IndexError: + raise RelaxInvalidSeqError(data) + # Molecule name data. if mol_name_col: try: @@ -372,6 +381,20 @@ if spin_name_col: try: data[spin_name_col-1] + except IndexError: + raise RelaxInvalidSeqError(data) + + # Data. + if data_col: + try: + data[data_col-1] + except IndexError: + raise RelaxInvalidSeqError(data) + + # Errors + if error_col: + try: + data[error_col-1] except IndexError: raise RelaxInvalidSeqError(data) Modified: branches/gui_testing/relax_io.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/relax_io.py?rev=14073&r1=14072&r2=14073&view=diff ============================================================================== --- branches/gui_testing/relax_io.py (original) +++ branches/gui_testing/relax_io.py Tue Aug 2 17:05:44 2011 @@ -536,7 +536,7 @@ for line in file_data: # Validate the sequence. try: - generic_fns.sequence.validate_sequence(line, 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) + generic_fns.sequence.validate_sequence(line, spin_id_col=spin_id_col, 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) except RelaxInvalidSeqError, msg: # Extract the message string, without the RelaxError bit. string = msg.__str__()[12:-1]