Checks if the VCF file contains any variants.
Examples
x <- system.file("extdata/umccrise/snv/somatic-ensemble-PASS.vcf.gz", package = "gpgr")
(y <- vcf_is_empty(x))
#> [1] FALSE
tmp1 <- tempfile(pattern = "fakeFile", fileext = "vcf")
writeLines(c("col1\tcol2\tcol3", "1\t2\t3"), con = tmp1)
if (FALSE) {
vcf_is_empty(tmp1)
}
vcf_cols <- c(
"#CHROM", "POS", "ID", "REF", "ALT", "QUAL",
"FILTER", "INFO", "FORMAT"
)
tmp2 <- tempfile(pattern = "fakeFile", fileext = "vcf")
writeLines(paste(vcf_cols, collapse = "\t"), con = tmp2)
(z <- vcf_is_empty(tmp2))
#> /tmp/Rtmp5lfwP1/fakeFile17523f3eff89vcf does not contain any non-header rows.
#> [1] TRUE
tmp3 <- tempfile(pattern = "fakeFile", fileext = "FOO")
writeLines(paste(vcf_cols, collapse = "\t"), con = tmp3)
if (FALSE) {
vcf_is_empty(tmp3)
}