Skip to content

Commit

Permalink
run bigscape for local mode if not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Sep 16, 2024
1 parent feeea5f commit 974e84f
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/nplinker/arranger.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ def _download_and_extract_antismash(self) -> None:
def arrange_bigscape(self) -> None:
"""Arrange the BiG-SCAPE data.
For `local` mode, validate the BiG-SCAPE data.
For `local` mode, if the BiG-SCAPE data is provided by users, validate it and raise an error
if it is invalid. If the BiG-SCAPE data does not exist, run BiG-SCAPE to generate the
clustering file.
For `podp` mode, if the BiG-SCAPE data does not exist, run BiG-SCAPE to generate the
clustering file; if it exists but not valid, remove the data and re-run BiG-SCAPE to generate
Expand All @@ -281,16 +283,19 @@ def arrange_bigscape(self) -> None:
BiG-SCAPE data directory.
- Check if the `data_sqlite.db` file exists in the BiG-SCAPE data directory.
"""
if self.config.mode == "local" and self.bigscape_dir.exists():
validate_bigscape(self.bigscape_dir, self.config.bigscape.cutoff)
return

pass_validation = False
if self.config.mode == "podp":
for _ in range(3):
try:
validate_bigscape(self.bigscape_dir, self.config.bigscape.cutoff)
pass_validation = True
break
except FileNotFoundError:
shutil.rmtree(self.bigscape_dir, ignore_errors=True)
self._run_bigscape()
for _ in range(3):
try:
validate_bigscape(self.bigscape_dir, self.config.bigscape.cutoff)
pass_validation = True
break
except FileNotFoundError:
shutil.rmtree(self.bigscape_dir, ignore_errors=True)
self._run_bigscape()

if not pass_validation:
validate_bigscape(self.bigscape_dir, self.config.bigscape.cutoff)
Expand Down

0 comments on commit 974e84f

Please sign in to comment.