Skip to content

Commit

Permalink
Add max-daily-samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromekelleher committed Sep 6, 2024
1 parent 6b73b6e commit 05d977d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sc2ts/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import sqlite3
import pathlib
import random

import tqdm
import tskit
Expand Down Expand Up @@ -579,7 +580,13 @@ def extend(
# metadata_db.query("SELECT * FROM samples WHERE strain=='SRR19463295'")
# )
# TODO implement this.
assert max_daily_samples is None
if max_daily_samples is not None:
if max_daily_samples < len(metadata_matches):
# FIXME this isn't very random - use a hash of the seed and the current
# date in future.
rng = random.Random(random_seed)
metadata_matches = rng.sample(metadata_matches, max_daily_samples)
logger.info(f"Subset to {len(metadata_matches)} samples")

samples = preprocess(
metadata_matches, base_ts, date, alignment_store, show_progress=show_progress
Expand Down

0 comments on commit 05d977d

Please sign in to comment.