Example #1
0
    def __init__(self,
                 args: Union["Namespace", None] = None,
                 conf_file: str = "config.ini"):
        self.path = conf_file
        super().__init__()
        self.read(self.path)

        self.logfile_path = self["general"]["logfile"]
        self.dump_intermediate = self["general"].getboolean(
            "dump_intermediate")
        self.input = self.parse_input(args)

        self.output = self.parse_output(args)

        if args.single:
            self.dump_intermediate = False

        if args.lab:
            LAB_INST.configure(**self.lab_options(args.lab))
        elif not (args.lab or args.single):
            LAB_INST.configure(**self.pedia_lab_options)

        # configure api components
        ERRORFIXER_INST.configure(**self.errorfixer_options)
        JANNOVAR_INST.configure(**self.jannovar_options)
        OMIM_INST.configure(**self.omim_options)
        PHENOMIZER_INST.configure(**self.phenomizer_options)
Example #2
0
    def __init__(self,
                 args: Union["Namespace", None] = None,
                 conf_file: str = "config.ini"):
        self.path = args.config
        super().__init__()
        self.read(self.path)

        self.dump_intermediate = self["general"].getboolean(
            "dump_intermediate")
        self.data_path = self["general"]["data_path"] if self["general"][
            "data_path"] else "data"

        self.train_pickle = args.train_pickle_path
        if self["classifier"]["train_pickle_path"]:
            self.train_pickle = self["classifier"]["train_pickle_path"]

        self.param_c = args.param_c
        if self["classifier"]["param_c"]:
            self.param_c = self["classifier"]["param_c"]

        self.input = self.parse_input(args)

        self.output = self.parse_output(args)
        if args.output and args.single:
            filename = os.path.basename(args.single)
            case_id = filename.split('.json')[0]
            log_dir = os.path.join(args.output, 'logs/{}/'.format(case_id))
            if not os.path.exists(log_dir):
                os.makedirs(log_dir, exist_ok=True)

            self.logfile_path = os.path.join(log_dir, 'preprocess.log')
        else:
            self.logfile_path = self["general"]["logfile"]

        if args.single:
            self.dump_intermediate = False

        if args.lab:
            LAB_INST.configure(**self.lab_options(args.lab))
        elif not (args.lab or args.single):
            LAB_INST.configure(**self.pedia_lab_options)

        # check phenomizer
        if self["phenomizer"]["user"] and self["phenomizer"]["password"]:
            self.use_phenomizer = True
        else:
            self.use_phenomizer = False

        # configure api components
        ERRORFIXER_INST.configure(**self.errorfixer_options)
        JANNOVAR_INST.configure(**self.jannovar_options)
        OMIM_INST.configure(**self.omim_options)
        PHENOMIZER_INST.configure(**self.phenomizer_options)