From 256692ade996b3b78f61579dd223a085826dd8f5 Mon Sep 17 00:00:00 2001 From: Cunliang Geng Date: Tue, 12 Dec 2023 15:24:36 +0100 Subject: [PATCH] remove loading of description text and the method `_load_optional` To keep the loading process simple, the loading of description text is removed. A specific loader could be added in the future if these info is necessary in NPLinker. Note that the method `_load_optional` is then totally removed. --- src/nplinker/loader.py | 12 ------------ src/nplinker/nplinker.py | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/src/nplinker/loader.py b/src/nplinker/loader.py index 074b1c0d..b73f450f 100644 --- a/src/nplinker/loader.py +++ b/src/nplinker/loader.py @@ -76,7 +76,6 @@ class DatasetLoader: OR_MIBIG_JSON = "mibig_json_dir" OR_STRAINS = "strain_mappings_file" # misc files - OR_DESCRIPTION = "description_file" OR_INCLUDE_STRAINS = "include_strains_file" # class predictions OR_CANOPUS = "canopus_dir" @@ -197,8 +196,6 @@ def load(self): if not self._load_genomics(): return False - self._load_optional() - # Restrict strain list to only relevant strains (those that are present # in both genomic and metabolomic data) # TODO add a config file option for this? @@ -239,9 +236,6 @@ def _init_paths(self): self._init_genomics_paths() - # 13. MISC: /description.txt - self.description_file = os.path.join(self._root, "description.txt") - # 14. MISC: /include_strains.csv / include_strains_file= self.include_strains_file = self._config_overrides.get( self.OR_INCLUDE_STRAINS @@ -570,12 +564,6 @@ def _load_class_info(self): self.chem_classes = chem_classes return True - def _load_optional(self): - self.description_text = "" - if os.path.exists(self.description_file): - self.description_text = open(self.description_file).read() - logger.debug("Parsed description text") - def _filter_only_common_strains(self): """Filter strain population to only strains present in both genomic and molecular data.""" # TODO: Maybe there should be an option to specify which strains are used, both so we can diff --git a/src/nplinker/nplinker.py b/src/nplinker/nplinker.py index 07f84998..3da4c5fc 100644 --- a/src/nplinker/nplinker.py +++ b/src/nplinker/nplinker.py @@ -214,18 +214,6 @@ def data_dir(self): """Returns path to nplinker/data directory (files packaged with the app itself).""" return NPLINKER_APP_DATA_DIR - @property - def dataset_description(self): - """Returns dataset description. - - If nplinker finds a 'description.txt' file in the root directory of the - dataset, the content will be parsed and made available through this property. - - Returns: - str: the content of description.txt or '' - """ - return self._loader.description_text - @property def bigscape_cutoff(self): """Returns the current BiGSCAPE clustering cutoff value."""