Skip to content

Commit

Permalink
fix format check errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Apr 12, 2024
1 parent d17a8ad commit b7a947e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/nplinker/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@


class DatasetLoader:
"""Class to load all data."""

RUN_CANOPUS_DEFAULT = False
EXTRA_CANOPUS_PARAMS_DEFAULT = "--maxmz 600 formula zodiac structure canopus"

Expand All @@ -52,6 +54,7 @@ def __init__(self):
self.chem_classes = None

def load(self):
"""Load all data."""
if not self._load_strain_mappings():
return False

Expand Down Expand Up @@ -204,7 +207,7 @@ def _load_class_info(self):
mibig_class_file = NPLINKER_APP_DATA_DIR.joinpath(
"MIBiG2.0_compounds_with_AS_BGC_CF_NPC_classes.txt"
)
self.class_matches = ClassMatches(mibig_class_file)
self.class_matches = ClassMatches(mibig_class_file) # noqa

# run canopus if canopus_dir does not exist
should_run_canopus = self._config_docker.get("run_canopus", self.RUN_CANOPUS_DEFAULT)
Expand All @@ -220,14 +223,14 @@ def _load_class_info(self):
)
)
try:
run_canopus(self.gnps_mgf_file, self.canopus_dir, extra_canopus_parameters)
run_canopus(self.gnps_mgf_file, self.canopus_dir, extra_canopus_parameters) # noqa
except Exception as e:
logger.warning(
'Failed to run CANOPUS on mgf file with docker, error was "{}"'.format(e)
)
logger.info("Trying to run CANOPUS again using SIRIUS from path")
try:
run_canopus(self.gnps_mgf_file, self.canopus_dir, extra_canopus_parameters)
run_canopus(self.gnps_mgf_file, self.canopus_dir, extra_canopus_parameters) # noqa
except Exception as e:
logger.warning(
'Again failed to run CANOPUS on mgf file using sirius from path, error was "{}"'.format(
Expand All @@ -238,7 +241,7 @@ def _load_class_info(self):
logger.info("Found CANOPUS dir, CANOPUS not run again!")

# load Chem_class_predictions (canopus, molnetenhancer are loaded)
chem_classes = ChemClassPredictions(self.canopus_dir, self.molnetenhancer_dir, self._root)
chem_classes = ChemClassPredictions(self.canopus_dir, self.molnetenhancer_dir, self._root) # noqa
# if no molfam classes transfer them from spectra (due to old style MN)
if not chem_classes.canopus.molfam_classes and chem_classes.canopus.spectra_classes:
logger.debug("Added chemical compound classes for MFs")
Expand Down

0 comments on commit b7a947e

Please sign in to comment.