fix: expand() preserves non-standard rowRanges columns (#85)#95
Open
jmg421 wants to merge 3 commits into
Open
Conversation
Convert \itemize blocks that used \item{label}{desc} syntax to \describe,
and replace empty \item{}{} labels in \describe blocks with the function
signature from the body, resolving all checkRd warnings in isSNV-methods,
PolyPhenDb-class, readVcf-methods, SIFTDb-class, summarizeVariants-methods,
VariantType-class, VCF-class, VcfFile-class, VCFHeader-class, VRanges-class,
and VRangesList-class Rd files.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
expand() on a CollapsedVCF was calling mcols(rdexp) <- NULL after expanding rowRanges, which wiped all user-added metadata columns (e.g. SNP_name, num_alts). The fast path (no multi-allelic sites) already preserved these columns correctly. Fix: simply expand rd[idx, ] without wiping mcols. The VCF() constructor accepts rowRanges with extra mcols — they are stored in the rowRanges slot alongside paramRangeID, separate from the fixed fields (REF/ALT/QUAL/FILTER). Fixes Bioconductor#85
jmg421
force-pushed
the
fix/85-expand-preserve-mcols
branch
from
July 18, 2026 03:17
c525658 to
f4bf45c
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
expand()on aCollapsedVCFwith multi-allelic sites was dropping all user-addedmcolsfromrowRanges. For example, a column likeSNP_nameadded viamcols(rowRanges(vcf))$SNP_name <- ...would disappear afterexpand().Root Cause
In
methods-expand.R, the multi-allelic expansion path had:This wiped ALL metadata columns. The
rd[idx, ]subsetting already correctly repeats rows for multi-allelic sites — themcols <- NULLwas unnecessary and destructive.Note: the fast path (
all(elt == 1L), no multi-allelic sites) already preserved user columns correctly by passingrddirectly toVCF().Fix
Remove the
mcols(rdexp) <- NULLline. Simply userd[idx, ]which preserves all columns. TheVCF()constructor stores these in therowRangesslot separately from the fixed fields (REF/ALT/QUAL/FILTER are in thefixedslot).Testing
Added
test_expand_preserves_nonstandard_mcolsto existing test file using the exact reproducer from the issue.Reproducer (from issue)
Fixes #85