Skip to contents

count the heterozygous sites per sample in the VCF/BCF

Usage

vcfpopgen(
  vcffile,
  region = "",
  samples = "-",
  pass = FALSE,
  qual = 0,
  fun = "heterozygosity"
)

Arguments

vcffile

path to the VCF/BCF file

region

region to subset like bcftools

samples

samples to subset like bcftools

pass

restrict to variants with FILTER==PASS

qual

restrict to variants with QUAL > qual.

fun

which popgen function to run. available functions are "heterozygosity".

Value

vcfpopgen a list containing the following components:

samples

: character vector;
the samples ids in the VCF file after subsetting

hets

: integer vector;
the counts of heterozygous sites of each sample in the same order as samples

Author

Zilong Li zilong.dk@gmail.com

Examples

library('vcfppR')
vcffile <- system.file("extdata", "raw.gt.vcf.gz", package="vcfppR")
res <- vcfpopgen(vcffile)
str(res)