Skip to content

fix: honour .vcf.gz suffix in writeVcf(index=TRUE) (#35)#109

Open
jmg421 wants to merge 3 commits into
Bioconductor:develfrom
jmg421:fix/35-vcf-gz-suffix
Open

fix: honour .vcf.gz suffix in writeVcf(index=TRUE) (#35)#109
jmg421 wants to merge 3 commits into
Bioconductor:develfrom
jmg421:fix/35-vcf-gz-suffix

Conversation

@jmg421

@jmg421 jmg421 commented Jul 6, 2026

Copy link
Copy Markdown

Problem

writeVcf(vcf, "out.vcf.gz", index=TRUE) silently renamed the output to out.vcf.bgz because Rsamtools::bgzip() always writes to <stem>.bgz. This broke interoperability with tools (IGV, bcftools, etc.) that expect .vcf.gz.

Fix

After bgzip() + indexTabix(), if the original filename ended with .gz and the bgzip'd path differs from it, we rename both the compressed file and its .tbi index to the user-requested paths. The .bgz default behaviour is preserved when the filename does not end in .gz.

Behaviour after fix

Input filename index=TRUE output
out.vcf out.vcf.bgz (unchanged)
out.vcf.bgz out.vcf.bgz (unchanged)
out.vcf.gz out.vcf.gz
out <- writeVcf(vcf, "out.vcf.gz", index=TRUE)
# out == "out.vcf.gz"   # TRUE
# file.exists("out.vcf.gz.tbi")  # TRUE

Changes

  • R/methods-writeVcf.R — capture desired path before bgzip(); rename if needed
  • man/writeVcf-methods.Rd — document the .gz behaviour in the index argument entry

Closes #35

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/35-vcf-gz-suffix branch from 94027d0 to c6083f8 Compare July 18, 2026 03:01
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.

API to change output suffix to .gz

2 participants