Skip to contents

Reads plain, gzip or BGZF VCF sequentially without decoding sample genotypes. BCF and indexed access are unsupported.

Usage

gsim_scan_vcf(
  vcf,
  callback,
  info = character(),
  chromosome = NULL,
  region = NULL,
  batch_size = 4096L,
  output = NULL
)

Arguments

vcf

Path to a VCF file.

callback

Function called with each data frame of site records. When writing a subset, it must return one nonmissing logical per input row.

info

Character vector of INFO keys. Values are returned as text, absent keys as NA, and flags as "TRUE".

chromosome

Optional exact chromosome label.

region

Optional inclusive positive integer bounds, requiring a chromosome.

batch_size

Maximum number of records passed to the callback at once.

output

Optional path for a new gzip VCF containing the original header and selected records.

Value

Invisibly, the VCF header lines.

Details

Callback data frames contain numeric pos and character chrom, id, ref, alt, qual, and filter columns, followed by the requested INFO values in columns prefixed with info_.