[bioinstaller.ui.sections]
order = ["bioinstaller_input_box", "bioinstaller_output_table", "bioinstaller_output_text"]
[bioinstaller.ui.sections.ui_basic]
bioinstaller_input_box = "title = 'BioInstaller query', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE"
bioinstaller_output_text = "title = 'Output of bioinstaller (Text)', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE"
bioinstaller_output_table = "title = 'Output of bioinstaller (Table)', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE"

[bioinstaller.paramters.bioinstaller_input_box]
# For reading annovarR shiny APP bioinstaller tool input files  
section_type = "input"
rcmd_last = ""
progressbar_message = "Running BioInstaller functions."
render_id = "bioinstaller_input_box"

#!!!!! input_ui_order required related section
input_ui_order = ["single_input", "start_analysis"]

[bioinstaller.paramters.bioinstaller_input_box.input.single_input]
title = "Parameters:"
title_control = "class = 'input-section-p'"
varname = ["object_type"]
input_id = ["input_bioinstaller_1"]
type = ["shiny::selectInput"]
label = ["Query type"]

[bioinstaller.paramters.bioinstaller_input_box.input.single_input.choices]
object_type = ["github", "nongithub", "db", "all"]

[bioinstaller.paramters.bioinstaller_input_box.input.start_analysis]
input_id = "start_bioinstaller_analysis"
type = "shiny::actionButton"
label = "Run"

[bioinstaller.paramters.bioinstaller_output_text]
section_type = "output"
rcmd_last = "BioInstaller::install.bioinfo(show.all.names = TRUE)[1:10]"
render_type = "shiny::renderPrint"
render_id = "bioinstaller_output_text"
output_type = "shiny::verbatimTextOutput"
progressbar_message = "BioInstaller bioinstaller_output_text"

[bioinstaller.paramters.bioinstaller_output_table]
section_type = "output"
rcmd_last = """
get_dt <- function(item) {
  Name <- names(item)
  Description <- unname(unlist(lapply(item, function(x){
    if (is.na(x["description"])) return("")
    return(x["description"])}))
  )
  Publication <- unname(unlist(
    lapply(item, function(x){
      if (!"publication" %in% names(x)) return("")
      if (is.na(x["publication"])) return("")
      if (is.null(x["publication"])) return("")
      if (length(x[["publication"]]) > 1) return(paste0(x[["publication"]], collapse = ";"))
      return(x["publication"])
    })
  ))
  data.frame(Name, Description, Publication)
}
meta_info <- get.meta(read.config.params = list(rcmd.parse = TRUE))
obj <- NULL
if (object_type != "all") {
  assign(object_type, get_dt(meta_info[[object_type]]$item))
  resources_db <- rep(object_type, nrow(get(object_type)))
  obj <- get(object_type)
} else {
  github <- get_dt(meta_info$github$item)
  nongithub <- get_dt(meta_info$nongithub$item)
  db <- get_dt(meta_info$db$item)
  obj <- rbind(github, nongithub, db)
  resources_db <- c(rep("github", nrow(github)), rep("nongithub", nrow(nongithub)), rep("db", nrow(db)))
}
obj <- cbind(obj, resources_db)
"""
render_type = "DT::renderDataTable"
render_id = "bioinstaller_output_table"
output_type = "DT::dataTableOutput"
progressbar_message = "BioInstaller bioinstaller_output_table"
