Display only one Tabset Panel in Shiny at a time

25 views
Skip to first unread message

Khawaja Owaise Hussain

unread,
Jul 22, 2016, 1:40:44 PM7/22/16
to Shiny - Web Framework for R
I would like to know about displaying different Tabset panels. I have some example code where i tried to make it work, but it displays all the three Tabset panels at once, however, I want to display only one at a time.

ui.r
filenames <- list.files(path = "data",pattern="\\.txt$")
names(filenames) <- gsub(pattern = "\\.txt$", "", filenames)
shinyUI(fluidPage(theme = "bootstrap.css",
                  (navbarPage("BETA Version",position = c("fixed-top"), fluid=TRUE,  ##position = c("fixed-top"), fluid=TRUE
                              navbarMenu("Help",

                                         tabPanel(
                                           a("List of GPLs available",
                                             target="_blank",href="GPLs.pdf")),

                                         tabPanel(
                                           a("Reference Manual",
                                             target="_blank", href="UserGuide.pdf")))
                  )),

                  br(),
                  titlePanel( 
                    headerPanel( 
                      h3("Hello Hello Testing", align="center", style="bold"))),

                  br(),
                  br(),

                  sidebarLayout(
                    sidebarPanel(
                      h5("Upload Data Files",style="bold"),
                      fileInput("files", "Choose CSV/txt processed files or raw files", multiple = "TRUE",
                                accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv','.cel','.TXT','.txt')),

                      #selectInput('dataset',"Choose platform annotation file", c("Please select a file" ='',filenames)),

                      fluidRow(
                        column(10,
                               radioButtons("radiometa", label = h5("What you want"),
                                            choices = list(" Control)" = 1, 
                                                           "PCA" = 2, "analysis" = 3),selected = NULL))),
                      conditionalPanel(
                        "input.radiometa == 1",
                        wellPanel(
                          h5("Symbol File ", style = "bold"),
                          fileInput("file1", "Choose  files", multiple = "FALSE",
                                    accept=c('text/csv', 'text/comma-separated-values,
                                             text/plain', '.csv','.cel','.TXT','.txt')),
                          h5("Calculation", style = "bold"),
                          fileInput("file2", "Choose  files", multiple = "FALSE",
                                    accept=c('text/csv', 'text/comma-separated-values,
                                             text/plain', '.csv','.cel','.TXT','.txt')),
                          radioButtons("radioQC1", label = h5("Settings"), 
                                       choices = list("Default setting" = 1, "Parameter Setting" = 2)),

                          conditionalPanel(
                            "input.radioQC1 == 2",
                            h5("Set Parameters"),
                            checkboxInput("checkboxQC1", label= "P Processing", value = FALSE),
                            checkboxInput("checkboxQC2", label= "Cache", value = FALSE),
                            checkboxInput("checkboxQC3", label= " Genes", value = FALSE),
                            numericInput("numQC0", label = h5("Number of C"),
                                         value = NULL, min = 2, max = 8, step = 1),
                            numericInput("numQC1", label = h5("Allowed"),
                                         value = NULL, min = 0.1, max = 2, step = 0.1),
                            numericInput("numQC2", label = h5(" Mean"),
                                         value = NULL, min = 0.1, max = 2, step = 0.1),
                            numericInput("numQC3", label = h5("Cut Ration"),
                                         value = NULL, min = 0.1, max = 2, step = 0.1),
                            numericInput("numQC4", label = h5("Min number"),
                                         value = NULL, min = 1, max = 10, step = 1),
                            radioButtons("radioQC2", label = h5("Data"), 
                                         choices = list("Twocl" = "Two", "Multicl" = "Multi", 
                                                        "Surv" = "Sur")),
                            textInput("textQC1", label = "Tests", value = "E.g 1e2 or 1e3 or 1e4 .."),
                            numericInput("textQC2", label = "PCut", value = NULL, 
                                         min = 0.01, max = 1, step = 0.01),
                            checkboxInput("checkboxQC4", label= "Adjust ", value = FALSE)
                          )
                          )
                        ),

                      conditionalPanel(
                        "input.radiometa == 2",
                        wellPanel(
                          h5("PCA ", style = "bold"),
                          radioButtons("PCAMethods", label = h5("Choose PCA method"),
                                       choices = list("An" = 1, "Ei" = 2,
                                                      "Rob" = 3, "Spar" = 4), selected = NULL),

                          conditionalPanel(
                            "input.PCAMethods == 3",
                            radioButtons("PCARobMethod", label = h5("Choose PCA Variance"),
                                         choices = list("qn" = 1, "mad" = 2), selected = NULL)

                          ),
                          numericInput("NumofPC", label = h5("Choose Num of PC"),
                                       value = NULL, min = 1, max = 5, step = 1),

                          numericInput("MaxItertions", label = h5("Maximum Iterations"),
                                       value = NULL, min = 1, max = 200, step = 1),
                          textInput("SprsEps", label = h5("Presion Level"), value = "E.g 1e-3"),
                          checkboxInput("Scale", label= h5("Normalization"), value = FALSE),
                          checkboxInput("ScaleAdjus", label= h5("Scaling Adjustment"), value = FALSE),
                          checkboxInput("GeneFilt", label= h5("Filtering"), value = FALSE),
                          numericInput("CutRatioByMean", label = h5("By Mean"),
                                       value = NULL, min = .1, max = 1, step = .1),
                          numericInput("CutRatioByVar", label = h5("By Variance"),
                                       value = NULL, min = .1, max = 1, step = .1),
                          checkboxInput("ImputeMissing", label= h5(" Genes"),
                                        value = FALSE),
                          numericInput("StdyWisGenfilt", label =
                                         h5("missing proportio"),
                                       value = NULL, min = .1, max = 1, step = .1),
                          numericInput("EachstdyGenfilt", label = 
                                         h5("Filter proportion"),
                                       value = NULL, min = .1, max = 1, step = .1)

                        )

                      ),

                      conditionalPanel(
                        "input.radiometa == 3",
                        wellPanel(
                          h5("Upload Data Files",style="bold"),
                          selectInput('dataset',"file", c("Please select a file" ='',filenames)),
                          radioButtons("radio", label = h5("Data uploaded"),
                                       choices = list("Affy" = 1, "Ill" = 3),selected = NULL),
                          radioButtons("radio1", label = h5("Choose a method"),
                                       choices = list(
                                         "Fill" = 1, "Stap" = 2,
                                         "Astg" = 3, "ming" = 4,
                                         "malti" = 5, "SR" = 6,
                                         "PRsgs" = 7,"mi" = 8,
                                         "ma" = 9,
                                         "Fist" = 10,
                                         "Stng" = 11),
                                       selected = NULL)
                        )
                      ),


                      br(),



                      column(5,
                             actionButton("Submit", label = "Submit")),

                      br(),
                      br(),

                      br()

                       ),


                    mainPanel(
                      conditionalPanel(
                        condition = "input.radiometa == 1",
                        tabsetPanel(
                          tabPanel("Sample Data",dataTableOutput("qfile")),
                          tabPanel("Source Data", dataTableOutput("sourced")),
                          tabPanel("Q Summary",dataTableOutput("qSummary")),
                          tabPanel("Plot", plotOutput("PlotSummary"))
                        )
                      ),

                      conditionalPanel(
                        condition = "input.radiometa ==2",
                        tabsetPanel(
                          tabPanel("Panel1",dataTableOutput("panel1")),
                          tabPanel("Panel2", dataTableOutput("panel2"))
                        )
                      ),

                      conditionalPanel(
                        condition = "input.radiometa == 3",
                        tabsetPanel(
                          tabPanel("File List",dataTableOutput("file")),
                          tabPanel("Source Data", dataTableOutput("sourced")),
                          tabPanel("Annotation Data",dataTableOutput("annotation")),
                          tabPanel("Summary",dataTableOutput("final")),
                          tabPanel("Supplementary File", dataTableOutput("full"))
                        )
                      )
                    )
                      )
                    ))

server.r
shinyServer(function(input, output) {
})



Reply all
Reply to author
Forward
0 new messages