Skip to content

Commit

Permalink
remove loading of description text and the method _load_optional
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
CunliangGeng committed Dec 14, 2023
1 parent 33869c1 commit 256692a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
12 changes: 0 additions & 12 deletions src/nplinker/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -239,9 +236,6 @@ def _init_paths(self):

self._init_genomics_paths()

# 13. MISC: <root>/description.txt
self.description_file = os.path.join(self._root, "description.txt")

# 14. MISC: <root>/include_strains.csv / include_strains_file=<override>
self.include_strains_file = self._config_overrides.get(
self.OR_INCLUDE_STRAINS
Expand Down Expand Up @@ -570,12 +564,6 @@ def _load_class_info(self):
self.chem_classes = chem_classes
return True

def _load_optional(self):
self.description_text = "<no description>"
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
Expand Down
12 changes: 0 additions & 12 deletions src/nplinker/nplinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<no description>'
"""
return self._loader.description_text

@property
def bigscape_cutoff(self):
"""Returns the current BiGSCAPE clustering cutoff value."""
Expand Down

0 comments on commit 256692a

Please sign in to comment.