Author: bugman Date: Mon Mar 2 15:32:59 2015 New Revision: 27723 URL: http://svn.gna.org/viewcvs/relax?rev=27723&view=rev Log: Bug fix for the results.write user function when loading relax state files. The results.write user function can load not only the results file consisting of a single data pipe, but also relax state files if only a single pipe is present. However this was causing the current data pipe and other pipe-independent data (sequence alignments and the GUI) to be overwritten, just as when loading a state file. Now only the data from the data pipe will be loaded and the pipe independent data in the state file will be ignored. Modified: trunk/data_store/__init__.py Modified: trunk/data_store/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/data_store/__init__.py?rev=27723&r1=27722&r2=27723&view=diff ============================================================================== --- trunk/data_store/__init__.py (original) +++ trunk/data_store/__init__.py Mon Mar 2 15:32:59 2015 @@ -442,24 +442,16 @@ @param file: The open file object. @type file: file - @keyword dir: The name of the directory containing the results file (needed - for loading external files). + @keyword dir: The name of the directory containing the results file (needed for loading external files). @type dir: str - @keyword pipe_to: The data pipe to load the XML data pipe into (the file must only - contain one data pipe). + @keyword pipe_to: The data pipe to load the XML data pipe into (the file must only contain one data pipe). @type pipe_to: str - @keyword verbosity: A flag specifying the amount of information to print. The - higher the value, the greater the verbosity. + @keyword verbosity: A flag specifying the amount of information to print. The higher the value, the greater the verbosity. @type verbosity: int - @raises RelaxError: If pipe_to is given and the file contains multiple pipe - elements; or if the data pipes in the XML file already exist in - the relax data store; or if the data pipe type is invalid; or - if the target data pipe is not empty. + @raises RelaxError: If pipe_to is given and the file contains multiple pipe elements; or if the data pipes in the XML file already exist in the relax data store; or if the data pipe type is invalid; or if the target data pipe is not empty. @raises RelaxNoPipeError: If pipe_to is given but the data pipe does not exist. - @raises RelaxError: If the data pipes in the XML file already exist in the relax - data store, or if the data pipe type is invalid. - @raises RelaxPipeError: If the data pipes of the XML file are already present in the - relax data store. + @raises RelaxError: If the data pipes in the XML file already exist in the relax data store, or if the data pipe type is invalid. + @raises RelaxPipeError: If the data pipes of the XML file are already present in the relax data store. """ # Create the XML document from the file. @@ -475,23 +467,6 @@ else: file_version = int(file_version) - # Get the GUI nodes. - gui_nodes = relax_node.getElementsByTagName('relax_gui') - if gui_nodes: - self.relax_gui.from_xml(gui_nodes[0], file_version=file_version) - - # Get the sequence alignment nodes. - seq_align_nodes = relax_node.getElementsByTagName('sequence_alignments') - if seq_align_nodes: - # Initialise the object. - self.sequence_alignments = Sequence_alignments() - - # Populate it. - self.sequence_alignments.from_xml(seq_align_nodes[0], file_version=file_version) - - # Recreate all the data store data structures. - xml_to_object(relax_node, self, file_version=file_version, blacklist=['pipe', 'relax_gui', 'sequence_alignments']) - # Get the pipe nodes. pipe_nodes = relax_node.getElementsByTagName('pipe') @@ -527,6 +502,23 @@ # Load the state. else: + # Get the GUI nodes. + gui_nodes = relax_node.getElementsByTagName('relax_gui') + if gui_nodes: + self.relax_gui.from_xml(gui_nodes[0], file_version=file_version) + + # Get the sequence alignment nodes. + seq_align_nodes = relax_node.getElementsByTagName('sequence_alignments') + if seq_align_nodes: + # Initialise the object. + self.sequence_alignments = Sequence_alignments() + + # Populate it. + self.sequence_alignments.from_xml(seq_align_nodes[0], file_version=file_version) + + # Recreate all the data store data structures. + xml_to_object(relax_node, self, file_version=file_version, blacklist=['pipe', 'relax_gui', 'sequence_alignments']) + # Checks. for pipe_node in pipe_nodes: # The pipe name and type.