refine: warn if doing timetree and there's apparent mismatch between metadata and sequence ids#1902
Open
corneliusroemer wants to merge 7 commits intomasterfrom
Open
refine: warn if doing timetree and there's apparent mismatch between metadata and sequence ids#1902corneliusroemer wants to merge 7 commits intomasterfrom
corneliusroemer wants to merge 7 commits intomasterfrom
Conversation
When building a time tree, warn users if sequence IDs in the tree don't match the metadata IDs. This helps identify when --metadata-id-columns needs to be set explicitly, especially when the strain column exists but contains different values than the sequence IDs, causing time tree inference to fail. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
corneliusroemer
commented
Oct 10, 2025
corneliusroemer
commented
Oct 10, 2025
corneliusroemer
commented
Oct 10, 2025
- Unified the warning message for both 0% and <50% match cases - Improved message clarity: "For X sequence IDs, only Y corresponding metadata rows could be matched" - Added functional CRAM test to verify the warning appears with mismatched IDs and disappears when using --metadata-id-columns - Added test metadata file with mismatched IDs in strain column 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Instead of adding a new metadata_mismatch.tsv file, generate the mismatched metadata inline in the CRAM test using awk. This reduces the number of new files and makes the test self-contained. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
CRAM requires blank lines in expected output to have exactly 2 spaces of indentation. Updated the test to properly match the actual stderr output including the TreeTime error messages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1902 +/- ##
==========================================
+ Coverage 74.09% 74.26% +0.16%
==========================================
Files 82 82
Lines 8972 8980 +8
Branches 1823 1824 +1
==========================================
+ Hits 6648 6669 +21
+ Misses 2019 2011 -8
+ Partials 305 300 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| ## __NEXT__ | ||
|
|
||
| * `augur refine` will now warn when building a time tree if sequence IDs in the tree don't match metadata IDs, suggesting the use of `--metadata-id-columns` to explicitly set the correct ID column. [#1902][] (@corneliusroemer) |
Member
There was a problem hiding this comment.
Suggest we make more explicit, something like "if more than half of the tip names are missing corresponding metadata"
Member
There was a problem hiding this comment.
(Otherwise PR looks good!)
victorlin
reviewed
Oct 17, 2025
| terminal_names = {n.name for n in T.get_terminals()} | ||
| matched_ids = terminal_names & set(dates.keys()) | ||
|
|
||
| if len(matched_ids) < len(terminal_names) * 0.5: |
Member
There was a problem hiding this comment.
Suggestion: warn on any missing metadata. That would match the expectation for typical Augur workflows. augur filter drops data on either side if it's missing on the other side.
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
We don't warn very explicitly when there's a mismatch between metadata and sequence ids. I helped @aleskunder debug a situation where a more explicit warning would have helped him save quite some time. This PR adds such a warning. If a timetree is done and less than half of sequences have a corresponding row in the metadata, an informative warning is printed.
Checklist