Commit 2dda72d5 authored by Thomas Schwarzl's avatar Thomas Schwarzl

resolved table init filter issue

parent 562f8969
......@@ -24,6 +24,7 @@ require(purrr)
load("www/data/ANNO_STUDIES.Rda")
load("www/data/RIC_STUDIES.Rda")
load("www/data/COMPILED_TABLE.Rda")
load("www/data/ORGANISM_TABLE.Rda")
source("annotationFunctions.R")
source("server_studies_table.R")
source("server_anno_table.R")
......@@ -485,14 +486,36 @@ ui <- fluidPage(
## --------- Server Functions
server <- function(input, output, session) {
updateCurrentOrganismFilterSelection <- function(selOrganism) {
updateAwesomeCheckboxGroup(session = session,
inputId = "RBPTableColumnSelection",
selected = c("ID", "Description",
ALLANNO %>%
filter(Organism == selOrganism) %>%
pull(RBPBASEID) ))
}
getInitialColumns <- function(selOrganism, allColnames) {
c("ID",
"Description",
ALLANNO %>%
filter(Organism == selOrganism) %>%
pull("RBPBASEID"),
allColnames[grepl(allColnames, pattern = "^any_")]
)
}
filter <- reactiveValues()
#TODO naming of organism
#selectedOrganism <- reactiveValues()
selectedOrganism <- reactive({
input$selectedOrganism
})
observeEvent(input$link_to_download, {
updateTabsetPanel(session, "menu", "Download")
......@@ -509,7 +532,7 @@ server <- function(input, output, session) {
}
if(input$showRBPsonly) {
ret <- ret %>% filter(!!rlang::sym(paste0("any_", input$selectedOrganism)))
ret <- ret %>% filter(!!rlang::sym(paste0("any_", selectedOrganism())))
}
if(input$showCOVID) {
......@@ -546,6 +569,12 @@ server <- function(input, output, session) {
if(!any(is.null(input$RBPTableColumnSelection))) {
ret <- ret %>% dplyr::select(UNIQUE, Overview, one_of(input$RBPTableColumnSelection))
} else {
# this filter is set before the ui / table is initialized
ret <- ret %>% dplyr::select(UNIQUE, Overview, one_of(
colnames(ret)[ colnames(ret) %in%
getInitialColumns(selectedOrganism(),
colnames(ret)) ]))
}
# Order of table
......@@ -796,25 +825,16 @@ server <- function(input, output, session) {
})
observeEvent(input$btnSelectCurrent, {
updateAwesomeCheckboxGroup(session = session,
inputId = "RBPTableColumnSelection",
selected = c("ID", "Description", ALLANNO %>% filter(Organism == input$selectedOrganism) %>% .[["RBPBASEID"]] ))
})
updateCurrentOrganismFilterSelection(selectedOrganism())
})
#
output$RBPTableColumnSelection <- renderUI({
#cat("rendering checkboxes")
allColnames <- colnames(COMPILED_TABLE[[filter$selectedOrganism]])[-1]
selectedColnames <- c("ID",
"Description",
ALLANNO %>%
filter(Organism == input$selectedOrganism) %>%
.[["RBPBASEID"]],
allColnames[grepl(allColnames, pattern = "^any")]
)
allColnames <- colnames(COMPILED_TABLE[[selectedOrganism()]])[-1]
selectedColnames <- getInitialColumns(selectedOrganism(), allColnames)
awesomeCheckboxGroup("RBPTableColumnSelection",
"Columns to show:",
......@@ -834,10 +854,11 @@ server <- function(input, output, session) {
# observing organism change
observeEvent(input$selectedOrganism, {
filter$selectedOrganism <- input$selectedOrganism
filter$selectedOrganism <- selectedOrganism()
filter$table <- NULL
allColnames <- colnames(COMPILED_TABLE[[filter$selectedOrganism]])
filter$columnOrder <- allColnames
updateCurrentOrganismFilterSelection(selectedOrganism())
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment