Fix literal string matching for external annotation filter values#2526
Open
sirus20x6 wants to merge 1 commit intosamtools:developfrom
Open
Fix literal string matching for external annotation filter values#2526sirus20x6 wants to merge 1 commit intosamtools:developfrom
sirus20x6 wants to merge 1 commit intosamtools:developfrom
Conversation
…ixes samtools#2506) When bcftools annotate uses a filter expression with external values (e.g., -i 'SOURCE_RECORD={SOURCE_RECORD}') to match annotation records, the string comparison incorrectly split values on commas and performed cross-product matching. This meant that two different INFO field values could falsely match if they shared any comma-separated component. External values from annotation file columns are single literal strings where commas are part of the value, not VCF multi-value separators. This change makes cmp_vector_strings() perform a direct string comparison when either operand is an external value (iext > 0), instead of using _match_vector_strings() which splits on commas. Also removes a stray debug fprintf left in the regex comparison path.
f971815 to
4e5ffca
Compare
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.
Summary
bcftools annotateuses a filter expression with external annotation values ({VARIABLE}syntax), the string comparison incorrectly split values on commas and matched any component — values likechr5|123456|C|A,CT,G|2would match on substringCTFixes #2506
Test plan