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

clear central on new longest lcs #219

Merged
merged 5 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 3 additions & 3 deletions big_scape/cli/benchmark_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ def benchmark(ctx, *args, **kwargs):
ctx.obj.update(ctx.params)
ctx.obj["mode"] = "Benchmark"

# workflow validations
validate_output_paths(ctx)

# set start time and label
set_start(ctx.obj)

# workflow validations
validate_output_paths(ctx)

# initialize logger
init_logger(ctx.obj)
init_logger_file(ctx.obj)
Expand Down
5 changes: 2 additions & 3 deletions big_scape/cli/cli_validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pathlib import Path
from typing import Optional
import os
import time
import platform

# from other modules
Expand All @@ -22,7 +21,7 @@ def set_start(param_dict) -> None:
"""get start time and set label in a run parameter dict"""

start_time: datetime = datetime.now()
timestamp = start_time.strftime("%d-%m-%Y_%H-%M-%S")
timestamp = start_time.strftime("%Y-%m-%d_%H-%M-%S")
if param_dict["label"]:
param_dict["label"] = f"{param_dict['label']}_{timestamp}"
else:
Expand Down Expand Up @@ -116,7 +115,7 @@ def validate_output_dir(ctx, param, output_dir) -> Path:
def validate_output_paths(ctx) -> None:
"""Sets the output paths to default output_dir if not provided"""

timestamp = time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime())
timestamp = ctx.obj["label"]

if "db_path" in ctx.obj and ctx.obj["db_path"] is None:
db_path = ctx.obj["output_dir"] / Path(f"{ctx.obj['output_dir'].name}.db")
Expand Down
6 changes: 3 additions & 3 deletions big_scape/cli/cluster_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ def cluster(ctx, *args, **kwargs):
ctx.obj["propagate"] = True # compatibility with query wrt cc generation
ctx.obj["mode"] = "Cluster"

# set start time and run label
set_start(ctx.obj)

# workflow validations
validate_binning_cluster_workflow(ctx)
validate_pfam_path(ctx)
validate_domain_include_list(ctx)
validate_output_paths(ctx)
validate_disk_only(ctx)

# set start time and run label
set_start(ctx.obj)

# initialize logger
init_logger(ctx.obj)
init_logger_file(ctx.obj)
Expand Down
6 changes: 3 additions & 3 deletions big_scape/cli/query_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,16 @@ def query(ctx, *args, **kwarg):
ctx.obj["exclude_classes"] = None
ctx.obj["include_classes"] = None

# set start time and label
set_start(ctx.obj)

# workflow validations
validate_pfam_path(ctx)
validate_output_paths(ctx)
validate_binning_query_workflow(ctx)
validate_query_record(ctx)
validate_disk_only(ctx)

# set start time and label
set_start(ctx.obj)

# initialize logger
init_logger(ctx.obj)
init_logger_file(ctx.obj)
Expand Down
6 changes: 4 additions & 2 deletions big_scape/comparison/lcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,10 @@ def find_domain_lcs_region(

# Length

# clear the list if it's not empty and the current match is longer
# clear the lists if it's not empty and the current match is longer
nlouwen marked this conversation as resolved.
Show resolved Hide resolved
if len(use_longest_list) > 0 and length > use_longest_list[0][1]:
use_longest_list.clear()
use_central_list.clear()

# add the match to the list if it's empty or the current match is equal length
# or longer than the existing match
nlouwen marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -523,9 +524,10 @@ def find_domain_lcs_protocluster(

# Length

# clear the list if it's not empty and the current match is longer
# clear the lists if it's not empty and the current match is longer
if len(use_longest_list) > 0 and length > use_longest_list[0][1]:
use_longest_list.clear()
use_central_list.clear()

# add the match to the list if it's empty or the current match is equal length
# or longer than the existing match
Expand Down
1 change: 1 addition & 0 deletions big_scape/output/legacy_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ def write_network_file(
.where(edge_params_table.c.weights.in_(incl_weights))
.where(edge_params_table.c.alignment_mode == aln_mode)
.where(edge_params_table.c.extend_strategy == ext_strat)
.where(distance_table.c.distance < 1)
)

if cutoff is not None:
Expand Down
Loading