tests/testthat/test-runFastQC.R

context("Check .fastqc()")

## Load a Fastq File
library(ShortRead)
sp <- SolexaPath(system.file('extdata', package = 'ShortRead'))
fl <- file.path(analysisPath(sp), "s_1_sequence.txt")
f <- FastqFile(fl)

test_that("runFastqc Errors Correctly on missing executable",{
    expect_error(runFastQC(f, tempdir(), exec = ""))
    expect_error(runFastQC(f, tempdir(), exec = NULL))
})

test_that("runFastQC handles incorrect file types before searching for the executable",{
    logFile <- system.file("extdata", "log.final.out", package = "ngsReports")
    expect_error(out <- runFastQC(logFile, tempdir()))
})

## Check the function runs if the executable exists
exec <- Sys.which("fastqc")
if (exec != "") {
    ## Check the deprecation message appears
    expect_message(
        ff <- runFastQC(f, tempdir(), exec = exec), ".+deprecated.+"
    )
    expect_equal(
        ff, file.path(tempdir(), gsub(".txt", "_fastqc.zip", basename(fl)))
    )
}

## This ensures that any stray connections formed during testing are closed
closeAllConnections()

Try the ngsReports package in your browser

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

ngsReports documentation built on Nov. 23, 2020, 2:01 a.m.