Nothing
library(countsimQC)
context("Check report generation")
local({
tempDir <- tempdir()
data(countsimExample)
x <- lapply(countsimExample, function(w) w[1:50, ])
if (file.exists(file.path(tempDir, "report_from_test.Rmd"))) {
file.remove(file.path(tempDir, "report_from_test.Rmd"))
}
if (file.exists(file.path(tempDir, "report_from_test.html"))) {
file.remove(file.path(tempDir, "report_from_test.html"))
}
if (file.exists(file.path(tempDir, "report_from_test.pdf"))) {
file.remove(file.path(tempDir, "report_from_test.pdf"))
}
if (file.exists(file.path(tempDir, "report_from_test_ggplots.rds"))) {
file.remove(file.path(tempDir, "report_from_test_ggplots.rds"))
}
test_that("Input argument errors are recognized", {
## outputFormat
expect_error(countsimQCReport(ddsList = x, outputFormat = "html",
outputFile = "report_from_test.html",
outputDir = tempDir, savePlots = TRUE))
expect_error(countsimQCReport(ddsList = x, outputFormat = "html_document",
outputFile = "report_from_test.pdf",
outputDir = tempDir, savePlots = TRUE))
## ddsList
expect_error(countsimQCReport(ddsList = x[[1]], outputFormat = "html_document",
outputFile = "report_from_test.html",
outputDir = tempDir, savePlots = TRUE))
expect_error(countsimQCReport(ddsList = list(A = 1:3),
outputFormat = "html_document",
outputFile = "report_from_test.html",
outputDir = tempDir, savePlots = TRUE))
y <- x
names(y) <- NULL
expect_error(countsimQCReport(ddsList = y, outputFormat = "html_document",
outputFile = "report_from_test.html",
outputDir = tempDir, savePlots = TRUE))
y <- x
names(y) <- c("A", "A", "B")
expect_error(countsimQCReport(ddsList = y, outputFormat = "html_document",
outputFile = "report_from_test.html",
outputDir = tempDir, savePlots = TRUE))
## rmd_template
expect_error(countsimQCReport(ddsList = x, outputFormat = "html_document",
outputFile = "report_from_test.html",
outputDir = tempDir, savePlots = TRUE,
rmdTemplate = "nonexistent.Rmd"))
## existing rmd output
file.create(file.path(tempDir, "test_generated.Rmd"))
expect_error(countsimQCReport(ddsList = x, outputFormat = "html_document",
outputFile = "test_generated.html",
outputDir = tempDir, savePlots = TRUE))
file.remove(file.path(tempDir, "test_generated.Rmd"))
## existing plot output
file.create(file.path(tempDir, "test_generated2_ggplots.rds"))
expect_error(countsimQCReport(ddsList = x, outputFormat = "html_document",
outputFile = "test_generated2.html",
outputDir = tempDir, savePlots = TRUE,
forceOverwrite = FALSE))
file.remove(file.path(tempDir, "test_generated2_ggplots.rds"))
})
cqr <- countsimQCReport(ddsList = x, outputFormat = "html_document",
outputFile = "test_generated.html",
outputDir = tempDir, savePlots = TRUE,
description = NULL)
expect_is(cqr, "character")
expect_error(countsimQCReport(ddsList = x, outputFormat = NULL,
outputFile = "test_generated.html",
outputDir = tempDir, savePlots = TRUE,
forceOverwrite = FALSE))
cqr <- countsimQCReport(ddsList = x, outputFormat = NULL,
outputFile = "test_generated.html",
outputDir = tempDir, savePlots = TRUE,
forceOverwrite = TRUE)
expect_is(cqr, "character")
generateIndividualPlots(
ggplotsRds = file.path(tempDir, "test_generated_ggplots.rds"),
device = "png",
outputDir = tempDir, nDatasets = 3
)
if (file.exists(file.path(tempDir, "report_from_test.html"))) {
file.remove(file.path(tempDir, "report_from_test.html"))
}
if (file.exists(file.path(tempDir, "report_from_test.pdf"))) {
file.remove(file.path(tempDir, "report_from_test.pdf"))
}
if (file.exists(file.path(tempDir, "report_from_test_ggplots.rds"))) {
file.remove(file.path(tempDir, "report_from_test_ggplots.rds"))
}
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.