diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
index ffb3106..1fbcec0 100644
--- a/.buildkite/pipeline.yml
+++ b/.buildkite/pipeline.yml
@@ -5,7 +5,8 @@ steps:
- ". /etc/profile.d/conda.sh"
- "conda activate wilson"
# - "Rscript -e 'install.packages(\"rje\")'"
- - "Rscript -e 'devtools::check()'"
+ - "R CMD build ."
+ - "R CMD check *tar.gz --as-cran"
# - wait
diff --git a/.buildkite/wilson-env.yml b/.buildkite/wilson-env.yml
index 574754e..edf27f7 100644
--- a/.buildkite/wilson-env.yml
+++ b/.buildkite/wilson-env.yml
@@ -16,7 +16,7 @@ dependencies:
- r-RColorBrewer
- r-shinyjs
- r-viridis
-# - r-rje
+ - r-rje
# - r-grdevices # base package
# - r-grid # base package
- r-plyr
@@ -43,3 +43,6 @@ dependencies:
- r-devtools
- "readline==6.3"
- r-roxygen2
+ - r-rmarkdown
+ - r-testthat
+# - r-vdiffr # not yet in conda-forge
diff --git a/DESCRIPTION b/DESCRIPTION
index 1cf9a47..3e02a57 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: wilson
Type: Package
Title: Web-Based Interactive Omics Visualization
-Version: 2.0.0
+Version: 2.0.1
Authors@R: c(
person("Hendrik", "Schultheis", email = "hendrik.schultheis@mpi-bn.mpg.de", role = c("aut", "cre")),
person("Jens", "Preussner", email = "jens.preussner@mpi-bn.mpg.de", role = "aut"),
@@ -50,5 +50,6 @@ RoxygenNote: 6.0.1
biocViews:
Suggests: knitr,
rmarkdown,
- testthat
+ testthat,
+ vdiffr
VignetteBuilder: knitr
diff --git a/NEWS.md b/NEWS.md
index 9cdcac3..5bbbfcc 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,5 @@
+# wilson 2.0.1
+- tests added
# wilson 2.0.0
## Features
- clarion class:
diff --git a/R/function.R b/R/function.R
index d93701a..754c715 100644
--- a/R/function.R
+++ b/R/function.R
@@ -125,7 +125,7 @@ create_scatterplot <- function(data, data.labels = NULL, data.hovertext = NULL,
if (density) {
### kernel density
# plot$layers <- c(stat_density2d(geom = "tile", aes(fill = ..density..^0.25), n=200, contour=FALSE) + aes_(fill = as.name(var)), plot$layers) # n = resolution; density less sparse
- plot <- plot + ggplot2::stat_density2d(geom = "tile", ggplot2::aes_(fill = ~ ..density.. ^ 0.25), n = 200, contour = FALSE)
+ plot <- plot + ggplot2::stat_density2d(geom = "tile", ggplot2::aes_(fill = ~ ..density.. ^ 0.25, color = NULL), n = 200, contour = FALSE)
plot <- plot + ggplot2::scale_fill_gradient(low = "white", high = "black") +
# guides(fill=FALSE) + # remove density legend
@@ -1152,7 +1152,7 @@ searchData <- function(input, choices, options = c("=", "<", ">"), min. = min(ch
}
# range
- if ("inner" == options){
+ if ("inner" == options) {
if (x >= input[1] & x <= input[2]) return(TRUE)
}
if ("outer" == options) {
@@ -1203,15 +1203,17 @@ searchData <- function(input, choices, options = c("=", "<", ">"), min. = min(ch
download <- function(file, filename, plot, width, height, ppi = 72, save_plot = TRUE, ui = NULL) {
session <- shiny::getDefaultReactiveDomain()
- # show notification
- shiny::showNotification(
- id = session$ns("download-note"),
- shiny::tags$b("Preparing download files. Please wait..."),
- duration = NULL,
- closeButton = FALSE,
- type = "message"
- )
- shinyjs::runjs(paste0("$(document.getElementById('", paste0("shiny-notification-", session$ns("download-note")), "')).addClass('notification-position-center');"))
+ if (!is.null(session)) {
+ # show notification
+ shiny::showNotification(
+ id = session$ns("download-note"),
+ shiny::tags$b("Preparing download files. Please wait..."),
+ duration = NULL,
+ closeButton = FALSE,
+ type = "message"
+ )
+ shinyjs::runjs(paste0("$(document.getElementById('", paste0("shiny-notification-", session$ns("download-note")), "')).addClass('notification-position-center');"))
+ }
# cut off file extension
name <- sub("(.*)\\..*$", replacement = "\\1", filename)
@@ -1283,8 +1285,10 @@ download <- function(file, filename, plot, width, height, ppi = 72, save_plot =
# remove tmp files
file.remove(files)
- # remove notification
- shiny::removeNotification(session$ns("download-note"))
+ if (!is.null(session)) {
+ # remove notification
+ shiny::removeNotification(session$ns("download-note"))
+ }
return(out)
}
diff --git a/R/global.R b/R/global.R
index 75aea44..97bc8af 100644
--- a/R/global.R
+++ b/R/global.R
@@ -11,8 +11,10 @@ wilson.globals <- new.env(parent = emptyenv())
#'
#' @export
set_logger <- function(logger, token = NULL) {
- if (is.null(logger) || methods::is(logger, "logger")) {
+ if (methods::is(logger, "logger")) {
assign(x = paste0("logger", token), value = logger, envir = wilson.globals)
+ } else if (is.null(logger)) {
+ rm(list = paste0("logger", token), envir = wilson.globals)
}
}
diff --git a/cran-comments.md b/cran-comments.md
index 580a3bb..57c8438 100644
--- a/cran-comments.md
+++ b/cran-comments.md
@@ -1,3 +1,4 @@
+# Submission 1
## Test environments
* local windows 7 install, R 3.5.1
* debian 9.4, R 3.4.1
@@ -20,3 +21,37 @@ There was 1 NOTE:
I have also run R CMD check on downstream dependencies of wilson
(https://github.molgen.mpg.de/loosolab/wilson/tree/master/revdep).
All packages that I could install passed.
+
+## Reviewer comments
+Thanks, we see you have lots of cuntions without examples (which may be reasonable given they are not intended t be called by users directly).
+Nevertheless, it would be good to have them tested, so please create, if examples are not feasible, at least tests that execute the various functions in your package.
+
+Best,
+Uwe Ligges
+
+# Submission 2
+## Test environments
+* local windows 7 install, R 3.5.1
+* debian 9.4, R 3.4.1
+* win-builder (devel and release)
+
+## Submission comments
+Addressed reviewer comments by adding tests where possible.
+
+## R CMD check results
+There were no ERRORs or WARNINGs.
+
+There was 1 NOTE:
+
+* New submission
+
+* Possibly mis-spelled words in DESCRIPTION:
+ Omics (3:30)
+ omics (9:126)
+
+ Both are spelled correctly. First is capital because of title case.
+
+## Downstream dependencies
+I have also run R CMD check on downstream dependencies of wilson
+(https://github.molgen.mpg.de/loosolab/wilson/tree/master/revdep).
+All packages that I could install passed.
diff --git a/revdep/README.md b/revdep/README.md
index d73a3a5..97e39b4 100644
--- a/revdep/README.md
+++ b/revdep/README.md
@@ -10,7 +10,7 @@
|language |(EN) |
|collate |German_Germany.1252 |
|tz |Europe/Berlin |
-|date |2018-07-04 |
+|date |2018-07-16 |
## Packages
@@ -24,10 +24,10 @@
|DT | |0.4 |2018-01-30 |CRAN (R 3.5.1) |
|factoextra | |1.0.5 |2017-08-22 |CRAN (R 3.5.1) |
|FactoMineR | |1.41 |2018-05-04 |CRAN (R 3.5.1) |
-|ggplot2 | |2.2.1 |2016-12-30 |CRAN (R 3.5.1) |
+|ggplot2 | |3.0.0 |2018-07-03 |CRAN (R 3.5.1) |
|ggrepel | |0.8.0 |2018-05-09 |CRAN (R 3.5.1) |
|gplots | |3.0.1 |2016-03-30 |CRAN (R 3.5.1) |
-|heatmaply | |0.15.0 |2018-06-23 |CRAN (R 3.5.1) |
+|heatmaply | |0.15.2 |2018-07-06 |CRAN (R 3.5.1) |
|knitr | |1.20 |2018-02-20 |CRAN (R 3.5.1) |
|log4r | |0.2 |2014-09-29 |CRAN (R 3.5.1) |
|openssl | |1.0.1 |2018-03-03 |CRAN (R 3.5.1) |
@@ -46,8 +46,10 @@
|shinycssloaders | |0.2.0 |2017-05-12 |CRAN (R 3.5.1) |
|shinydashboard | |0.7.0 |2018-03-21 |CRAN (R 3.5.1) |
|shinyjs | |1.0 |2018-01-08 |CRAN (R 3.5.1) |
+|testthat | |2.0.0 |2017-12-13 |CRAN (R 3.5.1) |
+|vdiffr | |0.2.3 |2018-04-27 |CRAN (R 3.5.1) |
|viridis | |0.5.1 |2018-03-29 |CRAN (R 3.5.1) |
-|wilson |* |2.0.0 |2018-07-04 |local (HendrikSchultheis/wilson@NA) |
+|wilson | |2.0.1 |2018-07-16 |local (HendrikSchultheis/wilson@NA) |
# Check results
diff --git a/revdep/checks.rds b/revdep/checks.rds
index 208d158..103e5c1 100644
Binary files a/revdep/checks.rds and b/revdep/checks.rds differ
diff --git a/revdep/problems.md b/revdep/problems.md
index 8f790c3..8bbf2e7 100644
--- a/revdep/problems.md
+++ b/revdep/problems.md
@@ -10,7 +10,7 @@
|language |(EN) |
|collate |German_Germany.1252 |
|tz |Europe/Berlin |
-|date |2018-07-04 |
+|date |2018-07-16 |
## Packages
@@ -24,10 +24,10 @@
|DT | |0.4 |2018-01-30 |CRAN (R 3.5.1) |
|factoextra | |1.0.5 |2017-08-22 |CRAN (R 3.5.1) |
|FactoMineR | |1.41 |2018-05-04 |CRAN (R 3.5.1) |
-|ggplot2 | |2.2.1 |2016-12-30 |CRAN (R 3.5.1) |
+|ggplot2 | |3.0.0 |2018-07-03 |CRAN (R 3.5.1) |
|ggrepel | |0.8.0 |2018-05-09 |CRAN (R 3.5.1) |
|gplots | |3.0.1 |2016-03-30 |CRAN (R 3.5.1) |
-|heatmaply | |0.15.0 |2018-06-23 |CRAN (R 3.5.1) |
+|heatmaply | |0.15.2 |2018-07-06 |CRAN (R 3.5.1) |
|knitr | |1.20 |2018-02-20 |CRAN (R 3.5.1) |
|log4r | |0.2 |2014-09-29 |CRAN (R 3.5.1) |
|openssl | |1.0.1 |2018-03-03 |CRAN (R 3.5.1) |
@@ -46,8 +46,10 @@
|shinycssloaders | |0.2.0 |2017-05-12 |CRAN (R 3.5.1) |
|shinydashboard | |0.7.0 |2018-03-21 |CRAN (R 3.5.1) |
|shinyjs | |1.0 |2018-01-08 |CRAN (R 3.5.1) |
+|testthat | |2.0.0 |2017-12-13 |CRAN (R 3.5.1) |
+|vdiffr | |0.2.3 |2018-04-27 |CRAN (R 3.5.1) |
|viridis | |0.5.1 |2018-03-29 |CRAN (R 3.5.1) |
-|wilson |* |2.0.0 |2018-07-04 |local (HendrikSchultheis/wilson@NA) |
+|wilson | |2.0.1 |2018-07-16 |local (HendrikSchultheis/wilson@NA) |
# Check results
diff --git a/tests/figs/create-static-plots/static-geneview.svg b/tests/figs/create-static-plots/static-geneview.svg
new file mode 100644
index 0000000..6793332
--- /dev/null
+++ b/tests/figs/create-static-plots/static-geneview.svg
@@ -0,0 +1,374 @@
+
+
diff --git a/tests/figs/create-static-plots/static-heatmap.svg b/tests/figs/create-static-plots/static-heatmap.svg
new file mode 100644
index 0000000..ffcf28a
--- /dev/null
+++ b/tests/figs/create-static-plots/static-heatmap.svg
@@ -0,0 +1,523 @@
+
+
diff --git a/tests/figs/create-static-plots/static-pca.svg b/tests/figs/create-static-plots/static-pca.svg
new file mode 100644
index 0000000..609ff93
--- /dev/null
+++ b/tests/figs/create-static-plots/static-pca.svg
@@ -0,0 +1,66 @@
+
+
diff --git a/tests/figs/create-static-plots/static-scatterplot.svg b/tests/figs/create-static-plots/static-scatterplot.svg
new file mode 100644
index 0000000..38aa278
--- /dev/null
+++ b/tests/figs/create-static-plots/static-scatterplot.svg
@@ -0,0 +1,40103 @@
+
+
diff --git a/tests/figs/deps.txt b/tests/figs/deps.txt
new file mode 100644
index 0000000..8bd22f8
--- /dev/null
+++ b/tests/figs/deps.txt
@@ -0,0 +1,6 @@
+Fontconfig: 2.11.94
+FreeType: 2.6.0
+Cairo: 1.14.2
+vdiffr: 0.2.3
+svglite: 1.2.1
+ggplot2: 3.0.0
diff --git a/tests/testthat/test-download.R b/tests/testthat/test-download.R
new file mode 100644
index 0000000..f5f7dd4
--- /dev/null
+++ b/tests/testthat/test-download.R
@@ -0,0 +1,39 @@
+context("Download")
+
+test_that("ggplot is downloadable", {
+ plot <- ggplot2::ggplot(mtcars, ggplot2::aes(mpg, hp)) + ggplot2::geom_point()
+ width <- 20
+ height <- 20
+ file <- tempfile(fileext = ".zip")
+ filename <- "plot"
+
+ expect_false(file.exists(file))
+ expect_silent(download(file = file, filename = filename, plot = plot, width = width, height = height))
+ expect_true(file.exists(file))
+})
+
+test_that("plotly is downloadable", {
+ skip_on_cran()
+
+ plot <- plotly::ggplotly(ggplot2::ggplot(mtcars, ggplot2::aes(mpg, hp)) + ggplot2::geom_point())
+ width <- 20
+ height <- 20
+ file <- tempfile(fileext = ".zip")
+ filename <- "plot"
+
+ expect_false(file.exists(file))
+ expect_silent(download(file = file, filename = filename, plot = plot, width = width, height = height))
+ expect_true(file.exists(file))
+})
+
+test_that("complexHeatmap is downloadable", {
+ plot <- ComplexHeatmap::Heatmap(mtcars)
+ width <- 20
+ height <- 20
+ file <- tempfile(fileext = ".zip")
+ filename <- "plot"
+
+ expect_false(file.exists(file))
+ expect_silent(download(file = file, filename = filename, plot = plot, width = width, height = height))
+ expect_true(file.exists(file))
+})
diff --git a/tests/testthat/test-equalize.R b/tests/testthat/test-equalize.R
new file mode 100644
index 0000000..3509f28
--- /dev/null
+++ b/tests/testthat/test-equalize.R
@@ -0,0 +1,21 @@
+context("Equalize tables and vectors")
+
+test_that("equalize works with tables", {
+ table <- data.table::data.table(seq_len(10), seq(11, 20))
+ eq <- equalize(table)
+
+ expect_length(eq, 2)
+ expect_equal(eq, c(-20, 20))
+})
+
+test_that("equalize works with vectors", {
+ vec <- seq_len(10)
+ eq <- equalize(vec)
+
+ expect_length(eq, 2)
+ expect_equal(eq, c(-10, 10))
+})
+
+test_that("non-numeric throws error", {
+ expect_error(equalize("a"))
+})
diff --git a/tests/testthat/test-forceArgs.R b/tests/testthat/test-forceArgs.R
new file mode 100644
index 0000000..2a628bc
--- /dev/null
+++ b/tests/testthat/test-forceArgs.R
@@ -0,0 +1,31 @@
+context("forceArgs")
+
+test_that("arguments are evaluated", {
+ lazy_fun <- function(x, y) function() c(x, y)
+ forceArgs_fun <- function(x, y) {
+ forceArgs()
+ function() c(x, y)
+ }
+
+ lazy_funList <- list()
+ for (i in 1:2) {
+ lazy_funList[[i]] <- lazy_fun(x = i, y = i)
+ }
+ lazy_result <- vapply(lazy_funList, function(x) x(), FUN.VALUE = numeric(2))
+
+
+ forceArgs_funList <- list()
+ for (j in 1:2) {
+ forceArgs_funList[[j]] <- forceArgs_fun(x = j, y = j)
+ }
+ forceArgs_result <- vapply(forceArgs_funList, function(x) x(), FUN.VALUE = numeric(2))
+
+ forceAndCall_funList <- list()
+ for (k in 1:2) {
+ forceAndCall_funList[[k]] <- forceAndCall(n = 2, lazy_fun, x = k, y = k)
+ }
+ forceAndCall_result <- vapply(forceAndCall_funList, function(x) x(), FUN.VALUE = numeric(2))
+
+ expect_false(all(lazy_result == forceArgs_result))
+ expect_equal(forceArgs_result, forceAndCall_result)
+})
diff --git a/tests/testthat/test-interactive-plots.R b/tests/testthat/test-interactive-plots.R
new file mode 100644
index 0000000..05df80a
--- /dev/null
+++ b/tests/testthat/test-interactive-plots.R
@@ -0,0 +1,23 @@
+context("Create interactive plots")
+
+test_that("scatterplot can be created", {
+ data <- data.table::data.table(mtcars[, c("mpg", "hp", "vs")], keep.rownames = "id")
+
+ out <- create_scatterplot(data, highlight.data = data[1:3,], highlight.color = "blue", color = c("red", "green"), categorized = TRUE, plot.method = "interactive")
+ expect_is(out$plot, class = "plotly")
+})
+
+test_that("heatmap can be created", {
+ data <- data.table::data.table(mtcars, keep.rownames = "id")
+
+ out <- create_heatmap(data, colors = c("red", "green"), plot.method = "interactive")
+ expect_is(out$plot, class = "plotly")
+})
+
+test_that("geneview can be created", {
+ data <- data.table::data.table(mtcars, keep.rownames = "id")
+ grouping <- grouping <- data.table::data.table(names(data)[-1], factor = rep(c("a", "b"), length.out = ncol(data) - 1))
+
+ out <- create_geneview(data, grouping = grouping, colors = c("red", "green"), plot.method = "interactive")
+ expect_is(out$plot, class = "plotly")
+})
diff --git a/tests/testthat/test-logging.R b/tests/testthat/test-logging.R
new file mode 100644
index 0000000..1a54de6
--- /dev/null
+++ b/tests/testthat/test-logging.R
@@ -0,0 +1,27 @@
+context("Logging")
+
+test_that("logger can be created and deleted", {
+ logger <- log4r::create.logger()
+ token <- "test"
+
+ expect_false(exists(paste0("logger", token), envir = wilson.globals))
+ set_logger(logger = logger, token = token)
+ expect_identical(logger, get(paste0("logger", token), envir = wilson.globals))
+ set_logger(logger = NULL, token = token)
+ expect_false(exists(paste0("logger", token), envir = wilson.globals))
+})
+
+test_that("message can be logged", {
+ logfile <- tempfile()
+ logger <- log4r::create.logger(logfile = logfile, level = "DEBUG")
+ token <- "test_log"
+
+ set_logger(logger = logger, token = token)
+ expect_false(file.exists(logfile))
+ log_message("test message", level = "DEBUG", token = token)
+ expect_true(file.exists(logfile))
+ file.remove(logfile)
+ set_logger(logger = NULL, token = token)
+ log_message("test message", level = "DEBUG", token = token)
+ expect_false(file.exists(logfile))
+})
diff --git a/tests/testthat/test-parser.R b/tests/testthat/test-parser.R
new file mode 100644
index 0000000..859a2fd
--- /dev/null
+++ b/tests/testthat/test-parser.R
@@ -0,0 +1,12 @@
+context("Parse clarion file")
+
+test_that("file is parsed correctly", {
+ object <- parser(file = "wiki_example.clarion", dec = ",")
+
+ expect_is(object, "Clarion")
+ expect_equal(object$get_delimiter(), "|")
+ expect_equal(object$get_factors(), object$metadata[, c("key", "factor1", "factor2")])
+ expect_equal(object$get_id(), "id")
+ expect_equal(object$get_name(), "name")
+ expect_equal(object$is_delimited(names(object$data)), c(rep(FALSE, 3), TRUE, rep(FALSE, 8)))
+})
diff --git a/tests/testthat/test-searchData.R b/tests/testthat/test-searchData.R
new file mode 100644
index 0000000..22be414
--- /dev/null
+++ b/tests/testthat/test-searchData.R
@@ -0,0 +1,51 @@
+context("orNumeric searchData function")
+
+test_that("no selection returns all TRUE", {
+ input <- c(5)
+ choices <- c(seq_len(20), NA, NaN)
+ selection <- searchData(input = input, choices = choices, options = NULL)
+
+ expect_length(selection, length(choices))
+ expect_type(selection, "logical")
+ expect_equal(selection, rep(TRUE, length(choices)))
+})
+
+test_that("ranged selection is correct", {
+ input <- c(2, 5)
+ choices <- c(seq_len(20), NA, NaN)
+ selection_inner <- searchData(input = input, choices = choices, options = "inner")
+ selection_outer <- searchData(input = input, choices = choices, options = "outer")
+
+ expect_length(selection_inner, length(choices))
+ expect_type(selection_inner, "logical")
+ expect_equal(selection_inner, c(FALSE, rep(TRUE, 4), rep(FALSE, 17)))
+
+ expect_length(selection_outer, length(choices))
+ expect_type(selection_outer, "logical")
+ expect_equal(selection_outer, c(TRUE, rep(FALSE, 4), rep(TRUE, 15), rep(FALSE, 2)))
+})
+
+test_that("single selection is correct", {
+ input <- c(2)
+ choices <- c(seq_len(20), NA, NaN)
+ selection_equal <- searchData(input = input, choices = choices, options = "=")
+ selection_smaller <- searchData(input = input, choices = choices, options = "<")
+ selection_greater <- searchData(input = input, choices = choices, options = ">")
+ selection_all <- searchData(input = input, choices = choices, options = c("=", "<", ">"))
+
+ expect_length(selection_equal, length(choices))
+ expect_type(selection_equal, "logical")
+ expect_equal(selection_equal, c(FALSE, TRUE, rep(FALSE, 20)))
+
+ expect_length(selection_smaller, length(choices))
+ expect_type(selection_smaller, "logical")
+ expect_equal(selection_smaller, c(TRUE, rep(FALSE, 21)))
+
+ expect_length(selection_greater, length(choices))
+ expect_type(selection_greater, "logical")
+ expect_equal(selection_greater, c(rep(FALSE, 2), rep(TRUE, 18), rep(FALSE, 2)))
+
+ expect_length(selection_all, length(choices))
+ expect_type(selection_all, "logical")
+ expect_equal(selection_all, c(rep(TRUE, 20), rep(FALSE, 2)))
+})
diff --git a/tests/testthat/test-static-plots.R b/tests/testthat/test-static-plots.R
new file mode 100644
index 0000000..b301dfc
--- /dev/null
+++ b/tests/testthat/test-static-plots.R
@@ -0,0 +1,31 @@
+context("Create static plots")
+
+test_that("scatterplot can be created", {
+ data <- data.table::data.table(mtcars[, c("mpg", "hp", "vs")], keep.rownames = "id")
+
+ out <- create_scatterplot(data, highlight.data = data[1:3,], highlight.color = "blue", color = c("red", "green"), categorized = TRUE)
+ vdiffr::expect_doppelganger("static scatterplot", out$plot)
+})
+
+test_that("pca can be created", {
+ data <- data.table::data.table(mtcars, keep.rownames = "id")
+ grouping <- rep(c("a", "b", "c"), length.out = ncol(data) - 1)
+
+ out <- create_pca(data, color.group = grouping, shape.group = grouping, palette = c("red", "green", "blue"))
+ vdiffr::expect_doppelganger("static pca", out$plot)
+})
+
+test_that("heatmap can be created", {
+ data <- data.table::data.table(mtcars, keep.rownames = "id")
+
+ out <- create_heatmap(data, colors = c("red", "green"))
+ vdiffr::expect_doppelganger("static heatmap", out$plot)
+})
+
+test_that("geneview can be created", {
+ data <- data.table::data.table(mtcars, keep.rownames = "id")
+ grouping <- grouping <- data.table::data.table(names(data)[-1], factor = rep(c("a", "b"), length.out = ncol(data) - 1))
+
+ out <- create_geneview(data, grouping = grouping, colors = c("red", "green"))
+ vdiffr::expect_doppelganger("static geneview", out$plot)
+})
diff --git a/tests/testthat/wiki_example.clarion b/tests/testthat/wiki_example.clarion
new file mode 100644
index 0000000..919074a
--- /dev/null
+++ b/tests/testthat/wiki_example.clarion
@@ -0,0 +1,23 @@
+!format=Clarion
+!version=1.0
+!experiment_id=123456
+!delimiter=|
+#key factor1 factor2 level type label sub_label
+#id feature unique_id Identifier unique
+#name feature name Name
+#active feature category Active
+#attr feature array Attributes
+#sample_a_1 sample_a 6h sample score Sample A first
+#sample_a_2 sample_a 12h sample score Sample A second
+#sample_b_1 sample_b 6h sample score Sample B first
+#sample_b_2 sample_b 12h sample score Sample B second
+#mean_a sample_a condition score Sample A mean
+#mean_b sample_b condition score Sample B mean
+#fc_ab contrast ratio Sample A|Sample B Fold change
+#pval contrast probability Sample A|Sample B P-Value
+id name active attr sample_a_1 sample_a_2 sample_b_1 sample_b_2 mean_a mean_b fc_ab pval
+id_1 AAA Yes attr1|attr2 10000 100 50 500 5050 275 18,36363636 0,1
+id_2 BBB Yes attr2|attr3 300 400 40000 2302 350 21151 0,016547681 0,2
+id_3 CCC No attr3|attr4 20 2300 12002 5600 1160 8801 0,131803204 0,4
+id_4 DDD No attr5 1234 10 9500 1200 622 5350 0,116261682 0,01
+id_5 EEE No attr7|attr8|attr1 900 450 940 60 675 500 1,35 0,9