def duplicate_data(self, pipe_from=None, pipe_to=None, model_info=None, global_stats=False, verbose=True): """Duplicate the data specific to a single hybrid data pipe. @keyword pipe_from: The data pipe to copy the data from. @type pipe_from: str @keyword pipe_to: The data pipe to copy the data to. @type pipe_to: str @keyword model_info: The model information from model_loop(). @type model_info: unknown @keyword global_stats: The global statistics flag. @type global_stats: bool @keyword verbose: A flag which if True will cause info to be printed out. @type verbose: bool """ # First create the pipe_to data pipe, if it doesn't exist, but don't switch to it. if not pipes.has_pipe(pipe_to): pipes.create(pipe_to, pipe_type='hybrid', switch=False) # Get the data pipes. dp_from = pipes.get_pipe(pipe_from) dp_to = pipes.get_pipe(pipe_to) # Test that the target data pipe has no sequence loaded. if not exists_mol_res_spin_data(pipe_to): raise RelaxSequenceError(pipe_to) # Duplicate the hybrid pipe list data structure. dp_to.hybrid_pipes = dp_from.hybrid_pipes
def test_creation(self): """Test the creation of a data pipe. The function used is pipe_control.pipes.create(). """ # Create a new model-free data pipe. name = 'new' pipes.create(name, 'mf') # Test that the data pipe exists. self.assert_(name in ds) # Test that the current pipe is the new pipe. self.assertEqual(pipes.cdp_name(), name)
def _hybridise(self, hybrid=None, pipe_list=None): """Create the hybrid data pipe. @keyword hybrid: The name of the new hybrid data pipe. @type hybrid: str @keyword pipe_list: The list of data pipes that the hybrid is composed of. @type pipe_list: list of str """ # Test if the hybrid data pipe already exists. if hybrid in pipes.pipe_names(): raise RelaxPipeError(hybrid) # Loop over the pipes to be hybridised and check them. pipe_type = pipes.get_type(pipe_list[0]) for pipe in pipe_list: # Switch to the data pipe. pipes.switch(pipe) # Test if the pipe exists. check_pipe() # Check that the pipe types match. if pipes.get_type() != pipe_type: raise RelaxError("The data pipe types do not match.") # Test if sequence data is loaded. if not exists_mol_res_spin_data(): raise RelaxNoSequenceError # Check that the sequence data matches in all pipes. for i in range(1, len(pipe_list)): compare_sequence(pipe_list[0], pipe_list[1]) # Create the data pipe. pipes.create(pipe_name=hybrid, pipe_type='hybrid') # Store the pipe list forming the hybrid. cdp.hybrid_pipes = pipe_list