Skip to content
Snippets Groups Projects
Commit 42d6ff2d authored by dj44vuri's avatar dj44vuri
Browse files

autodetect in readdesign

parent fc6b1247
No related branches found
No related tags found
No related merge requests found
...@@ -22,22 +22,22 @@ ...@@ -22,22 +22,22 @@
readdesign <- function(design = designfile, designtype = NULL) { readdesign <- function(design = designfile, designtype = NULL) {
# if (is.null(designtype)) { if (is.null(designtype)) {
#
#
#
# # Check if the string ends with ".ngd" # Check if the string ends with ".ngd"
# if (grepl("\\.ngd$", designfile)) { if (grepl("\\.ngd$", designfile)) {
# # Code to execute if condition is true # Code to execute if condition is true
# designtype = "ngene" designtype = "ngene"
# print("I guessed it is an ngene file") print("I guessed it is an ngene file")
# } else { } else {
# # Code to execute if condition is false # Code to execute if condition is false
# designtype = "spdesign" designtype = "spdesign"
# print("I assume it is a spdesign") print("I assume it is a spdesign")
# } }
#
# } }
design <- switch(designtype, design <- switch(designtype,
"ngene" = suppressWarnings(readr::read_delim(design, "ngene" = suppressWarnings(readr::read_delim(design,
......
No preview for this file type
...@@ -15,14 +15,27 @@ test_that("all is correct", { ...@@ -15,14 +15,27 @@ test_that("all is correct", {
expect_no_error(readdesign(design = design_path, designtype = "ngene")) expect_no_error(readdesign(design = design_path, designtype = "ngene"))
}) })
# test if autodetect ngd design
test_that("all is correct", {
expect_no_error(readdesign(design = design_path))
})
### Tests for spdesign ### Tests for spdesign
design_path <- system.file("extdata","CSA", "design2.RDS" ,package = "simulateDCE") design_path <- system.file("extdata","CSA", "linear", "BLIbay.RDS" ,package = "simulateDCE")
test_that("all is correct", { test_that("all is correct", {
expect_no_error(readdesign(design = design_path, designtype = "spdesign")) expect_no_error(readdesign(design = design_path, designtype = "spdesign"))
}) })
# Same Tests for spdesign, but detect automatically if it is spdesign
test_that("all is correct", {
expect_no_error(readdesign(design = design_path))
})
## trying objects that do not work ## trying objects that do not work
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment