Skip to contents

Parses VCF regions with bcftools. The VCF subset is written to a temporary file in the local filesystem, then parsed into a tibble object.

Usage

bcftools_parse_vcf_regions(vcf, r, only_pass = TRUE)

Arguments

vcf

Path to VCF. Can be S3, http or local. If presigned URL, need to also concatenate the VCF index as in 'vcf_url##idx##vcfi_url'.

r

Character vector of regions to subset (e.g. c('chr1:123-456', 'chr2:789-1000'))

only_pass

Keep PASS variants only (def: TRUE).

Value

A tibble with all the main, FORMAT, and INFO fields detected in the VCF header as columns, for the regions specified in r (if any).

Examples

if (FALSE) { # \dontrun{
vcf_local <- here::here("MergedSmallVariants.vcf.gz")
r <- c("chr1:115256529-115256529", "chr2:29443613-29443613")
bcftools_parse_vcf_regions(vcf_local, r)
} # }