Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/query cli #209

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions big_scape/cli/query_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ def query(ctx, *args, **kwarg):
ctx.obj["mix"] = None
ctx.obj["hybrids_off"] = False
ctx.obj["mode"] = "Query"
ctx.obj["exclude_categories"] = None
ctx.obj["include_categories"] = None
ctx.obj["exclude_classes"] = None
ctx.obj["include_classes"] = None

# workflow validations
validate_pfam_path(ctx)
Expand Down
2 changes: 1 addition & 1 deletion big_scape/file_input/load_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def remove_duplicate_gbk(gbks: list[GBK]) -> list[GBK]:
unique_gbks = set()
for gbk in gbks:
if gbk in unique_gbks:
logging.info("Skipping duplicate %s", gbk)
logging.info("Skipping duplicate %s", gbk.path)
continue
unique_gbks.add(gbk)

Expand Down
22 changes: 22 additions & 0 deletions big_scape/genbank/bgc_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,20 @@ def get_sub_records(
Returns:
list[BGCRecord]: list of records of the specified type
"""
err_path = region.parent_gbk.path if region.parent_gbk else ""

if region is None:
return []

if record_type == bs_enums.genbank.RECORD_TYPE.REGION:
return [region]

if region.cand_clusters is None:
logging.warning(
"%s: No %s records found, using region instead.",
err_path,
record_type.value,
)
return [region]

cand_clusters = [
Expand All @@ -419,6 +426,11 @@ def get_sub_records(
]

if len(cand_clusters) == 0:
logging.warning(
"%s: No %s records found, using region instead.",
err_path,
record_type.value,
)
return [region]

# TODO: check if properly implemented, or at all
Expand All @@ -445,6 +457,11 @@ def get_sub_records(
proto_cluster_numbers.append(proto_cluster.number)

if len(proto_clusters) == 0:
logging.warning(
"%s: No %s records found, using cand_cluster instead.",
err_path,
record_type.value,
)
return cand_clusters

if record_type == bs_enums.genbank.RECORD_TYPE.PROTO_CLUSTER:
Expand All @@ -461,6 +478,11 @@ def get_sub_records(
proto_core_numbers.append(proto_core.number)

if len(proto_cores) == 0:
logging.warning(
"%s: No %s records found, using protocluster instead.",
err_path,
record_type.value,
)
return proto_clusters

return proto_cores
2 changes: 1 addition & 1 deletion big_scape/run_bigscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def signal_handler(sig, frame):
pfam_info = HMMer.get_pfam_info()
HMMer.unload()

logging.info("Generating GCF alignments, trees and outputfiles")
logging.info("Generating GCF trees and output files")

# prepare output files
legacy_prepare_output(run["output_dir"], pfam_info)
Expand Down
Loading