From 7aecda45e80e43e7d44b56d39e88935e10dbcdf5 Mon Sep 17 00:00:00 2001 From: Federico Marini Date: Wed, 2 Oct 2024 22:00:32 +0200 Subject: [PATCH] param `already_se_object` is not required anymore, replaced by the heuristics --- R/iSEEindex.R | 16 +++++----------- R/landing_page.R | 6 ++---- R/observers.R | 5 ++--- man/iSEEindex.Rd | 8 ++------ tests/testthat/test-observers.R | 2 +- tests/testthat/test-utils-datasets.R | 2 +- 6 files changed, 13 insertions(+), 26 deletions(-) diff --git a/R/iSEEindex.R b/R/iSEEindex.R index 597b3d2..547768e 100644 --- a/R/iSEEindex.R +++ b/R/iSEEindex.R @@ -96,7 +96,6 @@ #' info on the versions of the `iSEEindex` and `iSEE` packages. #' @param body.header UI element to display \emph{above} the main landing page body. #' @param body.footer UI element to display \emph{below} the main landing page body. -#' @param already_se_object TODO #' #' @return An [iSEE::iSEE()] app with a custom landing page using a [BiocFileCache()] to cache a selection of data sets. #' @@ -168,8 +167,7 @@ #' default.position = "last", #' app.title = "iSEE ❤️ Tonsil Data Atlas", #' body.header = header_tonsils, -#' body.footer = footer_tonsils, -#' already_se_object = TRUE) +#' body.footer = footer_tonsils) #' #' if (interactive()) { #' shiny::runApp(app_tonsils, port = 5678) @@ -181,8 +179,7 @@ iSEEindex <- function(bfc, default.position = c("first", "last"), app.title = NULL, body.header = NULL, - body.footer = NULL, - already_se_object = FALSE) { + body.footer = NULL) { stopifnot(is(bfc, "BiocFileCache")) if (is.null(FUN.initial)) { FUN.initial <- function() NULL @@ -201,8 +198,7 @@ iSEEindex <- function(bfc, default.add, default.position, body.header, - body.footer, - already_se_object = already_se_object + body.footer ), appTitle = app.title ) @@ -319,7 +315,6 @@ iSEEindex <- function(bfc, #' @param session The Shiny session object from the server function. #' @param pObjects An environment containing global parameters generated in the #' landing page. -#' @param already_se_object TODO propagated #' #' @return A `NULL` value is invisibly returned. #' @@ -331,7 +326,7 @@ iSEEindex <- function(bfc, #' @importFrom shinyjs enable #' #' @rdname INTERNAL_launch_isee -.launch_isee <- function(FUN, bfc, session, pObjects, already_se_object) { +.launch_isee <- function(FUN, bfc, session, pObjects) { # nocov start dataset_id <- pObjects[[.dataset_selected_id]] which_dataset <- which(pObjects$datasets_table[[.datasets_id]] == dataset_id) @@ -342,8 +337,7 @@ iSEEindex <- function(bfc, withProgress(message = sprintf("Loading '%s'", dataset_title), value = 0, max = 2, { incProgress(1, detail = "(Down)loading object") - se2 <- try(.load_sce(bfc, dataset_id, dataset_metadata, - already_se_object = already_se_object)) + se2 <- try(.load_sce(bfc, dataset_id, dataset_metadata)) incProgress(1, detail = "Launching iSEE app") if (is(se2, "try-error")) { showNotification("Invalid SummarizedExperiment supplied.", type="error") diff --git a/R/landing_page.R b/R/landing_page.R index a507561..d8260e9 100644 --- a/R/landing_page.R +++ b/R/landing_page.R @@ -11,7 +11,6 @@ #' in the Shiny `selectizeInput()`. #' @param body.header UI element to display \emph{above} the main landing page body. #' @param body.footer UI element to display \emph{below} the main landing page body. -#' @param already_se_object TODO to be propagated #' #' @return A `function` that defines UI elements and observers for the #' landing page of the app. @@ -31,8 +30,7 @@ default.add = TRUE, default.position = c("first", "last"), body.header = NULL, - body.footer = NULL, - already_se_object) { + body.footer = NULL) { default.position <- match.arg(default.position) # datasets datasets_available_list <- FUN.datasets() @@ -103,7 +101,7 @@ .create_observers(input, session, pObjects, rObjects, FUN.initial, default.add, default.position) - .create_launch_observers(FUN, bfc, input, session, pObjects, already_se_object = already_se_object) + .create_launch_observers(FUN, bfc, input, session, pObjects) .render_datasets_table(output, pObjects, rObjects) diff --git a/R/observers.R b/R/observers.R index 79e4f12..50db35b 100644 --- a/R/observers.R +++ b/R/observers.R @@ -71,16 +71,15 @@ #' @param input TODO #' @param session TODO #' @param pObjects TODO -#' @param already_se_object TODO #' #' @importFrom shiny observeEvent #' #' @rdname INTERNAL_create_observers -.create_launch_observers <- function(FUN, bfc, input, session, pObjects, already_se_object) { +.create_launch_observers <- function(FUN, bfc, input, session, pObjects) { # nocov start observeEvent(input[[.ui_launch_button]], { - .launch_isee(FUN, bfc, session, pObjects, already_se_object = already_se_object) + .launch_isee(FUN, bfc, session, pObjects) }, ignoreNULL=TRUE, ignoreInit=TRUE) # nocov end diff --git a/man/iSEEindex.Rd b/man/iSEEindex.Rd index f3842e3..cb10796 100644 --- a/man/iSEEindex.Rd +++ b/man/iSEEindex.Rd @@ -12,8 +12,7 @@ iSEEindex( default.position = c("first", "last"), app.title = NULL, body.header = NULL, - body.footer = NULL, - already_se_object = FALSE + body.footer = NULL ) } \arguments{ @@ -40,8 +39,6 @@ info on the versions of the \code{iSEEindex} and \code{iSEE} packages.} \item{body.header}{UI element to display \emph{above} the main landing page body.} \item{body.footer}{UI element to display \emph{below} the main landing page body.} - -\item{already_se_object}{TODO} } \value{ An \code{\link[iSEE:iSEE]{iSEE::iSEE()}} app with a custom landing page using a \code{\link[=BiocFileCache]{BiocFileCache()}} to cache a selection of data sets. @@ -189,8 +186,7 @@ app_tonsils <- iSEEindex(bfc, default.position = "last", app.title = "iSEE ❤️ Tonsil Data Atlas", body.header = header_tonsils, - body.footer = footer_tonsils, - already_se_object = TRUE) + body.footer = footer_tonsils) if (interactive()) { shiny::runApp(app_tonsils, port = 5678) diff --git a/tests/testthat/test-observers.R b/tests/testthat/test-observers.R index 8b04357..4a3c337 100644 --- a/tests/testthat/test-observers.R +++ b/tests/testthat/test-observers.R @@ -19,7 +19,7 @@ test_that(".create_launch_observers works", { pObjects <- new.env() FUN <- function(SE, INITIAL) invisible(NULL) - out <- iSEEindex:::.create_launch_observers(FUN, bfc, input, session = NULL, pObjects, already_se_object = FALSE) + out <- iSEEindex:::.create_launch_observers(FUN, bfc, input, session = NULL, pObjects) expect_null(out) }) diff --git a/tests/testthat/test-utils-datasets.R b/tests/testthat/test-utils-datasets.R index 3a3514c..134a791 100644 --- a/tests/testthat/test-utils-datasets.R +++ b/tests/testthat/test-utils-datasets.R @@ -10,7 +10,7 @@ test_that(".load_sce works", { ## Usage --- - out <- iSEEindex:::.load_sce(bfc, id, metadata, already_se_object = FALSE) + out <- iSEEindex:::.load_sce(bfc, id, metadata) expect_s4_class(out, "SummarizedExperiment") })