fix: expand() converts Number=A to Number=1 in headers (#79)#99
Open
jmg421 wants to merge 1 commit into
Open
Conversation
…ioconductor#79) After expand(), each row has exactly one ALT allele, so per-ALT fields (Number=A) are now scalar. Update both INFO and FORMAT header metadata to reflect this. Previously, the fix was only partially applied (grep-based, multi-allele path only). This refactors into a clean .updateHeaderNumberA() helper that handles both code paths and uses exact == 'A' matching. Fixes the round-trip discrepancy where writeVcf() + readVcf() + expand() would produce CompressedNumericList for AF instead of plain numeric. Closes Bioconductor#79
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
Fixes #79.
After
expand(), each row contains exactly one ALT allele, so per-ALT fields (Number=A) are now scalar. The INFO and FORMAT header metadata should reflect this by updatingNumber=A→Number=1.Problem
As reported in #79, a round-trip through
writeVcf()+readVcf()+expand()produced aCompressedNumericListfor fields likeAFinstead of a plainnumericvector. This happened because the header still declaredNumber=A, causingreadVcf()to parse the scalar values back as list columns.Fix
.updateHeaderNumberA()helper that updates both INFO and FORMAT headers using exact== "A"matching (notgrep).grep("A", num)approach which was too broad (would match any Number string containing 'A').Testing
test_expand_numberA_to_1_issue79covering:expand → writeVcf → readVcf → expandkeeps AF as numericAgentic tooling disclosure
This PR was produced with the assistance of Kiro CLI (Amazon's AI coding agent) and Jarvis CLI (a custom agentic tool). All changes were reviewed and verified by the author.