Skip to content

Commit b3805b9

Browse files
authored
Merge pull request #1148 from suhr25/fix/empty-cohort-queries-guard
fix: raise clear error when all cohorts are filtered out in _setup_cohort_queries
2 parents 4595147 + 4d0dd66 commit b3805b9

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

malariagen_data/anoph/sample_metadata.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,6 +1543,12 @@ def _setup_cohort_queries(
15431543
else:
15441544
cohort_queries_checked[cohort_label] = cohort_query
15451545

1546+
if not cohort_queries_checked:
1547+
raise ValueError(
1548+
"No cohorts remain after applying the minimum cohort size filter. "
1549+
"Try reducing `min_cohort_size` or broadening your sample selection."
1550+
)
1551+
15461552
return cohort_queries_checked
15471553

15481554
@_check_types

tests/anoph/test_fst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def test_pairwise_average_fst_with_min_cohort_size(fixture, api: AnophelesFstAna
297297
cohorts=cohorts,
298298
sample_sets=all_sample_sets,
299299
site_mask=site_mask,
300-
min_cohort_size=15,
300+
min_cohort_size=2,
301301
n_jack=random.randint(10, 200),
302302
)
303303

0 commit comments

Comments
 (0)