Skip to content

Commit 6e70114

Browse files
Merge pull request #212 from jeromekelleher/add-stop-to-cli
Add stop to cli
2 parents f1d38d1 + 77768a2 commit 6e70114

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

sc2ts/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ def dump_samples(samples, output_file):
201201
)
202202
@click.option("--num-threads", default=0, type=int, help="Number of match threads")
203203
@click.option("--random-seed", default=42, type=int, help="Random seed for subsampling")
204+
@click.option("--stop-date", default="2030-01-01", type=str, help="Stopping date")
204205
@click.option("-p", "--precision", default=None, type=int, help="Match precision")
205206
@click.option("--no-progress", default=False, type=bool, help="Don't show progress")
206207
@click.option("-v", "--verbose", count=True)
@@ -218,6 +219,7 @@ def daily_extend(
218219
max_daily_samples,
219220
num_threads,
220221
random_seed,
222+
stop_date,
221223
precision,
222224
no_progress,
223225
verbose,
@@ -259,6 +261,8 @@ def daily_extend(
259261
for ts, date in ts_iter:
260262
output_ts = output_prefix + date + ".ts"
261263
add_provenance(ts, output_ts)
264+
if date >= stop_date:
265+
break
262266

263267

264268
@click.command()

sc2ts/inference.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ def preprocess_and_match_alignments(
462462
samples_iter = enumerate(samples)
463463
with tqdm.tqdm(
464464
samples_iter,
465-
desc="Fetch",
465+
desc=f"Fetch:{date}",
466466
total=len(samples),
467467
disable=not show_progress,
468468
) as bar:
@@ -549,9 +549,10 @@ def extend(
549549
# TODO add this as a parameter. Only consider sequences with a date from the
550550
# past month for retrospective insertion.
551551
max_insertion_delay = 30
552+
assert min_group_size is not None
552553
earliest_date = parse_date(date) - datetime.timedelta(days=max_insertion_delay)
553554
ts = add_matching_results(
554-
f"match_date<'{date}' AND match_date>'earliest_date'",
555+
f"match_date<'{date}' AND match_date>'{earliest_date}'",
555556
ts=ts,
556557
match_db=match_db,
557558
date=date,
@@ -638,10 +639,6 @@ def add_matching_results(
638639
logger.info("No candidate samples found in MatchDb")
639640
return ts
640641

641-
logger.info(
642-
f"Filtered to {num_samples} candidates in " f"{len(grouped_matches)} groups"
643-
)
644-
645642
tables = ts.dump_tables()
646643
logger.info(f"Got {len(grouped_matches)} distinct paths for {num_samples} samples")
647644

@@ -650,7 +647,7 @@ def add_matching_results(
650647

651648
with tqdm.tqdm(
652649
grouped_matches.items(),
653-
desc="Build",
650+
desc=f"Build:{date}",
654651
total=len(grouped_matches),
655652
disable=not show_progress,
656653
) as bar:

0 commit comments

Comments
 (0)