Example #1
0
    def __attrs_post_init__(self):
        if self.defined_as is None and self.type is None:
            raise ValueError("Either defined_as or type need to be specified")
        # load additional objects
        for k in self.postprocessing:
            k_observed = k
            if k == 'variant_effects':
                k = 'kipoi_veff'
            if is_installed(k):
                # Load the config properly if the plugin is installed
                try:
                    parser = get_model_yaml_parser(k)
                    self.postprocessing[k_observed] = parser.from_config(
                        self.postprocessing[k_observed])

                    object.__setattr__(self, "postprocessing",
                                       self.postprocessing)
                except Exception:
                    logger.warn(
                        "Unable to parse {} filed in ModelDescription: {}".
                        format(k_observed, self))

        # parse args
        self.args = recursive_dict_parse(self.args, 'url',
                                         RemoteFile.from_config)

        # parse default_dataloader
        if isinstance(self.default_dataloader, dict):
            self.default_dataloader = DataLoaderImport.from_config(
                self.default_dataloader)
Example #2
0
 def __attrs_post_init__(self):
     # load additional objects
     for k in self.postprocessing:
         k_observed = k
         if k == 'variant_effects':
             k = 'kipoi_veff'
         if is_installed(k):
             # Load the config properly if the plugin is installed
             try:
                 parser = get_dataloader_yaml_parser(k)
                 self.postprocessing[k_observed] = parser.from_config(self.postprocessing[k_observed])
                 object.__setattr__(self, "postprocessing", self.postprocessing)
             except Exception:
                 logger.warning("Unable to parse {} filed in DataLoaderDescription: {}".format(k_observed, self))