diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 6a78da9..9e11c8f 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -26,23 +26,24 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes + NOT_CRAN: "true" steps: - uses: actions/checkout@c0a81a463886bb75afe234e07a9fd5bb79219196 - - uses: r-lib/actions/setup-pandoc@52330cc136b963487918a8867f948ddf954e9e63 + - uses: r-lib/actions/setup-pandoc@e0a5ffdf0b121aa1c2112f65e54b642a81dc29d9 - - uses: r-lib/actions/setup-r@756399d909bf9c180bbdafe8025f794f51f2da02 + - uses: r-lib/actions/setup-r@12d8dd416fec5aaa60f2f54609b713b2ec031a94 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@52330cc136b963487918a8867f948ddf954e9e63 + - uses: r-lib/actions/setup-r-dependencies@813ef1cb62cf0b4b51a044419024c37807fa8095 with: extra-packages: any::rcmdcheck needs: check - - uses: r-lib/actions/check-r-package@52330cc136b963487918a8867f948ddf954e9e63 + - uses: r-lib/actions/check-r-package@15dc53465b2f37cf7fc85ed97ae3e28f8e210955 with: upload-snapshots: true diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 659ff20..d83b49a 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -31,13 +31,13 @@ jobs: steps: - uses: actions/checkout@c0a81a463886bb75afe234e07a9fd5bb79219196 - - uses: r-lib/actions/setup-pandoc@52330cc136b963487918a8867f948ddf954e9e63 + - uses: r-lib/actions/setup-pandoc@e0a5ffdf0b121aa1c2112f65e54b642a81dc29d9 - - uses: r-lib/actions/setup-r@52330cc136b963487918a8867f948ddf954e9e63 + - uses: r-lib/actions/setup-r@12d8dd416fec5aaa60f2f54609b713b2ec031a94 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@52330cc136b963487918a8867f948ddf954e9e63 + - uses: r-lib/actions/setup-r-dependencies@813ef1cb62cf0b4b51a044419024c37807fa8095 with: extra-packages: any::pkgdown, local::. needs: website @@ -48,7 +48,7 @@ jobs: file.copy(from = "./public/articles/logo.png",to = "./public/reference/logo.png") shell: Rscript {0} - name: Upload artifact - uses: actions/upload-pages-artifact@64bcae551a7b18bcb9a09042ddf1960979799187 + uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b with: path: ./public # Deployment job diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index b5a5b54..0a130eb 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -11,14 +11,15 @@ name: test-coverage jobs: test-coverage: runs-on: macOS-latest + env: NOT_CRAN: "true" steps: - uses: actions/checkout@c0a81a463886bb75afe234e07a9fd5bb79219196 - - uses: r-lib/actions/setup-r@756399d909bf9c180bbdafe8025f794f51f2da02 + - uses: r-lib/actions/setup-r@12d8dd416fec5aaa60f2f54609b713b2ec031a94 - - uses: r-lib/actions/setup-pandoc@52330cc136b963487918a8867f948ddf954e9e63 + - uses: r-lib/actions/setup-pandoc@e0a5ffdf0b121aa1c2112f65e54b642a81dc29d9 - - uses: r-lib/actions/setup-r-dependencies@756399d909bf9c180bbdafe8025f794f51f2da02 + - uses: r-lib/actions/setup-r-dependencies@813ef1cb62cf0b4b51a044419024c37807fa8095 with: extra-packages: any::rcmdcheck needs: check diff --git a/DESCRIPTION b/DESCRIPTION index 0439b9b..c7e62ea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: toxEval Type: Package Title: Exploring Biological Relevance of Environmental Chemistry Observations -Version: 1.4.0 +Version: 1.4.1 Authors@R: c(person("Laura", "DeCicco", role = c("aut","cre"), email = "ldecicco@usgs.gov", @@ -47,7 +47,8 @@ Imports: readxl, tools, shinyAce, - shinycssloaders + shinycssloaders, + utils Suggests: rmarkdown, testthat, @@ -60,4 +61,4 @@ BugReports: https://github.com/DOI-USGS/toxEval/issues VignetteBuilder: knitr BuildVignettes: true LazyLoad: yes -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 diff --git a/NEWS b/NEWS index 6f88c56..d7adc6f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +toxEval 1.4.1 +=========== +* Fixed a test breaking due to ggplot2 update. + toxEval 1.4.0 =========== * Switched to version 4.1 of the ToxCast database diff --git a/R/plot_chemical_boxplots.R b/R/plot_chemical_boxplots.R index c3563ee..df75567 100644 --- a/R/plot_chemical_boxplots.R +++ b/R/plot_chemical_boxplots.R @@ -242,18 +242,31 @@ plot_chemical_boxplots <- function(chemical_summary, ..., ) if (isTRUE(y_label == "")) { - toxPlot_All <- toxPlot_All + - scale_y_log10( - labels = fancyNumbers, - breaks = pretty_logs_new - ) + - theme(axis.title.x = element_blank()) + if(utils::packageVersion("ggplot2") == "4.0.0"){ + toxPlot_All <- toxPlot_All + + scale_y_log10() + + theme(axis.title.x = element_blank()) + } else { + toxPlot_All <- toxPlot_All + + scale_y_log10( + labels = fancyNumbers, + breaks = pretty_logs_new + ) + + theme(axis.title.x = element_blank()) + } + } else { - toxPlot_All <- toxPlot_All + - scale_y_log10(y_label, - labels = fancyNumbers, - breaks = pretty_logs_new - ) + if(utils::packageVersion("ggplot2") == "4.0.0"){ + toxPlot_All <- toxPlot_All + + scale_y_log10(y_label) + } else { + toxPlot_All <- toxPlot_All + + scale_y_log10( + y_label, + labels = fancyNumbers, + breaks = pretty_logs_new + ) + } } if (all(is.na(palette))) { diff --git a/R/plot_group_boxplots.R b/R/plot_group_boxplots.R index 71c70ef..191bf36 100644 --- a/R/plot_group_boxplots.R +++ b/R/plot_group_boxplots.R @@ -47,7 +47,7 @@ #' @export #' @rdname plot_tox_boxplots #' @import ggplot2 -#' @examples +#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") #' # This is the example workflow: #' path_to_tox <- system.file("extdata", package = "toxEval") #' file_name <- "OWC_data_fromSup.xlsx" @@ -61,9 +61,10 @@ #' cleaned_ep <- clean_endPoint_info(end_point_info) #' filtered_ep <- filter_groups(cleaned_ep) #' chemical_summary <- get_chemical_summary(tox_list, ACC, filtered_ep) +#' \donttest{ #' plot_tox_boxplots(chemical_summary, "Biological") #' -#' \donttest{ +#' #' plot_tox_boxplots(chemical_summary, "Chemical Class") #' plot_tox_boxplots(chemical_summary, "Chemical") #' @@ -283,18 +284,33 @@ plot_tox_boxplots <- function(chemical_summary, } if (isTRUE(y_label == "")) { - bioPlot <- bioPlot + - scale_y_log10( - labels = fancyNumbers, - breaks = pretty_logs_new - ) + - theme(axis.title.x = element_blank()) + if(utils::packageVersion("ggplot2") == "4.0.0"){ + bioPlot <- bioPlot + + scale_y_log10() + + theme(axis.title.x = element_blank()) + } else { + + bioPlot <- bioPlot + + scale_y_log10( + labels = fancyNumbers, + breaks = pretty_logs_new + ) + + theme(axis.title.x = element_blank()) + } + } else { - bioPlot <- bioPlot + - scale_y_log10(y_label, - labels = fancyNumbers, - breaks = pretty_logs_new - ) + if(utils::packageVersion("ggplot2") == "4.0.0"){ + bioPlot <- bioPlot + + scale_y_log10(y_label) + } else { + bioPlot <- bioPlot + + scale_y_log10( + y_label, + labels = fancyNumbers, + breaks = pretty_logs_new + ) + } + } bioPlot <- bioPlot + @@ -346,7 +362,7 @@ plot_tox_boxplots <- function(chemical_summary, theme(plot.title = element_text(size = font_size, margin = margin(b = 5))) } else { bioPlot_w_labels <- bioPlot_w_labels + - theme(plot.title = element_text(size = font_size, margin = margin(b = 5))) + theme(plot.title = element_text(margin = margin(b = 5))) } } diff --git a/R/plot_tox_endpoints.R b/R/plot_tox_endpoints.R index cb1cdf8..055bc3e 100644 --- a/R/plot_tox_endpoints.R +++ b/R/plot_tox_endpoints.R @@ -35,7 +35,7 @@ #' endpoints will be included. #' @export #' @import ggplot2 -#' @examples +#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") #' # This is the example workflow: #' path_to_tox <- system.file("extdata", package = "toxEval") #' file_name <- "OWC_data_fromSup.xlsx" @@ -50,11 +50,13 @@ #' filtered_ep <- filter_groups(cleaned_ep) #' chemical_summary <- get_chemical_summary(tox_list, ACC, filtered_ep) #' +#' \donttest{ +#' #' plot_tox_endpoints(chemical_summary, #' filterBy = "Cell Cycle", #' top_num = 10 #' ) -#' \donttest{ +#' #' plot_tox_endpoints(chemical_summary, #' filterBy = "Cell Cycle", #' top_num = 10, @@ -261,18 +263,30 @@ plot_tox_endpoints <- function(chemical_summary, } } if (isTRUE(y_label == "")) { - stackedPlot <- stackedPlot + - scale_y_log10( - labels = fancyNumbers, - breaks = pretty_logs_new - ) + - theme(axis.title.x = element_blank()) + if(utils::packageVersion("ggplot2") == "4.0.0"){ + stackedPlot <- stackedPlot + + scale_y_log10() + + theme(axis.title.x = element_blank()) + } else { + stackedPlot <- stackedPlot + + scale_y_log10( + labels = fancyNumbers, + breaks = pretty_logs_new + ) + + theme(axis.title.x = element_blank()) + } + } else { - stackedPlot <- stackedPlot + - scale_y_log10(y_label, - labels = fancyNumbers, - breaks = pretty_logs_new - ) + if(utils::packageVersion("ggplot2") == "4.0.0"){ + stackedPlot <- stackedPlot + + scale_y_log10(y_label) + } else { + stackedPlot <- stackedPlot + + scale_y_log10(y_label, + labels = fancyNumbers, + breaks = pretty_logs_new + ) + } } plot_layout <- ggplot_build(stackedPlot)$layout diff --git a/R/plot_tox_endpoints2.R b/R/plot_tox_endpoints2.R index a5b33ac..1d224af 100644 --- a/R/plot_tox_endpoints2.R +++ b/R/plot_tox_endpoints2.R @@ -32,7 +32,7 @@ #' @param ... Additional group_by arguments. This can be handy for creating facet graphs. #' @export #' @import ggplot2 -#' @examples +#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") #' #' \donttest{ #' path_to_tox <- system.file("extdata", package = "toxEval") @@ -185,18 +185,29 @@ plot_tox_endpoints2 <- function(cs, ..., } if (isTRUE(y_label == "")) { - stackedPlot <- stackedPlot + - scale_y_log10( - labels = fancyNumbers, - breaks = pretty_logs_new - ) + - theme(axis.title.x = element_blank()) + if(utils::packageVersion("ggplot2") == "4.0.0"){ + stackedPlot <- stackedPlot + + scale_y_log10() + + theme(axis.title.x = element_blank()) + } else { + stackedPlot <- stackedPlot + + scale_y_log10( + labels = fancyNumbers, + breaks = pretty_logs_new + ) + + theme(axis.title.x = element_blank()) + } } else { - stackedPlot <- stackedPlot + - scale_y_log10(y_label, - labels = fancyNumbers, - breaks = pretty_logs_new - ) + if(utils::packageVersion("ggplot2") == "4.0.0"){ + stackedPlot <- stackedPlot + + scale_y_log10(y_label) + } else { + stackedPlot <- stackedPlot + + scale_y_log10(y_label, + labels = fancyNumbers, + breaks = pretty_logs_new + ) + } } plot_layout <- ggplot_build(stackedPlot)$layout diff --git a/inst/CITATION b/inst/CITATION index ac7e05d..89be173 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -9,11 +9,11 @@ bibentry(bibtype = "Manual", as.person("Gerald T. Ankley")), title = "toxEval: Evaluation of measured concentration data using the ToxCast high-throughput screening database or a user-defined set of concentration benchmarks.", publisher = "U.S. Geological Survey", - version = "1.4.0", + version = "1.4.1", address="Reston, VA", institution = "U.S. Geological Survey", - year = 2024, + year = 2025, doi = "10.5066/P1CQJHJV", url = "https://code.usgs.gov/water/toxEval", - textVersion = "De Cicco, L.A., Corsi, S.R., Villeneuve D.L, Blackwell, and B.R, Ankley, G.T., 2024, toxEval: Evaluation of measured concentration data using the ToxCast high-throughput screening database or a user-defined set of concentration benchmarks. R package version 1.4.0., U.S. Geological Survey software release. Reston, VA., doi:10.5066/P1CQJHJV" + textVersion = "De Cicco, L.A., Corsi, S.R., Villeneuve D.L, Blackwell, and B.R, Ankley, G.T., 2025, toxEval: Evaluation of measured concentration data using the ToxCast high-throughput screening database or a user-defined set of concentration benchmarks. R package version 1.4.1., U.S. Geological Survey software release. Reston, VA., doi:10.5066/P1CQJHJV" ) diff --git a/man/figures/logo.png b/man/figures/logo.png index 78674a8..727a724 100644 Binary files a/man/figures/logo.png and b/man/figures/logo.png differ diff --git a/man/plot_tox_boxplots.Rd b/man/plot_tox_boxplots.Rd index f65110c..abd025e 100644 --- a/man/plot_tox_boxplots.Rd +++ b/man/plot_tox_boxplots.Rd @@ -103,6 +103,7 @@ Box plots are standard Tukey representations. See "Box plot details" in the Basi for more information. } \examples{ +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) withAutoprint(\{ # examplesIf} # This is the example workflow: path_to_tox <- system.file("extdata", package = "toxEval") file_name <- "OWC_data_fromSup.xlsx" @@ -116,9 +117,10 @@ ACC <- remove_flags(ACC) cleaned_ep <- clean_endPoint_info(end_point_info) filtered_ep <- filter_groups(cleaned_ep) chemical_summary <- get_chemical_summary(tox_list, ACC, filtered_ep) +\donttest{ plot_tox_boxplots(chemical_summary, "Biological") -\donttest{ + plot_tox_boxplots(chemical_summary, "Chemical Class") plot_tox_boxplots(chemical_summary, "Chemical") @@ -152,4 +154,5 @@ plot_tox_boxplots(single_site, category = "Chemical", hit_threshold = 0.001 ) } +\dontshow{\}) # examplesIf} } diff --git a/man/plot_tox_endpoints.Rd b/man/plot_tox_endpoints.Rd index 0398398..9ea4141 100644 --- a/man/plot_tox_endpoints.Rd +++ b/man/plot_tox_endpoints.Rd @@ -67,6 +67,7 @@ Box plots are standard Tukey representations. See "Box plot details" in the Basi for more information. } \examples{ +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) withAutoprint(\{ # examplesIf} # This is the example workflow: path_to_tox <- system.file("extdata", package = "toxEval") file_name <- "OWC_data_fromSup.xlsx" @@ -81,11 +82,13 @@ cleaned_ep <- clean_endPoint_info(end_point_info) filtered_ep <- filter_groups(cleaned_ep) chemical_summary <- get_chemical_summary(tox_list, ACC, filtered_ep) +\donttest{ + plot_tox_endpoints(chemical_summary, filterBy = "Cell Cycle", top_num = 10 ) -\donttest{ + plot_tox_endpoints(chemical_summary, filterBy = "Cell Cycle", top_num = 10, @@ -102,4 +105,5 @@ plot_tox_endpoints(chemical_summary, category = "Chemical", top_num = 10) single_site <- dplyr::filter(chemical_summary, site == "USGS-04024000") plot_tox_endpoints(single_site, category = "Chemical", top_num = 10) } +\dontshow{\}) # examplesIf} } diff --git a/man/plot_tox_endpoints2.Rd b/man/plot_tox_endpoints2.Rd index 01aedbe..c6a9249 100644 --- a/man/plot_tox_endpoints2.Rd +++ b/man/plot_tox_endpoints2.Rd @@ -67,6 +67,7 @@ the \dots arguments allow for customized faceting. To include this in the original toxEval function, backward compatibility would be broken. } \examples{ +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) withAutoprint(\{ # examplesIf} \donttest{ path_to_tox <- system.file("extdata", package = "toxEval") @@ -93,4 +94,5 @@ plot_tox_endpoints2(cs_double, guide_side, ) + ggplot2::facet_grid(. ~ guide_side, scales = "free_x") } +\dontshow{\}) # examplesIf} } diff --git a/tests/testthat/tests_summary.R b/tests/testthat/tests_summary.R index 7851d1c..fc54911 100644 --- a/tests/testthat/tests_summary.R +++ b/tests/testthat/tests_summary.R @@ -61,7 +61,7 @@ test_that("Plotting summaries", { ) expect_true(all(names(bioPlot$data) %in% c("site", "category", "meanEAR"))) - expect_equal(bioPlot$layers[[2]]$geom_params$outlier.shape, 19) + expect_equal(bioPlot$layers[[2]]$aes_params$fill, "steelblue") classPlot <- plot_tox_boxplots(chemical_summary, @@ -69,7 +69,7 @@ test_that("Plotting summaries", { ) expect_true(all(names(classPlot$data) %in% c("site", "category", "meanEAR"))) - expect_equal(classPlot$layers[[2]]$geom_params$outlier.shape, 19) + expect_equal(classPlot$layers[[2]]$aes_params$fill, "steelblue") chemPlot <- suppressWarnings(plot_tox_boxplots(chemical_summary, @@ -77,7 +77,7 @@ test_that("Plotting summaries", { )) expect_true(all(names(chemPlot$data) %in% c("site", "chnm", "Class", "meanEAR"))) - expect_equal(chemPlot$layers[[1]]$geom_params$outlier.shape, 19) + expect_true(is.null(chemPlot$layers[[1]]$aes_params$fill)) }) @@ -87,6 +87,7 @@ test_that("Plotting heatmap summaries", { bioHeatPlot <- plot_tox_heatmap(chemical_summary, chem_site, category = "Biological" ) + expect_true(all(names(bioHeatPlot$data) %in% c( "site", "category", "meanEAR", "site_grouping", "Short Name" @@ -95,6 +96,7 @@ test_that("Plotting heatmap summaries", { classHeatPlot <- plot_tox_heatmap(chemical_summary, chem_site, category = "Chemical Class" ) + expect_true(all(names(classHeatPlot$data) %in% c( "site", "category", "meanEAR", "site_grouping", "Short Name" @@ -103,6 +105,7 @@ test_that("Plotting heatmap summaries", { chemHeatPlot <- plot_tox_heatmap(chemical_summary, chem_site, category = "Chemical" ) + expect_true(all(names(chemHeatPlot$data) %in% c( "site", "chnm", "Class", "meanEAR", "site_grouping", "Short Name"