Add optional per-seed match dates to include_samples - #625
Open
jeromekelleher wants to merge 2 commits into
Open
Add optional per-seed match dates to include_samples#625jeromekelleher wants to merge 2 commits into
jeromekelleher wants to merge 2 commits into
Conversation
Each include_samples entry may now be a (strain, match_date) tuple in
addition to a bare strain ID. A non-None match_date matches the seed in
on that date instead of its actual date; it may be before the actual
date, in which case the seed node retains its actual date via a negative
("in the future") node time relative to the match-day time-zero. This
lets widely-diverged seeds (e.g. Omicron BA.1/BA.2/BA.3) be matched in on
the same early day so a rudimentary ancestry tree forms before other
tree building, instead of matching to derived samples with many
reversions.
Also detach future (negative-time) nodes when setting up match_tsinfer,
so that other samples cannot copy from a node that lies in the future
relative to the current time-zero.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #625 +/- ##
==========================================
+ Coverage 88.13% 88.24% +0.11%
==========================================
Files 12 12
Lines 4163 4204 +41
Branches 596 606 +10
==========================================
+ Hits 3669 3710 +41
Misses 363 363
Partials 131 131
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A seed strain in include_samples that is not present in the dataset now raises a ValueError up-front in extend() instead of being silently warned-and-skipped, so typos and bad configs fail fast. The no-alignment corner case is handled the same as for any other sample (no seed-specific path). detach_future_nodes now fully detaches negative-time nodes: in addition to removing incident edges, it drops mutations over those nodes and clears their NODE_IS_SAMPLE flag so the matcher cannot treat them as ancestors, recomputing mutation parents afterwards. Node IDs and times are preserved. Rewrite the detach_future_nodes tests with hand-drawn topologies (including recombination) following the conventions in test_tree_ops.py.
jeromekelleher
force-pushed
the
force-seed-date
branch
from
July 28, 2026 20:40
857c5b5 to
2656af6
Compare
jeromekelleher
marked this pull request as ready for review
July 28, 2026 20:40
Member
Author
|
This should work now, and allow us to do something like this: So, the
The sample will be inserted at its real date, meaning that it is initially inserted as a "future" node (negative time). This PR also includes a function to detach future nodes so that they are not available for matching against. |
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.
Opening this so we can see it, but probably won't be merged.