tests/testthat/test_count_vcf_individuals.R

skip_if_not_installed("vcfR")

test_that("count_vcf_individuals with gzfile", {
  vcf_path <- system.file(
    "extdata/ploidy/ploidy_test.vcf.gz",
    package = "tidypopgen"
  )
  n_individuals <- count_vcf_individuals(vcf_path)
  vcfr_obj <- vcfR::read.vcfR(vcf_path, verbose = FALSE)
  expect_equal(n_individuals, ncol(vcfR::extract.gt(vcfr_obj)))
})

Try the tidypopgen package in your browser

Any scripts or data that you put into this service are public.

tidypopgen documentation built on Aug. 28, 2025, 1:08 a.m.