Gracefully handle weighted sampling with no sequences - #2033
Merged
Conversation
When running with `--group-by-weights` and no sequence records pass earlier filters, `get_weighted_group_sizes` was called with an empty `records_per_group` dict. This caused pandas `df.apply` on an empty DataFrame to return a DataFrame instead of a Series, triggering an unhandled error when setting `_augur_filter_input_size`. Exit early in `get_weighted_group_sizes` when `records_per_group` is empty so that the command completes and handles empty filter results through `--empty-output-reporting`.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2033 +/- ##
==========================================
- Coverage 73.25% 73.24% -0.02%
==========================================
Files 86 86
Lines 10754 10759 +5
Branches 2096 2098 +2
==========================================
+ Hits 7878 7880 +2
- Misses 2502 2504 +2
- Partials 374 375 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
joverlee521
reviewed
Jul 21, 2026
joverlee521
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
When running with
--group-by-weightsand no sequence records pass earlier filters,get_weighted_group_sizeswas called with an emptyrecords_per_groupdict. This caused pandasdf.applyon an empty DataFrame to return a DataFrame instead of a Series, triggering an unhandled error when setting_augur_filter_input_size.Exit early in
get_weighted_group_sizeswhenrecords_per_groupis empty so that the command completes and handles empty filter results through--empty-output-reporting.Related issue(s)
Closes #2032
Checklist