R/webApp/ui.R

Defines functions ui_myApp

library(shiny)
library(shinydashboard)
library(shinyWidgets)
library(shinycustomloader)

ui_myApp<-function() {
  dashboardPage(
    #https://stackoverflow.com/questions/54146804/how-to-prevent-code-for-adding-an-image-to-shinydashboard-header-appearing-in-br
    skin = "blue",
    dashboardHeader(title = "CellDestiny"),

    dashboardSidebar(

      sidebarUserPanel( name = "Institut Curie",
                        image="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxISERUTEBAVEhMXFRgXFxgXGBUYFxUVFhcWFhkXFRgaHSggGB4lGxUYITEiJikrLi4uGB8zODMtNygtLi0BCgoKDg0OGhAQGy0lHyUyKy0tLS8tLS0tLS0tLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIAOEA4QMBEQACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAABQYDBAcBAv/EAEYQAAEDAgMDBQ0ECAYDAAAAAAEAAgMEEQUGIRIxQVFhcYGxBxMiMjM0QnJzkaHB0TVSsrMUI0OCg5Lh8BU2U2LD4hYmdP/EABoBAQACAwEAAAAAAAAAAAAAAAAFBgEDBAL/xAAtEQEAAgEDAwMEAgICAwAAAAAAAQIDBAUREiExEzNBIjJRgSNxQmEUwRUkNP/aAAwDAQACEQMRAD8A7igICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDy6xyF05gLpyF1mB6gICAgICAgICAgICAgICAgICAgIPLoNWsxGOLx3gHkGp9wQRj8zM9GNx6SB9UCPMzD40bh0WP0QSVNiUTwS2QaC5voQOU3WLWiscyzETPhB4hm+NhtE0ykcfFb77a+5RGo3amOemndIYNtyXj6uyKlzhUcGMaOcE/PVcV92zx4q66bZimPufcGdJR48THDmJb9Vmm9XifqgttFZnisrDhOYoZjYO2H/AHXaE9B4qW0+vxZ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qr+QPvb9Vxxt+p/DpncMEzzy2qbKNQ7xtmMc5ufcNPit+PaM1p+tqybrjiOKr1SRbDGt37LQ33CysePH00iv4QFp5tM/lsLawICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICD/2Q=="
      ),
      sidebarMenu(id = "sidebarmenu",
                  menuItem("QC",tabName = "QC", icon = icon('th'), selected = TRUE,
                           menuSubItem("Load Data", tabName = "load_QC"),
                           menuSubItem("Duplicates", tabName = "duplicats"),
                           menuSubItem("Repeat Use", tabName = "repeat_use")),

                  menuItem("Analysis", tabName = "Analysis" , icon = icon('chart-bar'),
                           menuSubItem("Load Data", tabName = "load_data"),
                           menuSubItem("Sample similarities", tabName = "sample_similaritiesMenu"),
                           menuSubItem("Clone size", tabName = "clone_sizeMenu"),
                           menuSubItem("Barcode sharing", tabName = "barcode_sharingMenu"),
                           menuSubItem("Diversity", tabName = "diversityMenu"),
                           menuSubItem("Categorisation", tabName = "categorisationMenu"))
      )
    ), # end of dashboardSidebar

    dashboardBody(
      # change title police
      tags$head(tags$style(HTML('
        .main-header .logo {
          font-family: "Garamond", sans-serif;
          font-size: 30px;
        }'
      ))),

      tags$head(
        tags$style(HTML(".main-sidebar {font-size: 15px}" ))
      ),

      fluidPage(

        #------------------------------#
        #------- Set input files ------#
        #------------------------------#

############### QC ******************************************************************************************************************
        tabItems(
          tabItem(tabName = "load_QC",
          fluidRow(
              ## Get matrix
              box(width = 12, title="Duplicate Matrix",status = "primary", solidHeader = TRUE,
                  radioButtons("replicats_matrix_extention", label = "Select your file extension : ",
                               inline = TRUE,
                               choices = c("csv", "csv2", "tsv"),
                               selected = NULL),
                  fileInput(inputId="replicats_matrix", label = 'Upload your barcode matrix composed of duplicated samples:',
                            accept = c(".csv", ".csv2",".tsv", ".csv.gz", ".csv2.gz",".tsv.gz"), multiple = FALSE),
                  dataTableOutput("contents_matQC"),
                  footer = "Accepted formarts: .csv (sep=','), .csv2 (sep=';') or .tsv (sep=tabulations) with corresponding separators"),
              ## Get metadata
              box(width = 12,title ="Duplicate Metadata",status = "primary", solidHeader = TRUE,
                  radioButtons("replicats_metadata_extention", label = "Select your file extension : ",
                               inline = TRUE,
                               choices = c("csv", "csv2", "tsv"),
                               selected = NULL),
                  fileInput(inputId="replicats_metadata",label = 'Upload the metadata corresponding to your barcode matrix with duplicates:',
                            accept = c(".csv", ".csv2",".tsv", ".csv.gz", ".csv2.gz",".tsv.gz"), multiple = FALSE),
                  dataTableOutput("contents_metQC"),
                  footer = "Accepted formarts: .csv (sep=','), .csv2 (sep=';') or .tsv (sep=tabulations) with corresponding separators"),
              ## Get duplicate variable name
              box(width = 4, title="Duplicate variable", status="primary", solidHeader=TRUE,
                  pickerInput(inputId = "replicats_var",
                              multiple = FALSE,
                              choices = NULL,
                              label = "Select the variable which defines your duplicates:",
                              options = pickerOptions(actionsBox = FALSE,
                                                      title = "Variable",
                                                      liveSearch = TRUE,
                                                      liveSearchStyle = "contains"))),
              # test data
              box(title ="Load test dataset",status = "warning", solidHeader = TRUE,
                  radioButtons(inputId ="QC_testdataLoder",
                               label = "Do you want to load test data ?",
                               choices = c("No", "Yes"),
                               selected = "No"),

                  tags$script(HTML("Shiny.addCustomMessageHandler('upload_txt_matQC', function(txt) {
  var target = $('#replicats_matrix').parent().parent().parent().find('input[type=text]');
  target.val(txt);
}); ")),
                  tags$script(HTML("Shiny.addCustomMessageHandler('upload_txt_metQC', function(txt) {
  var target = $('#replicats_metadata').parent().parent().parent().find('input[type=text]');
  target.val(txt);
}); "))
              ),

          ) # end of fluidRow
          #)
        ), # end of conditionalPannel QC

############### ANALYSIS ******************************************************************************************************************

        #tabItems(
          tabItem(tabName = "load_data",
          fluidRow(
           ## Get matrix
           box(width = 12, title="Filtred Matrix",status = "primary", solidHeader = TRUE,
               radioButtons("matrix_extention", label = "Select your file extension : ",
                            inline = TRUE,
                            choices = c("csv", "csv2", "tsv"),
                            selected = NULL),
               fileInput(inputId="matrix",label = "Upload your filtered matrix:",
                         accept = c(".csv", ".csv2",".tsv", ".csv.gz", ".csv2.gz",".tsv.gz"),
                         multiple = FALSE),
               dataTableOutput("contents_mat"),
               footer = "Accepted formarts: .csv (sep=','), .csv2 (sep=';') or .tsv (sep=tabulations) with corresponding separators"),
           ## Get metadata
           box(width = 12,title ="Metadata",status = "primary", solidHeader = TRUE,
               radioButtons("metadata_extention", label = "Select your file extension : ",
                            inline = TRUE,
                            choices = c("csv", "csv2", "tsv"),
                            selected = NULL),
               fileInput(inputId="metadata",label = "Upload the metadata corresponding to your filtred matrix:",
                         accept = c(".csv", ".csv2",".tsv", ".csv.gz", ".csv2.gz",".tsv.gz"),
                         multiple = FALSE),
               dataTableOutput("contents_met"),
               footer = "Accepted formarts: .csv (sep=','), .csv2 (sep=';') or .tsv (sep=tabulations) with corresponding separators"),

           box(width = 4, title="Individuals", status="primary", solidHeader=TRUE,
               pickerInput(inputId = "organism",
                           multiple = FALSE,
                           choices = NULL,
                           label = "Select the variable defining your individuals:",
                           options = pickerOptions(actionsBox = TRUE,
                                                   title = "ex: Mouse, Patients, etc.",
                                                   liveSearch = TRUE,
                                                   liveSearchStyle = "contains"))),
           # test data
           box(title ="Load test dataset",status = "warning", solidHeader = TRUE,
               radioButtons(inputId ="Analysis_testdataLoder",
                            label = "Do you want to load test data ?",
                            choices = c("No", "Yes"),
                            selected = "No"),
               tags$script(HTML(" Shiny.addCustomMessageHandler('upload_txt_mat', function(txt) {
  var target = $('#matrix').parent().parent().parent().find('input[type=text]');
  target.val(txt);
}); ")),
               tags$script(HTML("Shiny.addCustomMessageHandler('upload_txt_met', function(txt) {
  var target = $('#metadata').parent().parent().parent().find('input[type=text]');
  target.val(txt);
}); "))
           ),
         ) # end of fluidRow
          #)
        ), # end of conditionalPannel Analysis

############### Sub Menus ******************************************************************************************************************
#°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
        #tabItems(
         tabItem(tabName = "duplicats",

          fluidRow(
           box(status = "primary", solidHeader = FALSE, width = "100%",

           # Left column == questions box
           column(width=4,

            box(width = NULL, status ="primary",solidHeader = TRUE, title="Sample selections",
             pickerInput(inputId = "varRep",
                             label = "Which variable(s) do you want to select your samples on?",
                             choices = NULL,
                             multiple = TRUE,
                             options = pickerOptions(actionsBox = TRUE,
                                                     title = "Variables",
                                                     liveSearch = TRUE,
                                                     liveSearchStyle = "contains")),

             conditionalPanel("input.varRep!=''",
                pickerInput(inputId = "valRep",
                            label = "Select value(s) take by variable(s):",
                            choices = NULL,
                            multiple = TRUE,
                            options = pickerOptions(actionsBox = TRUE,
                                                    title = "Values",
                                                    liveSearch = TRUE,
                                                    liveSearchStyle = "contains"))
             )
            ), # end of sample selection box

            box(width = NULL, status ="primary",solidHeader = TRUE, title="Graph options",
              box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
                radioButtons(inputId = "QCtransformation",
                             label = "Which transformation do you want to apply? ", inline = TRUE,
                             selected = "arcsin",
                             choices = c("arcsin", "log10(x+1)", "none"))
              ),

              box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
                  radioButtons(inputId = "QCtransformation",
                               label = "Which transformation do you want to apply? ", inline = TRUE,
                               selected = "arcsin",
                               choices = c("arcsin", "log10(x+1)", "none"))
              ),
              box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
                  radioButtons(inputId = "correlDup",
                               label = "Choose your correlation method :", inline = TRUE,
                               choices = c("spearman", "pearson"),
                               selected = "pearson")
              )
            )
           ), # end of column user questions

           column(width=8, align="center",
            box(align="center", width = "100%", height = "100%",

              conditionalPanel("input.valRep.length==0",
                                 imageOutput("QCDotEx"), width="100%", height="100%"),

              conditionalPanel("input.valRep.length>0",
                              uiOutput("plots"),
                              downloadButton("downloadImage_QC", "Plot"),
                              downloadButton("downloadTable_QC", "Matrix")
              )
            )

          ) # end of left column

          ) # end of box
         )# end of fluid row
        ), # end of tabItem duplicats

#°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
        tabItem(tabName = "repeat_use",

         fluidRow(

          box(status = "primary", solidHeader = FALSE, width = "100%",

            # Left column == questions box
            column(width=4,

             box(width = NULL, status ="primary",solidHeader = TRUE, title="Sample selections",
                 pickerInput(inputId = "indiv_varRU",
                             label = "Select the variable which defines your individuals:",
                             choices = NULL,
                             multiple = FALSE,
                             options = pickerOptions(actionsBox = TRUE,
                                                     title = "Individuals",
                                                     liveSearch = FALSE,
                                                     liveSearchStyle = "contains")),

                 conditionalPanel("input.indiv_varRU!=''",
                                  pickerInput(inputId = "indiv_valRU",
                                              label = "Which individuals do you want to plot ?",
                                              choices = NULL,
                                              multiple = TRUE,
                                              options = pickerOptions(actionsBox = TRUE,
                                                                      title = "Values",
                                                                      liveSearch = TRUE,
                                                                      liveSearchStyle = "contains"))
                 )
             ) # end of sample selection box

            ), # end of column user questions

            column(width=8, align="center",
                 box(align="center", width = "100%", height = "100%",
                     conditionalPanel("input.indiv_valRU.length==0",
                                      imageOutput("RUDotEx"), width="100%", height="100%"),

                     conditionalPanel("input.indiv_valRU.length>0",
                                      uiOutput("plotsRU"),
                                      downloadButton("downloadImage_RU", "Plot"),
                                      downloadButton("downloadTable_RU", "Matrix")
                     )
                 )
             ) # end of left column
          ) # end of box
        )# end of fluid row
      ),# end of tabItem repeat_use

#°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
  ##############################
  ####  Sample Similarities  ###
  ##############################
  tabItem(tabName = "sample_similaritiesMenu",
   # Row of 2 big columns
   fluidRow(
    box(status = "primary", solidHeader = FALSE, width = "100%",
     # Left column == questions box
     column(width=4,

       box(width = NULL, status ="primary", height = NULL, solidHeader = TRUE,
           radioButtons(inputId = "graph_sampleSim",
                        label = "Select the type of graph:",
                        inline = FALSE,
                        choices = c("None", "Heatmap", "Correlogram"),
                        selected = 'None')
        ),

   conditionalPanel(condition ="input.graph_sampleSim != 'None'",

     box(width = NULL, title="Sample selections", status ="primary",solidHeader = TRUE,
      box(width = NULL, status ="primary",solidHeader = TRUE,
        pickerInput(inputId = "organismSample",
                    label = "Which individual(s) do you want to display ?",
                    choices = NULL,
                    multiple = TRUE,
                    options = pickerOptions(actionsBox = TRUE,
                                            title = "Individuals",
                                            liveSearch = TRUE,
                                            liveSearchStyle = "contains"))

      ),
      box(width = NULL, status ="primary",solidHeader = TRUE,
        pickerInput(inputId = "variable",
                    label = "Which variable(s) do you want to display ?",
                    choices = NULL,
                    multiple = TRUE,
                    options = pickerOptions(actionsBox = TRUE,
                                            title = "Variables",
                                            liveSearch = TRUE,
                                            liveSearchStyle = "contains")),
        pickerInput(inputId = "value",
                    label= "Select at least two values to plot with:",
                    multiple = TRUE,
                    choices = NULL,
                    options = pickerOptions(actionsBox = TRUE,
                                            title = "Values",
                                            liveSearch = TRUE,
                                            liveSearchStyle = "contains"))

     )
    ) # end of Sample selections
   ), # end of none

    ####  Heatmap options ####
    ##########################

    conditionalPanel("input.value.length>0 && input.graph_sampleSim == 'Heatmap'",
      box(width = NULL, title="Graph options", status ="primary",solidHeader = TRUE,
        box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
          radioButtons(inputId = "changeCalcul",
                       label = "Do you want to change default distance and clustering methods?", inline = TRUE,
                       choices = c("no", "yes"),
                       selected = "no")),

          conditionalPanel("input.changeCalcul=='yes'",
             box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
                 radioButtons(inputId = "distance",
                              label = "Which distance method do you want?", inline = TRUE,
                              choices = c("euclidean", "maximum", "manhattan", "canberra"),
                              selected = "euclidean")),
             box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
                 # https://support.minitab.com/en-us/minitab/18/help-and-how-to/modeling-statistics/multivariate/how-to/cluster-observations/methods-and-formulas/linkage-methods/
                 radioButtons(inputId = "clustering",
                              label = "Which clustering method do you want?", inline = TRUE,
                              choices = c("complete", "average", "mcquitty", "median", "centroid", "ward.D2"),
                              selected = "complete"))
             ), # end of changeCalcul=='yes'

          box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
              radioButtons(inputId = "dendro",
                           label = "Do you want to display a column dendrogram?", inline = TRUE,
                           choices = c("no", "yes"),
                           selected = "no")),

          box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
              uiOutput("nclustersUi")
              ),

          box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
            radioButtons(inputId = "barcodes",
                         label = "Do you want to display a row barcodes?", inline = TRUE,
                         choices = c("no", "yes"),
                         selected = "no"))
      ) # end of graph options
     ) # end of conditionalPanel Heatmap
    ),
   #), # end of left column

    # Rigth column == Plot box
    column(width=8, align="center",

     ###################
     ####  Heatmap  ####
     ###################
     conditionalPanel("input.graph_sampleSim=='Heatmap'",
      tabBox(height="100%", width = "100%",
       title = "",
       id = "tabHeatmap",
       tabPanel(id="tabFig",
                title="Figure",
                conditionalPanel("input.value.length==0",
                                 imageOutput("heatmapEx", width="100%")),

                conditionalPanel("input.value.length>0",
                                 plotOutput(outputId="heatmap")),
                conditionalPanel("input.value.length>0",
                                 downloadButton("downloadImage_heatmap", "Plot"),
                                 downloadButton("downloadTable_heatmap", "Matrix"))
                ),
       tabPanel(id="tabInfo",
                title="Details",
                "Used distance: ",
                conditionalPanel("input.value.length==0 ",
                                 verbatimTextOutput("distanceEx")),
                conditionalPanel("input.value.length>0 ",
                                 verbatimTextOutput("distanceSelected")),
                "Used clustering: ",
                conditionalPanel("input.value.length==0 ",
                                 verbatimTextOutput("clusteringEx")),
                conditionalPanel("input.value.length>0 ",
                                 verbatimTextOutput("clusteringSelected")))
       ) # end of tabBox
      ), # end of conditionalPanel heatmap

     #######################
     ####  Correlogram  ####
     #######################
      conditionalPanel("input.graph_sampleSim=='Correlogram'",
      box(width = NULL, title="Graph options", status ="primary",solidHeader = TRUE,
        box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
          radioButtons(inputId = "correlation",
                      label = "Choose your correlation method :", inline = TRUE,
                      choices = c("spearman", "pearson"),
                      selected = "pearson"))),
       box(align="center", width = "100%", height = "100%",
           #uiOutput("CloneSizeUI"),
           conditionalPanel("input.value.length==0 ",
                            imageOutput("correloEx")),

           conditionalPanel("input.value.length>0 ",
                            plotOutput(outputId="correlo"),
                            downloadButton("downloadImage_correlo", "Plot"),
                            downloadButton("downloadTable_correlo", "Matrix"))
       )
      ) # end of condit panel Correlogram
     )# end of right column

     ) # end of big box
    ) # end of fluidrow
   ), # end of tabItem sample_similaritiesMenu

#°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
    #####################
    ####  Clone size  ###
    #####################

tabItem(tabName = "clone_sizeMenu",
  # Row of 2 big columns
  fluidRow(
    box(status = "primary", solidHeader = FALSE, width = "100%",
        # Left column == questions box
        column(width=4,

     box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
       radioButtons(inputId = "graphType2",
                    label = "Select the type of graph:", inline = FALSE,
                    selected = "None",
                    choices = c("None", "Cumulative diagram", "Frequency distribution"))
      ),

     conditionalPanel("input.graphType2!='None'",

       box(width = NULL, title="Sample selections", status ="primary",solidHeader = TRUE,
        box(width = NULL, status ="primary",solidHeader = TRUE,
           pickerInput(inputId = "organismSampleCS",
                       label = "Which individual(s) do you want to display ?",
                       choices = NULL,
                       multiple = TRUE,
                       options = pickerOptions(actionsBox = TRUE,
                                               title = "Individuals",
                                               liveSearch = TRUE,
                                               liveSearchStyle = "contains"))
       ),
       box(width = NULL, status ="primary",height = 200,solidHeader = TRUE,
           pickerInput(inputId = "variableCS",
                       label = "Which variable(s) do you want to display ?",
                       choices = NULL,
                       multiple = TRUE,
                       options = pickerOptions(actionsBox = TRUE,
                                               title = "Variables",
                                               liveSearch = TRUE,
                                               liveSearchStyle = "contains")),
           pickerInput(inputId = "valueCS",
                       label= "Select the value(s) take by variable(s):",
                       multiple = TRUE,
                       choices = NULL,
                       options = pickerOptions(actionsBox = TRUE,
                                               title = "Values",
                                               liveSearch = TRUE,
                                               liveSearchStyle = "contains"))
       )), # end of sample selection

       box(width = NULL, title="Graph option", status ="primary",solidHeader = TRUE,

        conditionalPanel("input.graphType2=='Frequency distribution'",
          box(width = NULL, status ="primary",solidHeader = TRUE,
              radioButtons(inputId = "yCS",
                           label= "Select the type of diagram:",
                           choices = c("Density curve", "Histogarm"),
                           selected = "Density curve",
                           inline = FALSE))
       ),

       box(width = NULL, status ="primary",solidHeader = TRUE,
          radioButtons(inputId = "doColor",
                        label= "Do you want to add colors :",
                        choices = c("no", "yes"),
                        selected = "no",
                        inline = FALSE),

          conditionalPanel("input.doColor=='yes'",
           pickerInput(inputId = "colorCS",
                       label= "Select the variable for the color:",
                       multiple = FALSE,
                       choices = NULL,
                       options = pickerOptions(actionsBox = FALSE,
                                               title = "Color",
                                               liveSearch = TRUE,
                                               liveSearchStyle = "contains"))
        )
      ),

       # only freq
        conditionalPanel("input.graphType2=='Frequency distribution'",
         box(width = NULL, status ="primary",solidHeader = TRUE,
             sliderInput("nbins", label = "Select a number of bins", min = 0,
                         max = 100, value = 5))
        ),
       # only cum
        conditionalPanel("input.graphType2=='Cumulative diagram'",
         box(width = NULL, status ="primary",solidHeader = TRUE,
          radioButtons(inputId ="xProportion",
                       label = "Convert x axis in percentage :",
                       choices = c("no", "yes"),
                       selected = "no",
                       inline = FALSE))
       )
      )  # end of graph option
     )
    ), #end of left box

    column(width=8, align="center",
     box(align="center", width = "100%", height = "100%",

         ##  Clone Size  ##
         #°°°°°°°°°°°°°°°°°°°°°°°°#

         #uiOutput("CloneSizeUI"),
         conditionalPanel("input.graphType2=='Cumulative diagram' && input.valueCS.length==0 ",
                          imageOutput("cumulativeDiagramEx")),

         conditionalPanel("input.graphType2=='Cumulative diagram' && input.valueCS.length>0 ",
                          plotOutput(outputId="cumulativeDiagram"),
                          downloadButton("downloadImage_cumDiag", "Plot"),
                          downloadButton("downloadTable_cumDiag", "Matrix")
         ),

         conditionalPanel("input.graphType2=='Frequency distribution' && input.valueCS.length==0",
                          imageOutput("nonCumulativeHistEx")),

         conditionalPanel("input.graphType2=='Frequency distribution' && input.valueCS.length>0 ",
                          plotOutput(outputId="nonCumulativeHist"),
                          downloadButton("downloadImage_nonCumHist", "Plot"),
                          downloadButton("downloadTable_nonCumHist", "Matrix")
         )

     ) # end of right box
    ) # end of right column

   ) # end of big box
  ) # end of fluidrow
 ), # end of tabItem clone size


#°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
    ##########################
    ####  Barcode sharing ###
    #########################

tabItem(tabName = "barcode_sharingMenu",
  # Row of 2 big columns
  fluidRow(
    box(status = "primary", solidHeader = FALSE, width = "100%",
        # Left column == questions box
        column(width=4,

   box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
     radioButtons(inputId = "graphType1",
                  label = "Select the type of graph:", inline = FALSE,
                  selected = "None",
                  choices = c("None", "Dotplot", "Ternary plot"))
   ),

   conditionalPanel("input.graphType1!='None'",

     box(width = NULL, title="Sample selections", status ="primary",solidHeader = TRUE,

      box(width = NULL, status ="primary",solidHeader = TRUE,
       pickerInput(inputId = "organismSampleSB",
                   label = "Which individual(s) do you want to display ?",
                   choices = NULL,
                   multiple = TRUE,
                   options = pickerOptions(actionsBox = TRUE,
                                           title = "Individuals",
                                           liveSearch = TRUE,
                                           liveSearchStyle = "contains"))
      ),

      conditionalPanel("input.graphType1=='Dotplot'",
       box(width = NULL,title="x axis", status ="primary",solidHeader = TRUE,

          pickerInput(inputId = "x_var",
                     label = "Select x variable(s):",
                     choices = NULL,
                     multiple = TRUE,
                     options = pickerOptions(actionsBox = TRUE,
                                             title = "Variables",
                                             liveSearch = TRUE,
                                             liveSearchStyle = "contains")),
          pickerInput(inputId = "x_val",
                      label = "Select x value(s) to display:",
                      choices = NULL,
                      multiple = TRUE,
                      options = pickerOptions(actionsBox = TRUE,
                                              title = "Values",
                                              liveSearch = TRUE,
                                              liveSearchStyle = "contains"))
       ),

       box(width = NULL,title="y axis", status ="primary",solidHeader = TRUE,
          pickerInput(inputId = "y_var",
                      label = "Select y variable(s):",
                      choices = NULL,
                      multiple = TRUE,
                      options = pickerOptions(actionsBox = TRUE,
                                              title = "Variables",
                                              liveSearch = TRUE,
                                              liveSearchStyle = "contains")),
          pickerInput(inputId = "y_val",
                      label = "Select y value(s) to display:",
                      choices = NULL,
                      multiple = TRUE,
                      options = pickerOptions(actionsBox = TRUE,
                                              title = "Values",
                                              liveSearch = TRUE,
                                              liveSearchStyle = "contains"))
      )), # end of conditionalPanel Dotplot

    conditionalPanel("input.graphType1=='Ternary plot'",
       box(width = NULL,title="Value1", status ="primary",solidHeader = TRUE,
          pickerInput(inputId = "top_var",
                       label= "Select variable(s):",
                       multiple = TRUE,
                       choices = NULL,
                       options = pickerOptions(actionsBox = TRUE,
                                               title = "Variables",
                                               liveSearch = TRUE,
                                               liveSearchStyle = "contains")),
          pickerInput(inputId = "top_val",
                      label= "Select values(s) to display (left axis):",
                      multiple = TRUE,
                      choices = NULL,
                      options = pickerOptions(actionsBox = TRUE,
                                              title = "Values",
                                              liveSearch = TRUE,
                                              liveSearchStyle = "contains"))
       ),

       box(width = NULL,title="Value2", status ="primary",solidHeader = TRUE,
           pickerInput(inputId = "right_var",
                       label= "Select variable(s):",
                       multiple = TRUE,
                       choices = NULL,
                       options = pickerOptions(actionsBox = TRUE,
                                               title = "Variables",
                                               liveSearch = TRUE,
                                               liveSearchStyle = "contains")),
           pickerInput(inputId = "right_val",
                       label= "Select values(s) to display (right axis):",
                       multiple = TRUE,
                       choices = NULL,
                       options = pickerOptions(actionsBox = TRUE,
                                               title = "Values",
                                               liveSearch = TRUE,
                                               liveSearchStyle = "contains"))
       ),

       box(width = NULL,title="Value3", status ="primary",solidHeader = TRUE,
           pickerInput(inputId = "left_var",
                       label= "Select variable(s):",
                       multiple = TRUE,
                       choices = NULL,
                       options = pickerOptions(actionsBox = TRUE,
                                               title = "Variables",
                                               liveSearch = TRUE,
                                               liveSearchStyle = "contains")),
           pickerInput(inputId = "left_val",
                       label= "Select values(s) to display (bottom axis):",
                       multiple = TRUE,
                       choices = NULL,
                       options = pickerOptions(actionsBox = TRUE,
                                               title = "Values",
                                               liveSearch = TRUE,
                                               liveSearchStyle = "contains"))
       )

    ) # end of conditional panel Ternary
  ), # end of sample selection

     box(width = NULL, title="Graph options", status ="primary",solidHeader = TRUE,

      conditionalPanel("input.graphType1=='Dotplot'",
        box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
             radioButtons(inputId = "SBtransformation",
                          label = "Which transformation do you want to apply? ", inline = TRUE,
                          selected = "arcsin",
                          choices = c("arcsin", "log10(x+1)", "none"))
        )
      ),
      conditionalPanel("input.graphType1=='Dotplot'",

        box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
          radioButtons(inputId = "filledPlotSB",
                    label = "Do you want to color dots?", inline = TRUE,
                    selected = "no",
                    choices = c("no", "yes")),

          conditionalPanel("input.filledPlotSB=='yes'" ,
            pickerInput(inputId = "colorSB",
                       label= "Select the variable to color:",
                       multiple = FALSE,
                       choices = NULL,
                       options = pickerOptions(actionsBox = TRUE,
                                               title = "Color",
                                               liveSearch = FALSE))
          )
        )
      ),

       conditionalPanel("input.graphType1=='Ternary plot'" ,
            radioButtons(inputId = "colorSB_ternary",
                         label = "Do you want to color dots according individuals ?", inline = TRUE,
                         selected = "no",
                         choices = c("no", "yes")))

     ) # end of graph options
    ) #end of conditionalPanel not None
  ), # end of left column

  column(width=8, align="center",
   box(align="center", width = "100%", height = "100%",
    conditionalPanel("input.graphType1=='Dotplot' && (input.x_val.length==0 || input.y_val.length==0) ",
                     imageOutput("dotplotEx")),

    conditionalPanel("input.graphType1=='Dotplot' && input.x_val.length>0 && input.y_val.length>0 ",
                     # dotplot
                     plotOutput(outputId="dotplot"),
                     downloadButton("downloadImage_dotplot", "Plot"),
                     downloadButton("downloadTable_dotplot", "Matrix"),

                     # piechart plot
                     plotOutput(outputId="piechart"),
                     downloadButton("downloadImage_piechart", "Plot"),
                     downloadButton("downloadTable_piechart", "Matrix")),

    conditionalPanel("input.graphType1=='Ternary plot' && (input.top_val.length==0 || input.left_val.length==0 || input.right_val.length==0)",
                     imageOutput("ternaryPlotEx")),

    conditionalPanel("input.graphType1=='Ternary plot' && input.top_val.length>0 && input.left_val.length>0 && input.right_val.length>0",
                     plotOutput(outputId="ternaryPlot"),
                     downloadButton("downloadImage_ternary", "Plot"),
                     downloadButton("downloadTable_ternary", "Matrix"))

   ) # end of right box
  ) # end of right column

    ) # end of big box
   ) # end of fluidrow
  ), # end of tabItem barcode sharing

#°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
    ####################
    ####  Diversity  ###
    ####################

tabItem(tabName = "diversityMenu",
        # Row of 2 big columns
        fluidRow(
          box(status = "primary", solidHeader = FALSE, width = "100%",
              # Left column == questions box
              column(width=4,

     box(width = NULL, title="Sample selections", status ="primary",solidHeader = TRUE,
      # changer pour le dotplot, proposer uniquement un seul choix pour la variable
      box(width = NULL, status ="primary",solidHeader = TRUE,
       pickerInput(inputId = "organismSample_notPooled",
                   label = "Select individual(s): ",
                   choices = NULL,
                   multiple = TRUE,
                   options = pickerOptions(actionsBox = TRUE,
                                           title = "Individuals",
                                           liveSearch = TRUE,
                                           liveSearchStyle = "contains"))

      ),
      box(width = NULL, status ="primary",solidHeader = TRUE,
        pickerInput(inputId = "variable_notPooled",
                    label = "Select x axis variable(s):",
                    choices = NULL,
                    multiple = TRUE,
                    options = pickerOptions(actionsBox = TRUE,
                                            title = "Variables",
                                            liveSearch = TRUE,
                                            liveSearchStyle = "contains")),
        pickerInput(inputId = "value_notPooled",
                    label= "Select value(s) take by x axis variable(s):",
                    multiple = TRUE,
                    choices = NULL,
                    options = pickerOptions(actionsBox = TRUE,
                                            title = "Values",
                                            liveSearch = TRUE,
                                            liveSearchStyle = "contains"))
      ),
      box(width = NULL, status ="primary",solidHeader = TRUE,
          radioButtons(inputId = "yBoxplot",
                       label = "What do you want in y axis ?", inline = TRUE,
                       selected = "Number of barcodes",
                       choices = c("Number of barcodes", "Shannon index", "Simpson index"))
      )
     ), # end of box Sample selection

     box(width = NULL, title="Graph options", status ="primary",solidHeader = TRUE,
       box(width = NULL, status ="primary",solidHeader = TRUE,
           radioButtons(inputId = "boxplotCondition",
                        label = "Do you want to color your plot ?", inline = TRUE,
                        selected = "no",
                        choices = c("no", "yes")),

           conditionalPanel("input.boxplotCondition=='yes'",
             pickerInput(inputId = "boxplotColor_var",
                         label= "Select a variable: ",
                         multiple = FALSE,
                         choices = NULL,
                         options = pickerOptions(actionsBox = FALSE,
                                                 title = "Variable",
                                                 liveSearch = FALSE))
          )),

       box(width = NULL, status ="primary",solidHeader = TRUE,
          radioButtons(inputId = "boxplotDot",
                       label = "Do you want to display dots?", inline = TRUE,
                       selected = "no",
                       choices = c("no", "yes"))
       )
    ) # end of Graph options
   ), # end of left column

   column(width=8, align="center",
    box(align="center", width = "100%", height = "100%",

      conditionalPanel("input.value_notPooled.length<1",
                       imageOutput("boxplotEx")),

      conditionalPanel("input.value_notPooled.length>=1",
                       plotOutput(outputId="boxplot"),
                       downloadButton("downloadImage_boxplot", "Plot"),
                       downloadButton("downloadTable_boxplot", "Matrix"))

    ) # end of right box
   ) # end of right column

  ) # end of big box
 ) # end of fluidrow
), # end of tabItem diversityMenu

#°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
  #########################
  ####  Categorisation  ###
  #########################

tabItem(tabName = "categorisationMenu",
        # Row of 2 big columns
        fluidRow(
          box(status = "primary", solidHeader = FALSE, width = "100%",
              # Left column == questions box
              column(width=4,

                     box(width = NULL, status ="primary",height = NULL,solidHeader = TRUE,
                         radioButtons(inputId = "CatGraph",
                                      label = "Select the analysis:", inline = FALSE,
                                      selected = "None",
                                      choices = c("None", "Category analysis", "Bias analysis"))
                     ),

                     conditionalPanel("input.CatGraph!='None'",

                                      box(width = NULL, status ="primary",solidHeader = TRUE, title="Sample selections",
                                          pickerInput(inputId = "organismCat",
                                                      label = "Select individual(s):",
                                                      choices = NULL,
                                                      multiple = TRUE,
                                                      options = pickerOptions(actionsBox = TRUE,
                                                                              title = "Individuals",
                                                                              liveSearch = TRUE,
                                                                              liveSearchStyle = "contains")),
                                          pickerInput(inputId = "catVar",
                                                      label = "Select the variable used for cell types:",
                                                      choices = NULL,
                                                      multiple = FALSE,
                                                      options = pickerOptions(actionsBox = TRUE,
                                                                              title = "Categorgy",
                                                                              liveSearch = TRUE,
                                                                              liveSearchStyle = "contains")),
                                          conditionalPanel("input.catVar!=''",
                                                           pickerInput(inputId = "catVal",
                                                                       label = "Select its values:",
                                                                       choices = NULL,
                                                                       multiple = TRUE,
                                                                       options = pickerOptions(actionsBox = TRUE,
                                                                                               liveSearch = TRUE,
                                                                                               liveSearchStyle = "contains"))),

                                          conditionalPanel("input.catVar!='' && input.catVal.length>1 && input.CatGraph=='Bias analysis'",
                                                           pickerInput(inputId = "yBias",
                                                                       label = "Select one cell type:",
                                                                       choices = NULL,
                                                                       multiple = FALSE,
                                                                       options = pickerOptions(actionsBox = TRUE,
                                                                                               liveSearch = TRUE,
                                                                                               liveSearchStyle = "contains")))
                                      ), # end of Sample selections

                                      box(width = NULL, status ="primary",solidHeader = TRUE,title="Graph option",

                                          conditionalPanel("input.CatGraph=='Category analysis'",
                                                           box(width = NULL, status ="primary",solidHeader = TRUE,title="Threshold value",
                                                               sliderInput("slider", label = "Select the threshold used for categorization:", min = 0,
                                                                           max = 100, value = 20))),

                                          radioButtons(inputId = "condition",
                                                       label = "Do you want to add a condition (e.g: treatment, organ, etc.) ? ", inline = TRUE,
                                                       selected = "no",
                                                       choices = c("no","yes")),

                                          conditionalPanel("input.condition=='yes' && input.catVar!=''",
                                                           pickerInput(inputId = "conditionVal",
                                                                       label = "Select your condition value:",
                                                                       choices = NULL,
                                                                       multiple = FALSE,
                                                                       options = pickerOptions(actionsBox = TRUE,
                                                                                               title = "Condition",
                                                                                               liveSearch = TRUE,
                                                                                               liveSearchStyle = "contains")))
                                      ) # end of box Graph opt
                     ) # end of conditional None
              ), # end of left column

              column(width=8, align="center",
                     box(align="center", width = "100%", height = "100%",

                         conditionalPanel("input.CatGraph=='Category analysis'",
                                          conditionalPanel("input.catVal.length<=1 && input.organismCat.length==0",
                                                           imageOutput("contrib2"),
                                                           imageOutput("contrib1")
                                          )),

                         conditionalPanel("input.catVal.length>1 && input.organismCat.length>0 && input.CatGraph=='Category analysis'",
                                          # first plot
                                          withLoader(plotOutput(outputId="bargraphCat_counts"), type = "html", loader = "dnaspin"),
                                          downloadButton("downloadImage_counts", "Plot"),
                                          downloadButton("downloadTable_counts", "Matrix"),

                                          # second plot
                                          plotOutput(outputId="bargraphCat_percent"),
                                          downloadButton("downloadImage_percent", "Plot"),
                                          downloadButton("downloadTable_percent", "Matrix")
                         ),

                         # print and export bias analysis graphs and matrices
                         conditionalPanel("input.catVal.length>1 && input.organismCat.length>0 && input.CatGraph=='Bias analysis'",
                                          # first plot
                                          withLoader(plotOutput(outputId="biasPerType"), type = "html", loader = "dnaspin"),
                                          downloadButton("downloadImage_biasType", "Plot"),
                                          downloadButton("downloadTable_biasType", "Matrix"),

                                          # second plot
                                          plotOutput(outputId="biasPerCat"),
                                          downloadButton("downloadImage_biasCat", "Plot"),
                                          downloadButton("downloadTable_biasCat", "Matrix")
                         )

                     ) # end of right box
              ) # end of right column

          ) # end of big box
        ) # end of fluidrow
) # end of tabItem categorisationMenu


      )# end of TabItems
    )# end of fluidPage
  )# end dashboardBody
 )# end dashboardPage
}
TeamPerie/CellDestiny documentation built on July 4, 2022, 8:40 a.m.