tests/testthat/test_VCFsToCatalogAndPlotToPdf.R

context("VCFsToCatalogsAndPlotToPdf functions")

test_that("CatalogAndPlotToPdf function for Mutect VCFs", {
  skip_if("" == system.file(package = "BSgenome.Hsapiens.1000genomes.hs37d5"))
  stopifnot(requireNamespace("BSgenome.Hsapiens.1000genomes.hs37d5"))
  files <- list.files(path = "testdata/Mutect-GRCh37", full.names = TRUE)
  catalogs1 <- VCFsToCatalogsAndPlotToPdf(files, ref.genome = "hg19", 
                                         output.dir = tempdir(),
                                         variant.caller = "mutect",
                                         region = "genome",
                                         base.filename = "mutect")
  names <- grep("\\.pdf$", list.files(tempdir()), value = TRUE)
  expect_equal(length(names), 8)
  unlink(file.path(tempdir(), names))
})

test_that("CatalogAndPlotToPdf function for Strelka SBS VCFs", {
  skip_if("" == system.file(package = "BSgenome.Hsapiens.1000genomes.hs37d5"))
  stopifnot(requireNamespace("BSgenome.Hsapiens.1000genomes.hs37d5"))
  files <- list.files(path = "testdata/Strelka-SBS-GRCh37/", full.names = TRUE)
  catalogs1 <- VCFsToCatalogsAndPlotToPdf(files, ref.genome = "hg19", 
                                         output.dir = tempdir(),
                                         variant.caller = "strelka",
                                         region = "genome",
                                         base.filename = "strelka.sbs")
  names <- grep("\\.pdf$", list.files(tempdir()), value = TRUE)
  expect_equal(length(names), 8)
  unlink(file.path(tempdir(), names))
})

test_that("CatalogAndPlotToPdf function for Strelka ID VCFs", {
  skip_if("" == system.file(package = "BSgenome.Hsapiens.1000genomes.hs37d5"))
  stopifnot(requireNamespace("BSgenome.Hsapiens.1000genomes.hs37d5"))
  files <- list.files(path = "testdata/Strelka-ID-GRCh37/", full.names = TRUE)
  catalogs1 <- VCFsToCatalogsAndPlotToPdf(files, ref.genome = "hg19", 
                                         output.dir = tempdir(),
                                         variant.caller = "strelka",
                                         region = "genome",
                                         base.filename = "strelka.id")
  names <- grep("\\.pdf$", list.files(tempdir()), value = TRUE)
  expect_equal(length(names), 8)
  unlink(file.path(tempdir(), names))
})

Try the ICAMS package in your browser

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

ICAMS documentation built on April 3, 2021, 5:07 p.m.