Skip to content

Commit

Permalink
change bigscape version setting from int to str
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Jan 8, 2025
1 parent 5515fdf commit 86f39d6
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Here are some example values for the `nplinker.toml` file:
version = "3.1"

[bigscape]
version = 1
version = "1"
cutoff = "0.30"

[scoring]
Expand All @@ -208,7 +208,7 @@ Here are some example values for the `nplinker.toml` file:
version = "3.1"

[bigscape]
version = 2
version = "2"
cutoff = "0.30"
parameters = "--mibig_version 3.1 --include_singletons --gcf_cutoffs 0.30"

Expand Down
4 changes: 2 additions & 2 deletions src/nplinker/arranger.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _run_bigscape(self) -> None:
version,
)

if version == 1:
if version == "1":
for f in glob(
str(
self.bigscape_running_output_dir
Expand All @@ -330,7 +330,7 @@ def _run_bigscape(self) -> None:
)
):
shutil.copy(f, self.bigscape_dir)
elif version == 2:
elif version == "2":
shutil.copy(
self.bigscape_running_output_dir / "data_sqlite.db",
self.bigscape_dir,
Expand Down
2 changes: 1 addition & 1 deletion src/nplinker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def load_config(config_file: str | PathLike) -> Dynaconf:
# BigScape
Validator("bigscape.parameters", is_type_of=str),
Validator("bigscape.cutoff", required=True, is_type_of=str),
Validator("bigscape.version", required=True, is_type_of=int, is_in=[1, 2]),
Validator("bigscape.version", required=True, is_type_of=str, is_in=["1", "2"]),
# Scoring
## `scoring.methods` must be a list of strings and must contain at least one of the
## supported scoring methods.
Expand Down
4 changes: 2 additions & 2 deletions src/nplinker/data/nplinker.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ version = "3.1"
[bigscape]
# Settings for BiG-SCAPE.

version = 1
# [REQUIRED] Available values are 1 and 2. 1 for version 1.x series and 2 for version 2.x series.
version = "1"
# [REQUIRED] Available values are "1" and "2". "1" for version 1.x series and "2" for version 2.x series.
# The version of BiG-SCAPE to use.

cutoff = "0.30"
Expand Down
4 changes: 2 additions & 2 deletions src/nplinker/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ def _load_genomics(self):
all_bgcs_with_strain = antismash_bgcs_with_strain + self.mibig_bgcs

# Step 4: load all GCF objects
if self.config.bigscape.version == 1:
if self.config.bigscape.version == "1":
bigscape_cluster_file = (
self.config.root_dir
/ defaults.BIGSCAPE_DIRNAME
/ f"mix_clustering_c{self.config.bigscape.cutoff}.tsv"
)
loader = BigscapeGCFLoader(bigscape_cluster_file)
logger.info(f"Loading BigSCAPE cluster file {bigscape_cluster_file}")
elif self.config.bigscape.version == 2:
elif self.config.bigscape.version == "2":
bigscape_db_file = self.config.root_dir / defaults.BIGSCAPE_DIRNAME / "data_sqlite.db"
loader = BigscapeV2GCFLoader(bigscape_db_file)
logger.info(f"Loading BigSCAPE database file {bigscape_db_file}")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/nplinker_local_mode.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ to_use = true
version = "3.1"

[bigscape]
version = 1
version = "1"
cutoff = "0.30"

[scoring]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/nplinker_local_mode.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ to_use = true
version = "3.1"

[bigscape]
version = 1
version = "1"
cutoff = "0.30"

[scoring]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def test_config(tmp_path):
assert config.mibig.version == "3.1"

assert config.bigscape.cutoff == "0.30"
assert config.bigscape.version == 1
assert config.bigscape.version == "1"

assert config.scoring.methods == ["metcalf"]

0 comments on commit 86f39d6

Please sign in to comment.