Skip to content
This repository has been archived by the owner. It is now read-only.

testthat package #26

Merged
merged 23 commits into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2f7699e
added basic testthat structure
HendrikSchultheis Jul 11, 2018
88e4c52
add equalize test
HendrikSchultheis Jul 11, 2018
1837e75
add searchData test
HendrikSchultheis Jul 11, 2018
44584d1
added missing whitespace
HendrikSchultheis Jul 11, 2018
da309d0
removed redundant wilson:::
HendrikSchultheis Jul 11, 2018
798ff29
added parser test + test file
HendrikSchultheis Jul 11, 2018
999b032
set_logger: remove variable instead of setting it to NULL
HendrikSchultheis Jul 11, 2018
76c5d95
add logging test
HendrikSchultheis Jul 12, 2018
ffa246a
download: function runnable without reactive context for testing
HendrikSchultheis Jul 12, 2018
0a4fa75
add download test
HendrikSchultheis Jul 12, 2018
aac90db
added forceArgs test
HendrikSchultheis Jul 12, 2018
66ab5bd
use R CMD instead of devtools::check()
HendrikSchultheis Jul 12, 2018
186eff7
scatterplot: fixed density color with categorized coloring
HendrikSchultheis Jul 12, 2018
92f2afe
add static plot tests
HendrikSchultheis Jul 13, 2018
1c884a4
add interactive plot test
HendrikSchultheis Jul 13, 2018
5f78d1a
updated NEWS.md
HendrikSchultheis Jul 13, 2018
7c4e15b
updated DESCRIPTION: Suggest vdiffr; Version 2.0.1
HendrikSchultheis Jul 13, 2018
72c9530
update wilson-env.yml
HendrikSchultheis Jul 13, 2018
8dcaae6
fixed typo
HendrikSchultheis Jul 16, 2018
593ddac
skip plotly download on cran
HendrikSchultheis Jul 16, 2018
81beda5
Merge branch 'master' into cran_request
HendrikSchultheis Jul 16, 2018
8562927
update revdep check
HendrikSchultheis Jul 16, 2018
d389b4c
update cran-comments.md
HendrikSchultheis Jul 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion .buildkite/wilson-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,3 +43,6 @@ dependencies:
- r-devtools
- "readline==6.3"
- r-roxygen2
- r-rmarkdown
- r-testthat
# - r-vdiffr # not yet in conda-forge
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down Expand Up @@ -50,5 +50,6 @@ RoxygenNote: 6.0.1
biocViews:
Suggests: knitr,
rmarkdown,
testthat
testthat,
vdiffr
VignetteBuilder: knitr
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# wilson 2.0.1
- tests added
# wilson 2.0.0
## Features
- clarion class:
Expand Down
30 changes: 17 additions & 13 deletions R/function.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 3 additions & 1 deletion R/global.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
35 changes: 35 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Submission 1
## Test environments
* local windows 7 install, R 3.5.1
* debian 9.4, R 3.4.1
Expand All @@ -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.
10 changes: 6 additions & 4 deletions revdep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
|language |(EN) |
|collate |German_Germany.1252 |
|tz |Europe/Berlin |
|date |2018-07-04 |
|date |2018-07-16 |

## Packages

Expand All @@ -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) |
Expand All @@ -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

Expand Down
Binary file modified revdep/checks.rds
Binary file not shown.
10 changes: 6 additions & 4 deletions revdep/problems.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
|language |(EN) |
|collate |German_Germany.1252 |
|tz |Europe/Berlin |
|date |2018-07-04 |
|date |2018-07-16 |

## Packages

Expand All @@ -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) |
Expand All @@ -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

Expand Down
Loading