inst/phewas_app/dashtest.R

library(shiny)
library(shinyjs)
library(dplyr)
library(DWHtools2)
library(plotly)
library(DT)

#options(java.parameters = "-Xmx4g")
options(shiny.sanitize.errors = FALSE)


body <- dashboardBody(
  shinyjs::useShinyjs(),
  tabItems(
    tabItem(
      tabName = "dashboard",
      fluidRow(
        column(6,
               tabBox(
                 title = "First tabBox",
                 width = 12,
                 # The id lets us use input$tabset1 on the server to find the current tab
                 id = "tabset1", height = "250px",
                 tabPanel("Tab1", "First tab content"),
                 tabPanel("Tab2", "Tab content 2")
               )
        )
        ,
        column(6, id ='col2',
               tabBox( 
                 id = 'tabset2',
                 side = "right", 
                 height = "250px",
                 width = 12,
                 selected = "Tab3",
                 tabPanel("Tab1", "Tab content 1"),
                 tabPanel("Tab2", "Tab content 2"),
                 tabPanel("Tab3", "Note that when side=right, the tab order is reversed.")
               ))
        
      ),
      fluidRow(
        tabBox(
          # Title can include an icon
          title = tagList(shiny::icon("gear"), "tabBox status"),
          width = 12,
          tabPanel("Tab1",
                   "Currently selected tab from first box:",
                   verbatimTextOutput("tabset1Selected")
          ),
          tabPanel("Tab2", "Tab content 2")
        )
      )
    ),
    tabItem(
      tabName = "widgets"
    )
  )
  
  
)
# Define UI for application that draws a histogram
shinyUI(dashboardPage(
    dashboardHeader(title = "Interactive characterization of EHR based cohorts (Multimodal PheWAS)"),
    dashboardSidebar(
      sidebarMenu(
        em(id = 'waiting', '...Loading...'),
        tags$h3(id = 'controls_title1', 'Patients selection'),
        uiOutput('controls_cases'),
        #uiOutput('control_type'),
        radioButtons(inputId = 'control_type',label = "Type of controls", choices= list(`Automatic matching`='match', `Cohort` = "cohort" )),
        uiOutput('controls_trigger'),
        textOutput('controls_none'),
        uiOutput('match_save'),
        uiOutput('match_save_title'),
        tags$hr(),
        tags$h3(id = 'controls_title2','Analysis parameters'),
        radioButtons('boot',label = "Bootstrap results", choices= list(`No`=FALSE, `Yes` = TRUE )),
        actionButton(
          inputId = "submit_loc",
          label = "Submit")
    )),
    body
  ),
  server = function(input, output) {
    # The currently selected tab from the first box
    output$tabset1Selected <- renderText({
      input$tabset1
    })
    
    observeEvent(input$hideit, 
                 if(input$hideit == 'yes') {
                   shinyjs::hide('col2')
                   colwidth = 12
                 } else {
                   shinyjs::show('col2')
                 }
                 )
            
    #shinyjs::hide("tabset2")
    
  }
)
aneuraz/multiWAS documentation built on July 29, 2017, 3:39 a.m.