tests/testthat/test_qualityControl.R

context("qualityControl")
test_that("qualityControl work as expected", {
  fpath1 <- system.file("extdata", "output_kissplice_SNV.fa", package = "kissDE")
  mySNVcounts <- kissplice2counts(fpath1, counts = 0, pairedEnd = TRUE)
  mySNVconditions <- c("C1", "C1", "C2", "C2")
  # test qualityControl without storing figures
  qualityControl(mySNVcounts, mySNVconditions, storeFigs = FALSE)
  expect_true(file.exists("Rplots.pdf"))
  file.remove("Rplots.pdf")
  # test qualityControl storing figures in the default directory
  qualityControl(mySNVcounts, mySNVconditions, storeFigs = TRUE)
  dirname <- tempdir()
  expect_true(file.exists(paste0(dirname, "/kissDEFigures/heatmap.png")))
  expect_true(file.exists(paste0(dirname, "/kissDEFigures/pca.png")))
  file.remove("kissDEFigures/heatmap.png")
  file.remove("kissDEFigures/pca.png")
  unlink("kissDEFigures", recursive = TRUE)
  # test qualityControl storing figures in a path choosen by the user
  qualityControl(mySNVcounts, mySNVconditions, storeFigs = "test/path/fig/")
  expect_true(file.exists("test/path/fig/heatmap.png"))
  expect_true(file.exists("test/path/fig/pca.png"))
  file.remove("test/path/fig/heatmap.png")
  file.remove("test/path/fig/pca.png")
  unlink("test/path/fig", recursive = TRUE)
  unlink("test/path", recursive = TRUE)
  unlink("test", recursive = TRUE)
})

Try the kissDE package in your browser

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

kissDE documentation built on Nov. 8, 2020, 5:41 p.m.