def init_pipeline(self): """initialize a new pipeline.""" ## update __SAMPLES__, __SHARED__ and __GENERAL__ sections. self.c.config_file = self.args.config_file if self.args.input_samples: self.c.update_sample_section(self.args.input_samples) if self.args.setup_file: self.c.update_shared_section(self.args.setup_file) ## make a copy of the updated config file in the working directory. updated_cfgfile = os.path.basename( self.args.config_file).split('.yaml')[0] updated_cfgfile = os.path.join(self.args.working_dir, updated_cfgfile + '_kronos.yaml') Configurer.print2yaml(self.c.config_dict, updated_cfgfile) ## create a work flow from updated config file wf = WorkFlow(updated_cfgfile) samples = wf.get_samples() if not samples: self._make_intermediate_pipeline(self.args.pipeline_name, updated_cfgfile, None) else: for sample_id, sample_dict in samples.iteritems(): new_config_file = self._make_intermediate_config_file( sample_id, sample_dict) pipeline_name = sample_id + '_' + self.args.pipeline_name self._make_intermediate_pipeline(pipeline_name, new_config_file, sample_id) self._paste_pipelines(updated_cfgfile)
def init_pipeline(self): """initialize a new pipeline.""" ## update __SAMPLES__, __SHARED__ and __GENERAL__ sections. self.c.config_file = self.args.config_file if self.args.input_samples: self.c.update_sample_section(self.args.input_samples) if self.args.setup_file: self.c.update_shared_section(self.args.setup_file) ## make a copy of the updated config file in the working directory. updated_cfgfile = os.path.basename(self.args.config_file).split('.yaml')[0] updated_cfgfile = os.path.join(self.args.working_dir, updated_cfgfile + '_kronos.yaml') Configurer.print2yaml(self.c.config_dict, updated_cfgfile) ## create a work flow from updated config file wf = WorkFlow(updated_cfgfile) samples = wf.get_samples() if not samples: self._make_intermediate_pipeline(self.args.pipeline_name, updated_cfgfile, None) else: for sample_id, sample_dict in samples.iteritems(): new_config_file = self._make_intermediate_config_file(sample_id, sample_dict) pipeline_name = sample_id + '_' + self.args.pipeline_name self._make_intermediate_pipeline(pipeline_name, new_config_file, sample_id) self._paste_pipelines(updated_cfgfile)
def update_config(self): old_config_file = self.args.config_files[0] new_config_file = self.args.config_files[1] file_name = os.path.join(self.args.working_dir, self.args.output_filename + '.yaml') new_config_dict = Configurer.update_config_files(old_config_file, new_config_file) Configurer.print2yaml(new_config_dict, file_name)
def update_config(self): old_config_file = self.args.config_files[0] new_config_file = self.args.config_files[1] file_name = os.path.join(self.args.working_dir, self.args.output_filename + '.yaml') new_config_dict = Configurer.update_config_files( old_config_file, new_config_file) Configurer.print2yaml(new_config_dict, file_name)
def _make_intermediate_config_file(self, sample_id, sample_dict): """make an intermediate config file from the original config_file.""" intermediate_dir = os.path.join(self.args.working_dir, 'intermediate_config_files') make_dir(intermediate_dir) temp_name = os.path.splitext(os.path.basename(self.args.config_file))[0] + '_kronos' new_file_name = os.path.join(intermediate_dir, sample_id + '_' + temp_name + '.yaml') new_config_dict = self.c.update_config_dict(sample_dict) Configurer.print2yaml(new_config_dict, new_file_name) return new_file_name
def _make_intermediate_config_file(self, sample_id, sample_dict): """make an intermediate config file from the original config_file.""" intermediate_dir = os.path.join(self.args.working_dir, 'intermediate_config_files') make_dir(intermediate_dir) temp_name = os.path.splitext(os.path.basename( self.args.config_file))[0] + '_kronos' new_file_name = os.path.join(intermediate_dir, sample_id + '_' + temp_name + '.yaml') new_config_dict = self.c.update_config_dict(sample_dict) Configurer.print2yaml(new_config_dict, new_file_name) return new_file_name
def make_config(self): """make a yaml config file.""" file_name = os.path.join(self.args.working_dir, self.args.output_filename + '.yaml') config_dict = Configurer.make_config_dict(self.args.components) Configurer.print2yaml(config_dict, file_name)