# Generated by roxytest: do not edit by hand!
# File R/utils.R: @testexamples
test_that("Function is_vcf() @ L31", {
x <- system.file("extdata/umccrise/snv/somatic-ensemble-PASS.vcf.gz", package = "gpgr")
(y <- is_vcf(x))
tmp_file <- tempfile(pattern = "fakeFile", fileext = "vcf")
writeLines(c("col1\tcol2\tcol3", "1\t2\t3"), con = tmp_file)
(z <- is_vcf(tmp_file))
expect_true(y)
expect_false(z)
})
test_that("Function vcf_is_empty() @ L105", {
x <- system.file("extdata/umccrise/snv/somatic-ensemble-PASS.vcf.gz", package = "gpgr")
(y <- vcf_is_empty(x))
tmp1 <- tempfile(pattern = "fakeFile", fileext = "vcf")
writeLines(c("col1\tcol2\tcol3", "1\t2\t3"), con = 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))
tmp3 <- tempfile(pattern = "fakeFile", fileext = "FOO")
writeLines(paste(vcf_cols, collapse = "\t"), con = tmp3)
expect_false(y)
expect_error(vcf_is_empty(tmp1))
expect_error(vcf_is_empty(tmp3))
})
test_that("Function tsv_is_empty() @ L141", {
tmp1 <- tempfile()
writeLines(c("col1\tcol2\tcol3", "1\t2\t3"), con = tmp1)
(a <- tsv_is_empty(tmp1))
tmp2 <- tempfile()
writeLines(c("col1\tcol2\tcol3"), con = tmp2)
(b <- tsv_is_empty(tmp2))
tmp3 <- tempfile()
writeLines(c("##meta1", "##meta2", "col1\tcol2\tcol3"), con = tmp3)
(c <- tsv_is_empty(tmp3))
expect_false(a)
expect_true(b)
expect_true(c)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.