Skip to contents

Quickly checks that the input file has a 'vcf' or 'vcf.gz' suffix, and that the column names correspond to typical VCF column headers.

Usage

is_vcf(x)

Arguments

x

Path to file.

Value

TRUE if the input file is inferred to be a VCF, FALSE otherwise.

Examples

x <- system.file("extdata/umccrise/snv/somatic-ensemble-PASS.vcf.gz", package = "gpgr")
(y <- is_vcf(x))
#> [1] TRUE
tmp_file <- tempfile(pattern = "fakeFile", fileext = "vcf")
writeLines(c("col1\tcol2\tcol3", "1\t2\t3"), con = tmp_file)
(z <- is_vcf(tmp_file))
#> VCF main column names are incorrect. They are:
#> col1, col2, col3.
#> They should include at the beginning:
#> #CHROM, POS, ID, REF, ALT, QUAL, FILTER, INFO.
#> [1] FALSE