Skip to content

fix: writeVcf.VRanges forwards info/filter/meta args to asVCF (#61)#110

Open
jmg421 wants to merge 3 commits into
Bioconductor:develfrom
jmg421:fix/61-vranges-info-column
Open

fix: writeVcf.VRanges forwards info/filter/meta args to asVCF (#61)#110
jmg421 wants to merge 3 commits into
Bioconductor:develfrom
jmg421:fix/61-vranges-info-column

Conversation

@jmg421

@jmg421 jmg421 commented Jul 7, 2026

Copy link
Copy Markdown

Problem

writeVcf(VRanges, ...) was implemented as:

writeVcf(as(obj, "VCF"), filename, ...)

The as(obj, "VCF") coercion ignores all extra mcols() columns as INFO fields — it always treats them as FORMAT/genotype fields. This meant there was no way to write a VRanges to VCF with INFO fields, even though asVCF(vr, info="COL") already supports this.

Fix

Changed writeVcf.VRanges to call asVCF(obj, info=info, filter=filter, meta=meta) instead of as(obj, "VCF"), and exposed info, filter, and meta as explicit arguments (mirroring the asVCF signature).

# Before: no way to get INFO fields
writeVcf(vr, "out.vcf")  # RSID always went to FORMAT

# After: works as expected
vr$RSID <- "rs123"
writeVcf(vr, "out.vcf", info = "RSID")
# ##INFO=<ID=RSID,...>
# chr1  100  .  A  T  .  .  RSID=rs123  AD:DP:FT  ...

Changes

  • R/methods-writeVcf.R: new signature for writeVcf,VRanges method
  • man/writeVcf-methods.Rd: document VRanges method and new info/filter/meta args; add alias

All existing writeVcf unit tests pass. Backward compatible — calling writeVcf(vr, file) without info produces identical output to before.

Closes #61

vjcitn and others added 3 commits July 17, 2026 21:15
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>
@jmg421
jmg421 force-pushed the fix/61-vranges-info-column branch from a91298b to 263e22f Compare July 18, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Populate INFO column with VariantAnnotation::writeVcf

2 participants