diff --git a/viloca/b2w.py b/viloca/b2w.py index 3536710..30bed59 100644 --- a/viloca/b2w.py +++ b/viloca/b2w.py @@ -340,7 +340,7 @@ def parallel_run_one_window( indel_map, max_ins_at_pos, extended_window_mode, - exclude_non_var_pos_threshold + exclude_non_var_pos_threshold, ): """ build one window. @@ -510,7 +510,8 @@ def build_windows(alignment_file: str, tiling_strategy: TilingStrategy, exact_conformance_fix_0_1_basing_in_reads: Optional[bool] = False, extended_window_mode: Optional[bool] = False, exclude_non_var_pos_threshold: Optional[float] = -1, - maxthreads: Optional[int] = 1) -> None: + maxthreads: Optional[int] = 1, + reuse_files = False) -> None: """Summarizes reads aligned to reference into windows. Three products are created: #. Multiple FASTA files (one for each window position) @@ -580,7 +581,7 @@ def build_windows(alignment_file: str, tiling_strategy: TilingStrategy, all_processes = [] for idx, (window_start, window_length, control_window_length) in enumerate(tiling): counter = counter_list[idx] - if not os.path.isfile(f"coverage_{idx}.txt"): + if not (reuse_files and os.path.isfile(f"coverage_{idx}.txt")): p = Process( target=parallel_run_one_window, args=( @@ -605,6 +606,8 @@ def build_windows(alignment_file: str, tiling_strategy: TilingStrategy, ) ) all_processes.append(p) + else: + logging.info(f'[file already exits] Use window files generated on {time.ctim(pathlib.Path(f"coverage_{idx}.txt").stat().st_mtime)}') for p in all_processes: p.start()