Skip to content
Commits on Source (2)
......@@ -49,6 +49,6 @@ update_datasets:
script:
- source docker/datasets_utils.sh
- import_datasets_by_keyword iseedata || true
- renku dataset ls --format tabular > release/renku_dataset_ls.tab
- renku dataset ls-files --format tabular > release/renku_dataset_ls_files.tab
- renku dataset ls --format tabular > release/datasets.tab
- renku dataset ls-files --format tabular > release/files.tab
- date +%Y-%m-%d > release/RELEASE_DATE
library(iSEE)
# library(jsonlite)
library(shinyjs)
# JSON approach ----
# x <- jsonlite::read_json("release/renku_ls.json")
# length(x)
# We have 2 datasets, let's check out the first one
# x1 <- x[[1]]
# keep <- vapply(x1[["http://schema.org/keywords"]], function(x) tolower("iSEEdata") %in% tolower(x[["@value"]]), logical(1))
# x1[keep,]
# Tabular approach ----
input_file <- "release/datasets.tab"
datasets_table <- readLines(input_file)
column_dashes <- strsplit(datasets_table[2], " ")[[1]]
column_widths <- nchar(column_dashes) + 2
datasets_table <- read.fwf(file = input_file, widths = column_widths,
skip = 2, strip.white = TRUE,
col.names = c("id", "name", "title", "version"))
input_file <- "release/files.tab"
files_table <- readLines(input_file)
column_dashes <- strsplit(files_table[2], " ")[[1]]
column_widths <- nchar(column_dashes) + 2
files_table <- read.fwf(file = input_file, widths = column_widths,
skip = 2, strip.white = TRUE,
col.names = c("dataset_name", "added", "size", "path", "lfs"))
merge_table <- merge(datasets_table, files_table, by.x = "name", by.y = "dataset_name")
dataset_rds_files <- subset(merge_table, grepl("\\.rds$", path, ignore.case = TRUE), c("name", "title", "added", "size", "path"))
configuration_scripts <- subset(merge_table, grepl("\\.R$", path, ignore.case = TRUE), c("name", "added", "size", "path"))
# Release info ----
release_date <- scan("release/RELEASE_DATE", "character")
# Initialise the landing page ----
seLoad <- function(x) {
dataset_rds <- as.character(dataset_rds_files[x, "path"])
readRDS(dataset_rds)
}
initLoad <- function(x) {
list(FeatureAssayPlot())
}
renku_landing_page <- function(FUN, input, output, session) {
.initializeLaunch <- "iSEE_INTERNAL_launch_init"
.initializeSE <- "se"
.initializeInitial <- "initial"
.initializeSE_row_selected <- paste0(.initializeSE, "_rows_selected")
.initializeInitial_row_selected <- paste0(.initializeInitial, "_rows_selected")
output$allPanels <- renderUI({
useShinyjs()
tagList(
h1("Select a data set"),
DT::dataTableOutput(.initializeSE),
h1("Select a configuration"),
HTML("<blockquote>Unselect the default option (if any) to use the <code>iSEE</code> default settings.</blockquote>"),
DT::dataTableOutput(.initializeInitial),
actionButton(.initializeLaunch, label = "Launch", style = iSEE:::.actionbutton_biocstyle)
)
})
output[[.initializeSE]] <- DT::renderDataTable({
DT::datatable(
dataset_rds_files[, c("name", "title", "added", "size")], filter="top", rownames=FALSE,
options=list(
search=list(smart=FALSE, regex=TRUE, caseInsensitive=FALSE),
scrollX=TRUE),
selection=list(mode="single", selected = 1)
)
})
output[[.initializeInitial]] <- DT::renderDataTable({
selected_dataset_index <- input[[.initializeSE_row_selected]]
selected_dataset_name <- dataset_rds_files$name[selected_dataset_index]
configurations_subset_table <- subset(configuration_scripts, name == selected_dataset_name, c("name", "added", "size", "path"))
DT::datatable(
configurations_subset_table, filter="top", rownames=FALSE,
options=list(
search=list(smart=FALSE, regex=TRUE, caseInsensitive=FALSE),
scrollX=TRUE),
selection=list(mode="single", selected = 1)
)
})
observeEvent(input[[.initializeSE_row_selected]], {
if (is.null(input[[.initializeSE_row_selected]])) {
disable(.initializeLaunch)
updateActionButton(inputId = .initializeLaunch, label = "Select a dataset")
} else {
enable(.initializeLaunch)
updateActionButton(inputId = .initializeLaunch, label = "Launch")
}
}, ignoreNULL=FALSE, ignoreInit=TRUE)
observeEvent(input[[.initializeLaunch]], {
print(input[[.initializeSE_row_selected]])
se2 <- try(seLoad(input[[.initializeSE_row_selected]]))
if (is(se2, "try-error")) {
showNotification("invalid SummarizedExperiment supplied",
type = "error")
}
else {
print(input[[.initializeInitial_row_selected]])
init <- try(initLoad(input[[.initializeInitial_row_selected]]))
if (is(init, "try-error")) {
showNotification("invalid initial state supplied",
type = "warning")
init <- NULL
}
FUN(SE = se2, INITIAL = init)
}
}, ignoreNULL = TRUE, ignoreInit = TRUE)
invisible(NULL)
}
app <- iSEE(
landingPage = renku_landing_page,
appTitle = sprintf("iSEE dashboard @ Renku (updated %s)", release_date))
if (interactive()) {
shiny::runApp(app, port=1234)
}
This diff is collapsed.
This diff is collapsed.