Example #1
0
    def generate_config(self, cfg):
        if sys.version.startswith("2."):
            import pyyaml2 as pyyaml
        elif sys.version.startswith("3."):
            import pyyaml3 as pyyaml

        self.cfg = merge_configs(cfg["error_correction"], cfg["common"])
        self.output_files["corrected_dataset_yaml_filename"] = os.path.join(
            self.cfg.output_dir, "corrected.yaml")
        self.cfg.__dict__["dataset_yaml_filename"] = cfg[
            "dataset"].yaml_filename

        addsitedir(self.ext_python_modules_home)

        if not os.path.isdir(self.cfg.output_dir):
            os.makedirs(self.cfg.output_dir)

        # not all reads need processing
        if support.get_lib_ids_by_type(self.dataset_data,
                                       options_storage.LONG_READS_TYPES):
            not_used_dataset_data = support.get_libs_by_type(
                self.dataset_data, options_storage.LONG_READS_TYPES)
            to_correct_dataset_data = support.rm_libs_by_type(
                self.dataset_data, options_storage.LONG_READS_TYPES)
            to_correct_dataset_yaml_filename = os.path.join(
                self.cfg.output_dir, "to_correct.yaml")
            self.cfg.not_used_dataset_yaml_filename = os.path.join(
                self.cfg.output_dir, "dont_correct.yaml")
            with open(to_correct_dataset_yaml_filename, 'w') as f:
                pyyaml.dump(to_correct_dataset_data,
                            f,
                            default_flow_style=False,
                            default_style='"',
                            width=float("inf"))

            with open(self.cfg.not_used_dataset_yaml_filename, 'w') as f:
                pyyaml.dump(not_used_dataset_data,
                            f,
                            default_flow_style=False,
                            default_style='"',
                            width=float("inf"))
            self.cfg.dataset_yaml_filename = to_correct_dataset_yaml_filename
        else:
            self.cfg.not_used_dataset_yaml_filename = ""

        for stage in self.stages:
            stage.generate_config(self.cfg)
    def generate_config(self, cfg):
        if not os.path.isdir(self.dir_for_split_reads):
            os.makedirs(self.dir_for_split_reads)
        if not os.path.isdir(self.tmp_dir):
            os.makedirs(self.tmp_dir)

        for stage in self.stages:
            stage.generate_config(cfg)

        if sys.version.startswith("2."):
            import pyyaml2 as pyyaml
        elif sys.version.startswith("3."):
            import pyyaml3 as pyyaml

        with open(options_storage.args.dataset_yaml_filename, 'w') as f:
            pyyaml.dump(self.dataset_data,
                        f,
                        default_flow_style=False,
                        default_style='"',
                        width=float("inf"))
 def generate_config(self, cfg):
     for stage in self.stages:
         stage.generate_config(self.cfg)