Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Cunliang Geng <[email protected]>
  • Loading branch information
adraismawur and CunliangGeng authored Jul 17, 2024
1 parent 65fa549 commit 3096bcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/nplinker/genomics/bigscape/runbigscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def run_bigscape(
antismash_path: str | PathLike,
output_path: str | PathLike,
extra_params: str,
version: int = 1,
version: Literal[1, 2] = 1,
) -> bool:
"""Runs BiG-SCAPE to cluster BGCs.
Expand All @@ -34,7 +34,7 @@ def run_bigscape(
antismash_path: Path to the antismash output directory.
output_path: Path to the output directory where BiG-SCAPE will write its results.
extra_params: Additional parameters to pass to BiG-SCAPE.
version: The version of BiG-SCAPE to run. Can be 1 or 2.
version: The version of BiG-SCAPE to run. Must be 1 or 2.
Returns:
True if BiG-SCAPE ran successfully, False otherwise.
Expand All @@ -45,13 +45,13 @@ def run_bigscape(
elif version == 2:
bigscape_py_path = "bigscape-v2.py"
else:
raise ValueError("Unexpected BiG-SCAPE version number specified")
raise ValueError("Invalid BiG-SCAPE version number. Expected: 1 or 2.")

try:
subprocess.run([bigscape_py_path, "-h"], capture_output=True, check=True)
except Exception as e:
raise FileNotFoundError(
f"Failed to find/run bigscape.py (path={bigscape_py_path}, err={e})"
f"Failed to find/run BiG-SCAPE executable program (path={bigscape_py_path}, err={e})"
) from e

if not os.path.exists(antismash_path):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/genomics/test_runbigscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_run_bigscape_v2(tmp_path):

def test_run_bigscape_small_dataset_v1(tmp_path):
result = bigscape.run_bigscape(
antismash_path=DATA_DIR / "bigscape/minimal_dataset",
antismash_path=DATA_DIR / "bigscape" / "minimal_dataset",
output_path=tmp_path,
extra_params="",
version=1,
Expand All @@ -38,7 +38,7 @@ def test_run_bigscape_small_dataset_v1(tmp_path):

def test_run_bigscape_small_dataset_v2(tmp_path):
result = bigscape.run_bigscape(
antismash_path=DATA_DIR / "bigscape/minimal_dataset",
antismash_path=DATA_DIR / "bigscape" / "minimal_dataset",
output_path=tmp_path,
extra_params="",
version=2,
Expand Down

0 comments on commit 3096bcc

Please sign in to comment.