Skip to content

Commit

Permalink
param already_se_object is not required anymore, replaced by the he…
Browse files Browse the repository at this point in the history
…uristics
  • Loading branch information
federicomarini committed Oct 2, 2024
1 parent dab973b commit 7aecda4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 26 deletions.
16 changes: 5 additions & 11 deletions R/iSEEindex.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#'
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
)
Expand Down Expand Up @@ -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.
#'
Expand All @@ -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)
Expand All @@ -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")
Expand Down
6 changes: 2 additions & 4 deletions R/landing_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 2 additions & 3 deletions R/observers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 2 additions & 6 deletions man/iSEEindex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-observers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

})
2 changes: 1 addition & 1 deletion tests/testthat/test-utils-datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
Expand Down

0 comments on commit 7aecda4

Please sign in to comment.