ui.R 67.3 KB
Newer Older
fsoubes's avatar
fsoubes committed
1 2 3 4 5 6 7 8 9 10
### Author: Franck Soubès
### Bioinformatics Master Degree - University of Bordeaux, France
### Link: https://github.com/fsoubes/MA_Trix_App
### Where: GET-TRiX's facility
### Application: MATRiX is a shiny application for Microarray Analysis on Transcriptomic impact of Xenobiotics
### Licence: GPL-3.0


###############################
######## dashboardsidebar     #
fsoubes's avatar
fsoubes committed
11
###############################
fsoubes's avatar
fsoubes committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33


inactivity <- "function idleTimer() {
  var t = setTimeout(logout, 5000);
  window.onmousemove = resetTimer; // catches mouse movements
  window.onmousedown = resetTimer; // catches mouse movements
  window.onclick = resetTimer;     // catches mouse clicks
  window.onscroll = resetTimer;    // catches scrolling
  window.onkeypress = resetTimer;  //catches keyboard actions

  function logout() {
    window.close();  //close the window
  }

  function resetTimer() {
    clearTimeout(t);
    t = setTimeout(logout, 5000);  // time is in milliseconds (1000 is 1 second)
  }
}
idleTimer();"


fsoubes's avatar
fsoubes committed
34

fsoubes's avatar
fsoubes committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
makeselectInputbutton <- function(selectInput, buttonId, buttonLabel, size = "default", style = "default"){
  size <- switch(size, `extra-small` = "btn-xs", small = "btn-sm", 
                 large = "btn-lg", "default")
  style <- paste0("btn-", style)
  
  tags$script(HTML(paste0("
          $(document).ready(function() {
            var inputElements = document.getElementsByTagName('input');
            for(var i = 0; i < inputElements.length; i++){
              var input = inputElements[i];

              if(input.getAttribute('value') == '", checkboxValue, "'){

                var button = document.createElement('button');
                button.setAttribute('id', '", buttonId, "');
                button.setAttribute('type', 'button');
                button.setAttribute('class', '", paste("btn action-button", style , size), "');
                button.appendChild(document.createTextNode('", buttonLabel, "'));

                input.parentElement.parentElement.appendChild(button);
             };
            }
          });
        ")))
}

fsoubes's avatar
fsoubes committed
61 62 63 64
shinyjscode <- "
shinyjs.init = function() {
  $(window).resize(shinyjs.calcHeight);
}
fsoubes's avatar
fsoubes committed
65

fsoubes's avatar
fsoubes committed
66
shinyjs.calcHeight = function() {
fsoubes's avatar
fsoubes committed
67 68 69 70 71 72
  Shiny.onInputChange('plotHeight', $(window).height());
}
"


dbHeader <- dashboardHeader(title = "MATRiX")
fsoubes's avatar
fsoubes committed
73
dbHeader$children[[2]]$children <-  tags$a(tags$img(src='matrix.png',height='40',width='40',style="margin:5px 0 5px 0;",align='left'),
fsoubes's avatar
fsoubes committed
74 75 76
                                           tags$h3("MATRiX",style="font-family:Purisa; margin:15px 25px 5px 0;color:white; "))


fsoubes's avatar
fsoubes committed
77 78 79 80 81 82 83 84 85
sidebar <- dashboardSidebar( 
# tags$style(HTML("
#       .main-sidebar{
#         width: 180px;
#       }
#       .content-wrapper, .main-footer, .right-side{
#       margin-left: 180px;
#       }
#     ")), # analyse par microréseau de l'impact transcriptomique des xénobiotiques
fsoubes's avatar
fsoubes committed
86 87 88 89 90
  useShinyjs(),
  inlineCSS(appCSS),
  tags$style(type="text/css", Errorcss),
  tags$style(type="text/css", inactivity),
  shinyjs::extendShinyjs(text = shinyjscode),
fsoubes's avatar
fsoubes committed
91

fsoubes's avatar
fsoubes committed
92 93
#tags$head(includeHTML("www/google-analytics.html")),
tags$head(
fsoubes's avatar
fsoubes committed
94
     #tags$script(src = inactivity),
fsoubes's avatar
fsoubes committed
95 96 97 98 99 100
     tags$script(src = "custom.js")),
  div(id = "loading-content-bar",p()),

  div(
    id = "matrixapp",
    sidebarMenu(id = "side",
fsoubes's avatar
fsoubes committed
101
      menuItem("Home", tabName = "Home", icon = icon("home")),
fsoubes's avatar
fsoubes committed
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
      menuItem("Upload Data", tabName = "Upload", icon = icon("upload")),
      menuItem("PCA", tabName = "PCA", icon = icon("line-chart")),
      menuItem("Venn diagram", tabName = "Venn", icon = icon("line-chart")),
      menuItem("Heatmap", tabName = "Heatmap", icon = icon("line-chart")),
      menuItemOutput("dymMenu"),
      collapsed = TRUE,

      tags$a(img(
        src = "GeT_logo-RVB.png",
        height = 50,
        width = 180,
        style = "position:absolute;bottom:50px;margin:0 0 15px 10px;"
      ) , href="https://get.genotoul.fr/en/", target="_blank"),
      tags$a(img(
        src = "Logotype-INRA-transparent.png",
        height = 43,
        width = 168,
        style = "position:absolute;bottom:0;margin:0 0 15px 10px;"
      ) , href="https://www6.toulouse.inra.fr/toxalim", target="_blank")
fsoubes's avatar
fsoubes committed
121

fsoubes's avatar
fsoubes committed
122 123 124 125 126 127
      )
  )
)

  ###############################
  ######## dashboardbody        #
fsoubes's avatar
fsoubes committed
128
  ###############################
fsoubes's avatar
fsoubes committed
129 130
  ###############################
  ######## Upload Page          #
fsoubes's avatar
fsoubes committed
131
  ###############################
fsoubes's avatar
fsoubes committed
132 133

body <- dashboardBody(
fsoubes's avatar
fsoubes committed
134
  #tags$head(includeScript("google-analytics.js")),
fsoubes's avatar
fsoubes committed
135

fsoubes's avatar
fsoubes committed
136 137
  tags$style(type="text/css", inactivity),
  tags$style(type="text/css", Errorcss),
fsoubes's avatar
fsoubes committed
138

fsoubes's avatar
fsoubes committed
139

fsoubes's avatar
fsoubes committed
140
  useShinyjs(),
fsoubes's avatar
fsoubes committed
141
  extendShinyjs(text = 'shinyjs.hideSidebar = function(params) { $("body").addClass("sidebar-collapse");
fsoubes's avatar
fsoubes committed
142
              $(window).trigger("resize"); }'),
fsoubes's avatar
fsoubes committed
143
  extendShinyjs(text='shinyjs.showSidebar = function(params) { $("body").removeClass("sidebar-collapse");
fsoubes's avatar
fsoubes committed
144
              $(window).trigger("resize"); }'),
fsoubes's avatar
fsoubes committed
145

fsoubes's avatar
fsoubes committed
146 147 148 149
  tags$style(HTML("
    .tabbable > .nav > li > a[data-value='hmpan'] {background-color: red;   color:white}
    .tabbable > .nav > li > a[data-value='cutpan'] {background-color: blue;  color:white}
  ")),
fsoubes's avatar
fsoubes committed
150

fsoubes's avatar
fsoubes committed
151 152 153 154 155 156 157 158 159 160 161 162 163 164
  inlineCSS(appCSS),
  includeCSS("./css/style.css"),
  div(
    id = "loading-content",
    br(),br(),
    br(),
    h2("Please wait while MATRiX is loading...")),
  div(
    id = "matrixapp",
  tabItems(
    tabItem(tabName = "Home",
            fluidRow(
              column(width=9,
                     div(style="width:100% ;max-width: 1500px; height: 1500px max-height: 2200px;",id = "homepage",
fsoubes's avatar
fsoubes committed
165

fsoubes's avatar
fsoubes committed
166 167 168 169
                         tabBox(title="Welcome to MATRiX", width=NULL,id = "homepage",

                                tabPanel("About", style = "background-color: #ffffff;",
                                         tags$h3("MATRiX is a shiny application for Microarray Analysis on Transcriptomic impact of Xenobiotics."),
fsoubes's avatar
fsoubes committed
170
                                         p("This project initiated by Yannick Lippi aims to facilitate access to biologist in order to publish graphs such as heatmap, PCA or Venn diagram related to specifics data produced by TRiX's facility.", tags$br(),"
fsoubes's avatar
fsoubes committed
171 172 173

MATRiX is an application dedicated to DNA chip analysis, this application incorporates quality control with Principal components analysis to summarizes microarray and differential analysis with various methods such as Venn diagram, Heatmap clustering and GO Enrichment analysis by querying the DWS (DAVID WEB SERVICES).",tags$br(),"

fsoubes's avatar
fsoubes committed
174
MATRiX app is working with specific data produced by the limma package, resulting p-values are adjusted according to the Benjamini and Hochberg procedure [Benjamini and Hochberg 1995]. PCA is computed with the FactoMineR package and the plot is produced with the factoextra package, for the Heatmap and Venn diagram the graphs are obtained respectively with the gplots and VennDiagram package, those packages are available on CRAN This application works only with specific data produced by the plateau TRiX, you can check the example file (MA_Trix_App/sampleData.zip)."),
fsoubes's avatar
fsoubes committed
175

fsoubes's avatar
fsoubes committed
176
                                         p("Hereafter is the global workflow passing by the statistical analysis to the visualization:"),tags$br(),
fsoubes's avatar
fsoubes committed
177
                                         div(id="workflow",
fsoubes's avatar
fsoubes committed
178
                                         tags$p(
fsoubes's avatar
fsoubes committed
179 180
                                           tags$img(src = "whatmaen.png",style="width: 100%; height: 100%"))
                                         )
fsoubes's avatar
fsoubes committed
181 182 183 184 185 186 187 188
                                         ),
                                tabPanel("Authors", h3("The main contributors to MATRiX:"),
                                         p(a("Yannick Lippi",href="mailto:yannick.lippi@inra.fr"), "(Initiator, beta-testing, feature suggestions)"),
                                         p(a("Franck Soubès", href="mailto:franck.soubes@inra.fr"), "(Coding, Unit testing, documentation, packaging, feature suggestions)",tags$a(href = "https://github.com/fsoubes",target="_blank",
                                                                                                                                                                                   "See github")),
                                         h3("Acknowledgements"),
                                         p("Thanks to the Toxalim's team BioToMyc & TIM and especially to the following people for their helps reporting errors, proposing new features and beta testing of MATRiX:"),
                                         p("Laura Costes,", "Anne Fougerat,","Claire Naylies,", "Philippe Pinton,","Arnaud Polizzi," ,"Marion Regnier," , "Sandrine Ellero-Simatos,","Sarra Smati."),
fsoubes's avatar
fsoubes committed
189
                                         p("Special Thanks to Didier Laborie for installing the virtual machine with Ubuntu and for answering my questions")
fsoubes's avatar
fsoubes committed
190

fsoubes's avatar
fsoubes committed
191 192 193
                                ),
                                tabPanel("Packages",
                                         tags$h3("If you are using MATRiX in your work, you can cite some of the packages by clicking on the link down below."),
fsoubes's avatar
fsoubes committed
194

fsoubes's avatar
fsoubes committed
195 196 197 198 199 200 201 202 203
                                         actionLink("session",
                                                    "Print version information about R, the OS and attached or loaded packages."),
                                         br(), br(), br(),
                                         DT::dataTableOutput("sessinfo")
                                ),
                                tabPanel("Support",
                                         tags$head(
                                           tags$style(
                                             "#entry {width: 100%;position: relative;left: 4%;}
fsoubes's avatar
fsoubes committed
204 205 206
              #users ul li {font-family: 'Inconsolata', cursive;font-weight: 500;line-height: 1.5;color: white;position: static;font-size: 18px;}
              #users a{color: red;} #users p{color:white;}")),

fsoubes's avatar
fsoubes committed
207
                                         includeCSS("www/shinychat.css"),
fsoubes's avatar
fsoubes committed
208

fsoubes's avatar
fsoubes committed
209 210 211 212 213 214 215 216
                                         # And custom JavaScript -- just to send a message when a user hits "enter"
                                         # and automatically scroll the chat window for us. Totally optional.
                                         includeScript("www/sendOnEnter.js"),
                                         fluidRow(
                                           column(width=9,
                                                  div( style = "width:100% ; max-width: 1200px; height: 500px",
                                                       #tags$h2("Support client"),
                                                       div(
fsoubes's avatar
fsoubes committed
217
                                                         class = "row-fluid",
fsoubes's avatar
fsoubes committed
218 219
                                                         # Create a spot for a dynamic UI containing the chat contents.
                                                         uiOutput("chat"),
fsoubes's avatar
fsoubes committed
220

fsoubes's avatar
fsoubes committed
221 222 223 224 225 226 227 228 229 230
                                                         # Create the bottom bar to allow users to chat.
                                                         fluidRow(
                                                           div(class="span8",
                                                               textInput("entry", "")
                                                           ),
                                                           div(class="span2 center",
                                                               actionButton("send", "Send")
                                                           )
                                                         )
                                                       )))
fsoubes's avatar
fsoubes committed
231 232

                                )),
fsoubes's avatar
fsoubes committed
233 234 235 236
                                tabPanel("Video",
                                         div( id="video",
                                         fluidRow(
                                           column(8, align="center", offset = 2,
fsoubes's avatar
fsoubes committed
237
                                         tags$iframe(src = "https://www.youtube.com/embed/lfI0zRYzeJs?vq=hd1080", width="960", height="540", align= "middle", frameborder="0",allowfullscreen ="1" )
fsoubes's avatar
fsoubes committed
238 239 240 241 242 243
                                         ))))

                                ))),
              column(width=3,
                     div(id="pass",style = "word-wrap: break-word;",
                         box(id="boxpass",title = strong("Session information", style="font-size:25px;"), width = NULL, background = "light-blue",
fsoubes's avatar
fsoubes committed
244

fsoubes's avatar
fsoubes committed
245 246 247 248 249 250 251 252 253 254 255 256
                             # The right sidebar
                             # Let the user define his/her own ID
                             textInput("user", "Your User ID:", value=""),
                             tags$hr(),
                             h5("Connected Users"),
                             # Create a spot for a dynamic UI containing the list of users.
                             div(id ="users",
                                 uiOutput("userList"),
                                 tags$hr(),
                                 #helpText(HTML("<p>Built using R & <a href = \"http://rstudio.com/shiny/\">Shiny</a>.<p>Source code available <a href =\"https://github.com/trestletech/ShinyChat\">on GitHub</a>.")),
                                 p("Built using R and" ,tags$a(href = "http://rstudio.com/shiny/",target="_blank",
                                                               "Shiny")),
fsoubes's avatar
fsoubes committed
257
                                 p("Chat source code is available ",
fsoubes's avatar
fsoubes committed
258 259 260 261
                                   tags$a(href = "https://github.com/trestletech/ShinyChat",target="_blank",
                                          "here"))
                             ))
                     ),
fsoubes's avatar
fsoubes committed
262

fsoubes's avatar
fsoubes committed
263 264
                     box(
                       title = "What's new in MATRiX", width = NULL, status = "primary",
fsoubes's avatar
fsoubes committed
265
                       div(style = 'overflow-y: scroll; height: 500px',
fsoubes's avatar
fsoubes committed
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
                           addNews("Nov 30th 2018", "MATRiX", "Add tootlip for distance, its now possible to export acyclic graph in pdf and eps, correct bugs for classification enrichment with 0 nodes by inactivating donwload button"),
                           addNews("Nov 29th 2018", "Venn Diagram/HTML", "Correct bugs now venn diagram table is based on genes and not probes."),
                           addNews("Npv 5th 2018", "Venn Diagram", "Remove non annotated genes."),
                           addNews("Oct 19th 2018", "Volcano plot", "Search group of genes based on regular expression."),
                           addNews("Oct 15th 2018", "Venn Diagram", "Change the library to Jvenn."),
                           addNews("Aug 15th 2018", "Presentation/Video", "Added a video to present MATRiX and add modules to import files."),
                           addNews("Aug 10th 2018", "Upload/Volcano", "You can explore your different comparisons with a volcano plot."),
                           addNews("Aug 6th 2018", "Venn Diagram/Enrichment", "Add acyclic graph if download."),
                           addNews("Aug 4th 2018", "Heatmap/Bubble graph", "You can display or not the labels within the bubbles."),
                           addNews("Aug 3th 2018", "Heatmap/Go(Analysis)", "You can now plot a bubble graph (Highcharts) that summarizes the top categories from the resulting datatable."),
                           addNews("Jul 28th 2018", "Home/Support", "You can asks your questions directly in the Support."),
                           addNews("Jul 25th 2018", "Tutorial/Video", "Soon will be added a video to summarise the application."),
                           addNews("Jul 20th 2018", "New page", "Add a Home page regrouping informatios about the app."),
                           addNews("Jul 16th 2018", "Venn" ,"You can now choose your color for the venn diagram."),
                           addNews("Jul 16th 2018","Bug fixes","Venn diagram display erros when filtering."),
                           addNews("Jul 5th 2018","Venn/DAVID","Add Gene functionnal classification for selected intersection(s)."),
fsoubes's avatar
fsoubes committed
282
                           addNews("Jun 26th 2018","Add features","It's now possible to interact with the rendering table to filter the table in the aim of plotting the top n genes.
fsoubes's avatar
fsoubes committed
283
                          For the GO enrichment it is now possible to select the rows in order to display the gene symbol according to the entrez ids."),
fsoubes's avatar
fsoubes committed
284
                           addNews("Jun 22th 2018","Bug fixes","For two contrasts the venn.draw function was not ordering the contrast names in the right order."),
fsoubes's avatar
fsoubes committed
285 286
                           addNews("Jun 20th 2018","MATRiX","First public release of MATRiX.
                                                              Enhancement of the gui with the use of dashboard package."),
fsoubes's avatar
fsoubes committed
287 288 289
                           addNews("Jun 18th 2018","GO enrichment","It is now possible to query the DWS for the Heatmap and save the result in xlsx format for the different clusters"),
                           addNews("Jun 15th 2018","DNS ","Adding DNS for the MATRiX application (matrix.toulouse.inra.fr)"),
                           addNews("Jun 10th 2018","Venn diagram","The venn diagram FC and display of the top n genes
fsoubes's avatar
fsoubes committed
290 291
                                                                have been added to compare the results of 2 or more contrasts."),
                           addNews("Jun 5th 2018","PCA/Heatmap","Display color groups side by side in the gui."),
fsoubes's avatar
fsoubes committed
292 293 294
                           addNews("May 29th 2018","beta-test","The service will be made available once the beta test phase is officially completed.")
                       )
                     )
fsoubes's avatar
fsoubes committed
295

fsoubes's avatar
fsoubes committed
296 297 298
              )
            )
            ),
fsoubes's avatar
fsoubes committed
299

fsoubes's avatar
fsoubes committed
300 301 302 303 304
    tabItem(tabName = "Upload",
            bsAlert("alert"),
            tags$style(type='text/css', ".well { max-width: 2em; }"),
            fluidRow(
              tags$head(
fsoubes's avatar
fsoubes committed
305
                tags$style(type="text/css", ".myslidermain .irs-grid-text {bottom: 5px;color: #333;}
fsoubes's avatar
fsoubes committed
306
      .myslidermain .irs-min{color: #333;font-size: 10px;line-height: 1.333;text-shadow: none;top: 0;padding: 1px 3px;
fsoubes's avatar
fsoubes committed
307
      background: rgba(0,0,0,0.1);border-radius: 3px;-moz-border-radius: 3px}
fsoubes's avatar
fsoubes committed
308 309 310 311 312 313 314
      .myslidermain .irs-max{color: #333;font-size: 10px;line-height: 1.333;text-shadow: none;top: 0;padding: 1px 3px;
      background: rgba(0,0,0,0.1);border-radius: 3px;-moz-border-radius: 3px}")
              ),
              #div(style = "width:100% ; max-width: 1500px; height: 1500px max-height: 2200px;",
              column(width=9,
                div( style = "width:100% ; max-width: 1500px; height: 1500px max-height: 2200px;" , id = "upload",
                     tabBox(title="Upload your data", width=NULL,id = "upload",
fsoubes's avatar
fsoubes committed
315

fsoubes's avatar
fsoubes committed
316 317 318 319 320 321
                            tabPanel("Import your data", style = "background-color: #ffffff;",
                            conditionalPanel(condition = 'output.boolmark', #Hide or Show event depending on the loading data success or failure
                                             #includeMarkdown("markdown/help.md")
                                             tags$h1("How to import ?"),
                                             tags$ul(
                                               tags$li("First click on the browse button to load the data"),
fsoubes's avatar
fsoubes committed
322
                                               tags$li("After the pop up has appeared, you will have to select the files within the access path that is given in the report produced by GeT-TRiX. "),
fsoubes's avatar
fsoubes committed
323
                                               tags$li("You will then find three distinct csv files, these files are respectively named xxx_pData, xxx_WorkingSet and xxx_ResTable."),
fsoubes's avatar
fsoubes committed
324 325 326 327 328
                                               tags$li("The final step consist to select all the data at once and then confirm the selection by clicking on the open button."),
                                               tags$li("A green message will then appear to confirm the data loading with a summary table.")
                                             ),

                                               tags$p(
fsoubes's avatar
fsoubes committed
329

fsoubes's avatar
fsoubes committed
330
                                                tags$img(src = "pdata.png"),
fsoubes's avatar
fsoubes committed
331
                                                tags$img(src = "wotkingset.png"),
fsoubes's avatar
fsoubes committed
332
                                                 tags$img(src = "restable.png")
fsoubes's avatar
fsoubes committed
333

fsoubes's avatar
fsoubes committed
334
                                                 ),
fsoubes's avatar
fsoubes committed
335 336 337 338

                                             tags$h1("Tips"),
                                             tags$ul(
                                               tags$li("You can select a region by handling the left click button if the files are stacked together, if it's not the case you can select the different files by maintening the Ctrl button and clicked on the files.")
fsoubes's avatar
fsoubes committed
339
                                             ),
fsoubes's avatar
fsoubes committed
340 341 342 343 344 345 346
                                             tags$h1("Warning"),
                                             tags$ul(
                                               tags$li("It is highly recommanded to not modify these files (removed columns, change column names ...) in the aim of not disturbing the well functionning of the application.")
                                             )
                                             ,ns = NS("datafile")
                                             ),
                            conditionalPanel(condition = '!output.boolmark',
fsoubes's avatar
fsoubes committed
347

fsoubes's avatar
fsoubes committed
348
                            textOutput("myFileName"),
fsoubes's avatar
fsoubes committed
349

fsoubes's avatar
fsoubes committed
350 351 352 353 354 355 356 357 358 359
                            column(12, h3(
                                "This table summarizes the number of significant genes depending on the p-value treshold choosen with the slider bar"
                              ),
                              helpText("Choose your p-value treshold to modify the following data table"),
                              div( class= "myslidermain",
                              sliderInput("pval1","",min = 0.01,max = 0.05,value = 0.05,step = 0.01,
                                width = "500"
                              ),
                              dataTableOutput("data_summary") # render a renderTable or renderDataTable within an application page
                            )),
fsoubes's avatar
fsoubes committed
360

fsoubes's avatar
fsoubes committed
361 362 363 364 365
                            column(12,
                              h3("This table shows the samples with the corresponding groups"),
                              dataTableOutput("new_test")
                            )
                            ,ns = NS("datafile")
fsoubes's avatar
fsoubes committed
366

fsoubes's avatar
fsoubes committed
367
                   )),
fsoubes's avatar
fsoubes committed
368
                     tabPanel("Volcano plot",value="volcano", style = "background-color: #ffffff;",
fsoubes's avatar
fsoubes committed
369
                              conditionalPanel(condition = '!output.boolmark',
fsoubes's avatar
fsoubes committed
370
                             div(style="display:inline-block;",
fsoubes's avatar
fsoubes committed
371 372 373 374 375 376 377 378 379 380
                              fluidRow(column(3, style="width:33.5%;",
                              downloadButton("savevolcano", "Save your Volcano plot" , style =
                                               "color: #fff; background-color: #337ab7; border-color: #2e6da4")),
                              column( 3, style="width:20%;",
                                      selectInput(
                                        "formvolc",label = NULL,
                                        choices = c("png", "eps", "pdf")))))
                              ),
                              plotOutput(outputId = "volcanoplot", height = 900)
                   )
fsoubes's avatar
fsoubes committed
381
            ))),
fsoubes's avatar
fsoubes committed
382 383 384 385 386
            div(id="pass",style = "word-wrap: break-word;",
            column(width = 3,
            box(id="boxpass",title = strong("Upload data", style="font-size:25px;"), width = NULL, background = "light-blue",
                inlineCSS(list(.pwdGREEN = "background-color: #DDF0B3",.pwdRED = "background-color: #F0B2AD")),

fsoubes's avatar
fsoubes committed
387

fsoubes's avatar
fsoubes committed
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
                downloadLink("downloadData", label = "download sample data", style="color:red; float:right;"),
                br(),br(),
                csvFileInput("datafile", "User data (.csv format)"),
                p("Import local example",style="color:white; font-weight: 700; font-size: 14px;"),
                dirModuleUI("datafile"),

                #csvFileInput("file", "Choose your csv files"),
                # fileInput(
                #   "file",
                #   "Choose your csv files",
                #   accept = c("text/csv","text/comma-separated-values,text/plain",".csv"
                #   ),
                #   multiple = T # Attribute to load multiple data at once
                # ),
                br(),
fsoubes's avatar
fsoubes committed
403

fsoubes's avatar
fsoubes committed
404 405 406 407 408 409
              conditionalPanel(condition = '!output.boolmark',
                selectInput(
                  "method","Choose your statistical method",choices = c("adj.p.val (FDR)" = "FDR", "p.value (raw)" = "None")),
                strong("VOLCANO plot",style="font-size:18px;"),
                br(),br(),
              uiOutput("compvolc"),
fsoubes's avatar
fsoubes committed
410
              div(id = "mytextvolc",
fsoubes's avatar
fsoubes committed
411 412
                  p(" Highlight your selected gene(s) in the volcano plot with a comma-separated list of input ")
                  ),
fsoubes's avatar
fsoubes committed
413

fsoubes's avatar
fsoubes committed
414 415 416
              textInput(inputId = "fillvolc",label = NULL,value = "",
                        placeholder = "FOXP2,OT,AVPR1a",width = "100%"
              ),
fsoubes's avatar
fsoubes committed
417
              div(id = "mytextvolcgrep",
fsoubes's avatar
fsoubes committed
418 419
                  p(" Highlight a family of gene in the volcano plot")
              ),
fsoubes's avatar
fsoubes committed
420

fsoubes's avatar
fsoubes committed
421 422
              textInput(inputId = "findfamily",label = NULL,
                        placeholder = "Cyp",width = "100%"),
fsoubes's avatar
fsoubes committed
423 424 425 426
              numericInput(
                'topvolc',
                'Maximal number of genes by comparison(s)',
                NULL,min = 0,max = 5000),
fsoubes's avatar
fsoubes committed
427 428
              fluidRow(column(6, sliderInput('volcfc', "Choose your FC cutoff",min = 1, max=10, step = 1,value=1)),
                       column(6,sliderInput('volcpval', "Choose your pval cutoff", min=0.01, max=0.05, step=0.01,value=0.05))),
fsoubes's avatar
fsoubes committed
429 430
              fluidRow(column(6, sliderInput('volclab', "Choose your lab size",min = 1, max=6, step = 0.5,value=3.0)),
                       column(6,sliderInput('volcpt', "Choose your point size", min=0.5, max=3, step=0.1,value=1))),
fsoubes's avatar
fsoubes committed
431 432
              
              ns = NS("datafile")
fsoubes's avatar
fsoubes committed
433
                ))
fsoubes's avatar
fsoubes committed
434 435 436 437 438 439 440
              )
            ),
            conditionalPanel(condition = '!output.boolmark',
            column(12,
                    h3("Show the actual data frame with the columns selected"),
                    dataTableOutput("new_group")
            ),ns = NS("datafile"))
fsoubes's avatar
fsoubes committed
441 442


fsoubes's avatar
fsoubes committed
443
            )),
fsoubes's avatar
fsoubes committed
444

fsoubes's avatar
fsoubes committed
445 446
  ###############################
  ######## PCA page             #
fsoubes's avatar
fsoubes committed
447 448
  ###############################

fsoubes's avatar
fsoubes committed
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471
    tabItem(tabName = "PCA",
            tags$style(type='text/css', ".well { max-width: 20em; }"),
            tags$style(type='text/css', ".well { max-height: 50em; }"),
            fluidRow(column(
              width = 9,
              div(style = "width:100% ; max-width: 1500px; height: 1500px max-height: 2200px;",
                #style = "width:100% ; max-width: 1200px; height: 1050px",
                #tabBox(title="PCA, width=NULL,id = "homepage",
                tabsetPanel(
                  #title = "Principal component analysis",
                  #id = "tabset1",
                  #width = NULL,
                  tabPanel(
                    strong("Scree plot"),
                    downloadButton("savescre", "Save your Scree plot" , style =
                                     "color: #fff; background-color: #337ab7; border-color: #2e6da4"),

                    br(),br(),
                    plotOutput(outputId = "eigpca", height = 700)
                  ),
                  tabPanel(
                    strong("PCA plot"),
                    tags$style(type = "text/css",".shiny-output-error:before { visibility: hidden; }"),
fsoubes's avatar
fsoubes committed
472 473


fsoubes's avatar
fsoubes committed
474 475 476 477 478
                    div(style="display:inline-block;",
                        fluidRow( column(1 ,
                                         downloadButton("savepca", "Save your PCA" , style =
                                                          "color: #fff; background-color: #337ab7; border-color: #2e6da4")),
                                  column(2),
fsoubes's avatar
fsoubes committed
479
                                  column( 3,
fsoubes's avatar
fsoubes committed
480 481 482
                                          selectInput(
                                            "formpca",label = NULL,
                                            choices = c("png", "eps", "pdf")))
fsoubes's avatar
fsoubes committed
483

fsoubes's avatar
fsoubes committed
484
                        )),
fsoubes's avatar
fsoubes committed
485

fsoubes's avatar
fsoubes committed
486 487
                    plotOutput(outputId = "PCA", height = 700)
                  )
fsoubes's avatar
fsoubes committed
488

fsoubes's avatar
fsoubes committed
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
                )
              )
            ),
            div(id="pass",style = "word-wrap: break-word;",
                column(width=3,
                       box(id="boxpasspca",title = strong("PCA settings",style="font-size:25px;"), width = NULL, background = "light-blue",
                           inlineCSS(list(.pwdGREEN = "background-color: #DDF0B3",.pwdRED = "background-color: #F0B2AD")),
                           strong("Choose your group to visualize"),
                          uiOutput("individuselpca"),
                  actionButton(
                    inputId = "allIndividuspca",label = "Select all",
                    icon = icon("check-square-o"),
                    style ="color: #fff; background-color: #337ab7; border-color: #2e6da4"
                  ),
                  actionButton(
                    inputId = "noIndividuspca",label = "Clear selection",icon = icon("square-o"),
                    style ="color: #fff; background-color: #337ab7; border-color: #2e6da4"
                  ),
fsoubes's avatar
fsoubes committed
507 508


fsoubes's avatar
fsoubes committed
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
                  fluidRow(column(6,
                    selectInput("dim1",
                      label = h6(gettext("x axis")),
                      choices = list(
                        "Dim 1" = 1,
                        "Dim 2" = 2,
                        "Dim 3" = 3,
                        "Dim 4" = 4,
                        "Dim 5" = 5
                      ),
                      selected = firstdim
                      #width = '80%'
                    )
                  ),
                  column(6,
                    selectInput("dim2",
                      label = h6(gettext("y axis")),
                      choices = list(
                        "Dim 1" = 1,
                        "Dim 2" = 2,
                        "Dim 3" = 3,
                        "Dim 4" = 4,
                        "Dim 5" = 5
                      ),
                      selected = secdim
                    )
                  )),
                  fluidRow(
                    column(4,
                           checkboxInput("label", "Add labbels names", TRUE)),
                    column(4,
                           checkboxInput("meanpoint", "Add mean points", TRUE)),
                    column(4,
                           checkboxInput("ellipse", "Add ellipses", FALSE))#,
                  ),

                  fluidRow(column(3),
                  column(8,checkboxInput("jitter", "Avoid overlap between points", FALSE))),
                  verbatimTextOutput("valued"),
fsoubes's avatar
fsoubes committed
548

fsoubes's avatar
fsoubes committed
549 550 551
                  sliderInput(
                    "labelsiize","Label size",min = 2,max = 6,value = 4,step = 1
                  ),
fsoubes's avatar
fsoubes committed
552

fsoubes's avatar
fsoubes committed
553 554
                  sliderInput("pointsiize","Point size",min = 2,max = 6,value = 2,step = 1
                  ),
fsoubes's avatar
fsoubes committed
555

fsoubes's avatar
fsoubes committed
556 557
                  uiOutput('myPanelpca'),
                  br()
fsoubes's avatar
fsoubes committed
558
            ))))),
fsoubes's avatar
fsoubes committed
559 560
  ###############################
  ######## Venn Page            #
fsoubes's avatar
fsoubes committed
561 562 563
  ###############################


fsoubes's avatar
fsoubes committed
564
    tabItem(tabName = "Venn",
fsoubes's avatar
fsoubes committed
565

fsoubes's avatar
fsoubes committed
566
            tags$style(type='text/css', ".well { max-width: 25em; }"),
fsoubes's avatar
fsoubes committed
567
            tags$style(type='text/css', ".well { max-height: 70em; }"),
fsoubes's avatar
fsoubes committed
568 569 570
            fluidRow(column(
              width = 9,
              div(
fsoubes's avatar
fsoubes committed
571
                style = "width:100% ; max-width: 1500px; height: 1780px; max-height: 2800px;",
fsoubes's avatar
fsoubes committed
572
                tabsetPanel(
fsoubes's avatar
fsoubes committed
573
                id = "Vennd",
fsoubes's avatar
fsoubes committed
574 575 576 577

                  tabPanel(
                    value= "vennset",
                    strong("Visualize the Venn diagram"),
fsoubes's avatar
fsoubes committed
578

fsoubes's avatar
fsoubes committed
579 580 581 582 583 584 585 586 587 588 589 590
                    div(style="display:inline-block",
                        fluidRow(column(3, style= "width:14.2%;",

                                        downloadButton('downloadvenn', "Download the data",
                                                       style =
                                                         "color: #fff; background-color: #337ab7; border-color: #2e6da4")),
                                 column(3, style="width:14.2%;",
                                        downloadButton("downloadsetven", "Download venn set" , style =
                                                         "color: #fff; background-color: #337ab7; border-color: #2e6da4")),
                                 column(3, style="width:11.8%;",
                                        downloadButton("savevenn", "Save your plot" , style =
                                                         "color: #fff; background-color: #337ab7; border-color: #2e6da4")),
fsoubes's avatar
fsoubes committed
591

fsoubes's avatar
fsoubes committed
592 593 594 595 596 597 598
                                     column(3,style="width:10%;", selectInput(
                                       "formven",label = NULL,
                                       choices = c("png", "eps", "pdf"))),
                                 column(3 ,style="width:5%;"),
                                 column(3,
                                        downloadButton('downloadvennset', "Download the filtered data",
                                                style ="color: #fff; background-color: #337ab7; border-color: #2e6da4;"))
fsoubes's avatar
fsoubes committed
599

fsoubes's avatar
fsoubes committed
600 601 602 603 604
                        )),

                    conditionalPanel(condition = '!output.bool',
                                     uiOutput(outputId = "image")
                                     , uiOutput("sorry")),
fsoubes's avatar
fsoubes committed
605 606
                    #tags$script(src="libraries/bootstrap.min.js") ,
                    tags$script(src="libraries/prettify.js") ,
fsoubes's avatar
fsoubes committed
607 608
                    tags$script(src="libraries/jvenn.min.js")  ,
                    tags$script(src="libraries/canvas2svg.js")  ,
fsoubes's avatar
fsoubes committed
609
                    tags$script(src="tooltip.js"),
fsoubes's avatar
fsoubes committed
610 611
                    fluidRow(column(6,br(),br(),
                    tags$script(src="jvenn.js"),
fsoubes's avatar
fsoubes committed
612 613
                    tags$div(id="jvenn-container", style = "background-color: white;  width: 600px;")

fsoubes's avatar
fsoubes committed
614 615 616 617
                    ),
                    column(6,
                           div(class= "dfvenn" , style="font-size:24px; margin-top: 17px;",
                               htmlOutput("dfvenn")),
fsoubes's avatar
fsoubes committed
618
                  conditionalPanel(condition = "input.dispvenn == 'genes'",
fsoubes's avatar
fsoubes committed
619
                           helpText(
fsoubes's avatar
fsoubes committed
620
                             "You can directly filter the table by fold change and save the output table"
fsoubes's avatar
fsoubes committed
621
                           )),
fsoubes's avatar
fsoubes committed
622

fsoubes's avatar
fsoubes committed
623
                           DT::dataTableOutput("vennresinter"),br(),br(),br(),
fsoubes's avatar
fsoubes committed
624
                           conditionalPanel(condition = "input.selcontjv",
fsoubes's avatar
fsoubes committed
625 626
                                            div(class= "dfvennbef" , style="font-size:24px; margin-top: -28px; "))

fsoubes's avatar
fsoubes committed
627 628 629 630
                    )),
                           div(style="display:inline-block", id ="dontwanttoshow",
                               fluidRow(
                                 tags$head(
fsoubes's avatar
fsoubes committed
631
                                   tags$style(type="text/css", ".topgeness label{ display: table-cell; text-align: left; vertical-align: middle; }
fsoubes's avatar
fsoubes committed
632 633
                 .inline .form-group{display: table-row;} ")
                                 ),
fsoubes's avatar
fsoubes committed
634
                                 column(3,br(),style= "width:21%;",
fsoubes's avatar
fsoubes committed
635 636 637 638 639 640
                                        actionButton(
                                          inputId = "topdegenes",
                                          label = "Plot top DE genes",
                                          style =
                                            "color: #fff; background-color: #337ab7; border-color: #2e6da4"
                                        )),
fsoubes's avatar
fsoubes committed
641
                                 column(3, style= "width:26.0%;",br(),
fsoubes's avatar
fsoubes committed
642

fsoubes's avatar
fsoubes committed
643 644
                                        downloadButton("savebarplot", "Save your barplot" , style =
                                                         "color: #fff; background-color: #337ab7; border-color: #2e6da4")),
fsoubes's avatar
fsoubes committed
645
                                 column(3 ,br(),style= "width:11%;  padding: 0%;",
fsoubes's avatar
fsoubes committed
646 647
                                        selectInput( "formvenbar",label = NULL,
                                                     choices = c("png", "eps", "pdf"))),
fsoubes's avatar
fsoubes committed
648 649 650

                                 column(3,style= "width:9%; padding: 0%;",

fsoubes's avatar
fsoubes committed
651 652
                                        uiOutput("topgenesvenn", style= "padding: 0px;font-weight: 400;top: 0px;
                                                 right: -22px;left: 0px;color: #3c8dbc;position: absolute;"))
fsoubes's avatar
fsoubes committed
653
                               )),
fsoubes's avatar
fsoubes committed
654 655 656 657
                   plotOutput(outputId ="barplotvenn", height = "500px", width ="100%"),
                    #plotOutput(outputId ="barplotvenn", height = "auto"),
                   br(),
                   ##includeHTML("HTML/colorandname.html"),
fsoubes's avatar
fsoubes committed
658

fsoubes's avatar
fsoubes committed
659 660 661 662
                   h1("Here's a tracker for your different selections:"),
                   tags$head(
                     tags$link(rel = "stylesheet", type = "text/css", href = "style.css") # add style.css in order to add better police
                   ),
fsoubes's avatar
fsoubes committed
663 664 665
                   # tags$head(
                   #   tags$link(rel = "stylesheet", type = "text/css", href = "bootstrap-responsive.css") # add style.css in order to add better police
                   # ),
fsoubes's avatar
fsoubes committed
666 667 668 669
                   tags$head(tags$style("
                                        #container * {
                                        display: inline;
                                        }")),
fsoubes's avatar
fsoubes committed
670

fsoubes's avatar
fsoubes committed
671 672 673 674
                   tags$head(tags$style("#mytext p{font-weight: 500;font-size: 17px;line-height: 1.5;color: white;
                                        position: static;}
                                        #mytext a{color: red;}"
                                        )),
fsoubes's avatar
fsoubes committed
675

fsoubes's avatar
fsoubes committed
676 677 678 679 680 681 682 683 684 685
                   div(
                     id = "container",
                     p("You have chosen the following comparisons"),
                     htmlOutput("contvenn"),
                     p("for a total of"),
                     htmlOutput("totalgenes"),
                     p("genes  with a P-value and FC treshold respectively set to "),
                     htmlOutput("myPVALvenn"),
                     p("and"),
                     htmlOutput("myFCvenn")
fsoubes's avatar
fsoubes committed
686

fsoubes's avatar
fsoubes committed
687 688 689 690 691 692 693 694 695 696 697 698
                   ),
                   div(
                     id = "container",
                     p("There are"),
                     htmlOutput("venngenes"),
                     p("significant genes"),
                     p("for this intersection"),
                     htmlOutput("continter"),
                     p("if you click on the top DE genes button you will plot the top"),
                     htmlOutput("topgenesdf"),
                     p("rows the of the previous table")
                   )
fsoubes's avatar
fsoubes committed
699

fsoubes's avatar
fsoubes committed
700
                  ),
fsoubes's avatar
fsoubes committed
701 702


fsoubes's avatar
fsoubes committed
703
                tabPanel(strong("Venn GO enrichment"),
fsoubes's avatar
fsoubes committed
704 705
                            value = "venngopanel",
                            useShinyjs(),
fsoubes's avatar
fsoubes committed
706

fsoubes's avatar
fsoubes committed
707 708 709 710 711 712
                                fluidRow( column(6 ,
                                                 downloadButton(
                                                   "saveclusterchoose",
                                                   "Download the graph" ,
                                                   style =  "color: #fff; background-color: #337ab7; border-color: #2e6da4"
                                                 ),
fsoubes's avatar
fsoubes committed
713
                                          column( 3,
fsoubes's avatar
fsoubes committed
714 715 716
                                                  selectInput(
                                                    "formvennclus",label = NULL,
                                                    choices = c("png", "eps", "pdf")))
fsoubes's avatar
fsoubes committed
717

fsoubes's avatar
fsoubes committed
718
                                )),
fsoubes's avatar
fsoubes committed
719 720


fsoubes's avatar
fsoubes committed
721 722 723
                          plotOutput("clusterPlot", width = "100%", height = "700px"),
                          br(),br(),br(),
                          #plotOutput("acyclicgo", width = "100%", height = "1200px"),
fsoubes's avatar
fsoubes committed
724 725
                          #verbatimTextOutput("debug")
                         dataTableOutput("debug")
fsoubes's avatar
fsoubes committed
726
                 )
fsoubes's avatar
fsoubes committed
727

fsoubes's avatar
fsoubes committed
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742
                )
              )
            ),
            div(id="pass",style = "word-wrap: break-word;",
                column(width=3,
                       box(id="boxpassvenn",title = strong("Venn settings", style ="font-size:25px;"), width = NULL, background = "light-blue",height = "100%",
                           inlineCSS(list(.pwdGREEN = "background-color: #DDF0B3",.pwdRED = "background-color: #F0B2AD")),
                           uiOutput("contout"),
                           actionButton(
                             inputId = "allCont",
                             label = "Select all",
                             icon = icon("check-square-o"),
                             style =
                               "color: #fff; background-color: #337ab7; border-color: #2e6da4"
                           ),
fsoubes's avatar
fsoubes committed
743

fsoubes's avatar
fsoubes committed
744 745 746 747 748 749 750 751 752 753 754 755
                          actionButton(inputId = "noCont",label = "Clear selection",
                          icon = icon("square-o"),
                          style ="color: #fff; background-color: #337ab7; border-color: #2e6da4"
                           ),
                           fluidRow(column(6,
                           selectInput("methodforvenn","Statistical method",
                             choices = c("adj.p.val (FDR)"= "FDR", "p.value (raw)" = "None")
                           )),
                          column(6,
                          selectInput("regulation", #  Create a select list that can be used to choose a single or multiple items from a list of values.
                                                "Choose your regulation",
                                                choices = c("both","up", "down")))),
fsoubes's avatar
fsoubes committed
756
                          div(id = "mytext",
fsoubes's avatar
fsoubes committed
757 758 759 760 761 762
                           p("A comma-separated list of ",
                                tags$a(href = "https://stat.columbia.edu/~tzheng/files/Rcolor.pdf",target="_blank",
                                  "x11"),
                                "or",
                                tags$a(href = "https://en.wikipedia.org/wiki/Web_colors#Hex_triplet",target="_blank",
                                  "hex colors."))),
fsoubes's avatar
fsoubes committed
763

fsoubes's avatar
fsoubes committed
764
                           textInput(inputId = "fill",label = NULL,value = c( "green,blue,red,purple,orange,brown"),
fsoubes's avatar
fsoubes committed
765 766
                             placeholder = "grey70, white, steelblue4",width = "100%"
                           ),
fsoubes's avatar
fsoubes committed
767

fsoubes's avatar
fsoubes committed
768 769 770 771 772 773 774 775 776 777
                           fluidRow( column(6,
                                            sliderInput("pvalvenn","P-value treshold",
                                              min = 0.01,max = 0.05,
                                              value = 0.05,step = 0.01
                                            )),
                                     #br(),
                                     column(6,
                                            sliderInput("fcvenn","FC treshold",min = 1, max = 10,
                                              value = 1,step = 1
                                            ))),
fsoubes's avatar
fsoubes committed
778
                           br(),
fsoubes's avatar
fsoubes committed
779

fsoubes's avatar
fsoubes committed
780 781
                           fluidRow(
                             column(12,
fsoubes's avatar
fsoubes committed
782 783
                                  selectInput("dispvenn", #  Create a select list that can be used to choose a single or multiple items from a list of values.
                                              "Choose if you want to display probes or genes",
fsoubes's avatar
fsoubes committed
784
                                              choices = c("probes", "genes"))),
fsoubes's avatar
fsoubes committed
785
                           column(6,
fsoubes's avatar
fsoubes committed
786
                                  checkboxInput("Notanno","Remove the genes that are not annotated",FALSE)),
fsoubes's avatar
fsoubes committed
787 788 789
                           column(6,
                                  checkboxInput("Allcont","Show the logFC for all comparisons",FALSE))),

fsoubes's avatar
fsoubes committed
790 791 792 793 794 795 796 797
                           br(),
                          shiny::actionButton(
                            "toggleAdvancedJvenn",
                            "Advanced Jvenn Options",
                            href = "#",
                            style = "color: #fff; background-color: #337ab7; border-color: #2e6da4"
                          ),
                          br(),
fsoubes's avatar
fsoubes committed
798

fsoubes's avatar
fsoubes committed
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813
                          shinyjs::hidden(div(
                            id = "advancedjvenn",
                            br(),

                            fluidRow(
                              column(6,
                                     p("Select your Type of Venn",style="color:white; font-weight: 700; font-size: 14px;"),
                                     includeHTML("HTML/jvenntype.html")),
                              column(6,
                                     p("Display the stat",style="color:white; font-weight: 700; font-size: 14px;"),
                                     includeHTML("HTML/displaystat.html"))),
                            br(),
                             p("Police's size", style="color:white; font-weight: 700; font-size: 14px;"),
                              includeHTML("HTML/fontsize.html"),
                            br(),
fsoubes's avatar
fsoubes committed
814 815
                            fluidRow(
                              column(6,
fsoubes's avatar
fsoubes committed
816
                               p("Find an element in list(s)",style="color:white; font-weight: 700; font-size: 14px;"),
fsoubes's avatar
fsoubes committed
817 818 819 820 821 822
                             includeHTML("HTML/seekgene.html")),
                             column(6,
                              p("Display switch",style="color:white; font-weight: 700; font-size: 14px;"),
                            includeHTML("HTML/dispswitch.html")))


fsoubes's avatar
fsoubes committed
823 824 825
                            )),
                          br(),

fsoubes's avatar
fsoubes committed
826

fsoubes's avatar
fsoubes committed
827
                      strong("Functional Annotation Clustering",style = "font-family: 'times'; font-size:20px; font-style: strong; "),
fsoubes's avatar
fsoubes committed
828

fsoubes's avatar
fsoubes committed
829
                      br(),br(),
fsoubes's avatar
fsoubes committed
830
                      fluidRow(column(6, sliderInput("clusterNumber",label = "Cluster",
fsoubes's avatar
fsoubes committed
831 832
                                                          value = 1, min = 1,max = 5
                      )),
fsoubes's avatar
fsoubes committed
833 834
                      column(6,
                      selectInput("Speciesvenn", "Choose your Species:", selected = "Mus musculus",
fsoubes's avatar
fsoubes committed
835
                                  c("Mouse" = "Mus musculus", "Human" = "Homo sapiens", "Rat" = "Rattus norvegicus", "C. elegans" = "Caenorhabditis elegans",
fsoubes's avatar
fsoubes committed
836
                                    "Zebrafish" = "Danio rerio",  "Pig" = "Sus scrofa",
fsoubes's avatar
fsoubes committed
837 838
                                    "Chicken" = "Gallus gallus", "Chimpanzee" = " Pan troglodytes" )))),
                      fluidRow(
fsoubes's avatar
fsoubes committed
839 840 841 842 843
                        column(6,selectInput("catvenn", "Choose your category", selected ="BP", c("BP","MF","CC"))),

                      column(6,br(),
                      actionButton("GOvenn", "Run Analysis",style = "color: #fff; background-color: #337ab7; border-color: #2e6da4")))

fsoubes's avatar
fsoubes committed
844 845 846 847 848
                       ))))),

  ###############################
  ######## Heatmap Page         #
  ###############################
fsoubes's avatar
fsoubes committed
849 850


fsoubes's avatar
fsoubes committed
851 852
    tabItem(tabName = "Heatmap",
            tags$style(type='text/css', ".well { max-width: 25em; }"),
fsoubes's avatar
fsoubes committed
853 854


fsoubes's avatar
fsoubes committed
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869
            fluidRow(column(
              width = 8,
              div(
                tabsetPanel(
                  id = "tabset1",
                  tabPanel(
                     strong("Visualize the Heatmap"),value = "hmmainpan",
                    div(style="display:inline-block",
                        fluidRow( column(1 ,
                                         downloadButton(
                                           "savehm",
                                           "Save your plot" ,
                                           style =  "color: #fff; background-color: #337ab7; border-color: #2e6da4"
                                         )),
                                  column(2),
fsoubes's avatar
fsoubes committed
870
                                  column( 3,
fsoubes's avatar
fsoubes committed
871 872
                                          selectInput("formhm", label = NULL,
                                                      choices = c("png", "eps", "emf")))
fsoubes's avatar
fsoubes committed
873

fsoubes's avatar
fsoubes committed
874
                        )),
fsoubes's avatar
fsoubes committed
875
                    includeCSS("./css/style.css"),
fsoubes's avatar
fsoubes committed
876 877
                        conditionalPanel(condition = '!output.heatmbool',  verbatimTextOutput("warningsheat")
                        ),
fsoubes's avatar
fsoubes committed
878

fsoubes's avatar
fsoubes committed
879
                    conditionalPanel(
fsoubes's avatar
fsoubes committed
880
                      condition = "input.col1 =='blue' && input.col3 =='red' && input.submit == 0 ",
fsoubes's avatar
fsoubes committed
881 882 883 884 885
                      wellPanel(style = "position: absolute; width: 30%; left: 35%; top: 40%;
                         box-shadow: 10px 10px 15px grey;",
                                selectInput("text", "Choose your intermediate color:", choices = c("yellow", "white")),
                                actionButton("submit", "Submit"))
                    ),
fsoubes's avatar
fsoubes committed
886

fsoubes's avatar
fsoubes committed
887 888 889
                        #plotOutput("warningsheat")
                        conditionalPanel(condition = 'output.heatmbool',
                                         plotOutput("distPlot", width = "100%" , height = 1300)
fsoubes's avatar
fsoubes committed
890

fsoubes's avatar
fsoubes committed
891
                                         ),
fsoubes's avatar
fsoubes committed
892

fsoubes's avatar
fsoubes committed
893 894 895 896
                        h1("Here's a tracker for your different selections:"),
                          tags$head(
                            tags$link(rel = "stylesheet", type = "text/css", href = "style.css") # add style.css in order to add better police
                          ),
fsoubes's avatar
fsoubes committed
897

fsoubes's avatar
fsoubes committed
898 899
                          tags$head(tags$style("
                             #container * {display: inline;}")),
fsoubes's avatar
fsoubes committed
900

fsoubes's avatar
fsoubes committed
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915
                          div(
                            id = "container",p("There are"),htmlOutput("myNUM"),
                            p("significant genes"),
                            p("for the following comparison(s)"),
                            htmlOutput("testtt")
                          ),
                          div(
                            id = "container",
                            p('The selected rows for your heatmap are based on the '),
                            textOutput("myMET"),
                            p("method, with a P-value and FC treshold respectively set to "),
                            textOutput("myPVAL"),
                            p('and'),
                            textOutput("myFC")
                          ),
fsoubes's avatar
fsoubes committed
916

fsoubes's avatar
fsoubes committed
917 918 919 920 921 922
                    conditionalPanel(condition = "input.maxgen != null",
                     div(
                       id = "container",
                      p("You have chosen to regulate your comparison to "),
                      textOutput("maxGen"),
                      p(" genes maximum"))),
fsoubes's avatar
fsoubes committed
923

fsoubes's avatar
fsoubes committed
924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964
                          div(
                            id = "container",
                            p('The'),
                            textOutput("myMAT"),
                            p(
                              "method was used to compute the matrix distance with a number of clusters for the significant genes equal to",
                              textOutput("myCLUST")
                            )
                          ),
                          div(
                            id = "container",
                            p('The advanced color settings choosen for the following groups :'),
                            textOutput("indivcol"),
                            p("are respectively correlated to the following colors"),
                            htmlOutput("myPAL")
                          ),
                          div(
                            id = "container",
                            p(
                              'The legend size, row size, col size are respectively equals to ',
                              textOutput("myLEG"),
                              p(','),
                              textOutput("myROW"),
                              p(','),
                              textOutput("myCOL")
                            )
                          )
                  ),
                  tabPanel(
                    strong("Heatmap clusters"),
                    value = "dfhmclu",
                    downloadButton('downloadcut', "Download the data",
                                   style ="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
                    column(
                      12,
                      h3("Table summarizing the heatmap"),
                      helpText(
                        "Heatmap's cluster are upside down in order to match the genes with the heatmap from top to bottom"
                      )
                      ,
                      dataTableOutput("clustering"),
fsoubes's avatar
fsoubes committed
965 966


fsoubes's avatar
fsoubes committed
967 968 969 970 971 972 973 974 975 976 977 978 979
                      h3("This table summarizes the number of significant probes and genes by cluster"),
                      helpText(
                        "For the number of genes by cluster the duplicated genes are removed"
                      ),
                      dataTableOutput("totalgenbyc")
                    )),
                  tabPanel(
                    strong("(GO) enrichment-based cluster analysis"),value="maingo",
                    downloadButton("savegohmdavxlsx", "Save your enrichment as xlsx" , style ="color: #fff; background-color: #337ab7; border-color: #2e6da4"),

                    conditionalPanel(condition = "input.GO",
                     div(class= "highvenn" , style="font-size:24px; text-align: center;",
                               htmlOutput("titlegomain")),
fsoubes's avatar
fsoubes committed
980 981
                    DT::dataTableOutput("davidgo"),

fsoubes's avatar
fsoubes committed
982 983 984 985 986 987
                    verbatimTextOutput("printmessage"),
                    verbatimTextOutput("printselected"),
                    div(class= "highvenn" , style="font-size:24px; text-align: center;",
                        htmlOutput("titlegotop")),
                    tags$script(src="libraries/highcharts.js"),
                    tags$script(src="libraries/highcharts-more.js"),
fsoubes's avatar
fsoubes committed
988 989

                    tags$script(src="https://code.highcharts.com/modules/exporting.js"),
fsoubes's avatar
fsoubes committed
990
                    tags$script(src="https://code.highcharts.com/modules/export-data.js"),
fsoubes's avatar
fsoubes committed
991 992


fsoubes's avatar
fsoubes committed
993 994 995 996 997 998 999
                    tags$div(id="highChart")  ,
                    #tags$div(id="highChart",style="width: 100%;, height: 600px;")  ,
                    checkboxInput("addlabelhigh", "add label", FALSE),
                    tags$script(src="bubble.js")

                  )),
                  tabPanel(
fsoubes's avatar
fsoubes committed
1000
                    strong("Cut heatmap"),#icon("table"),
fsoubes's avatar
fsoubes committed
1001 1002
                    bsAlert("alert"),value = "cuthmmainpan",
                    plotlyOutput(outputId = "cutheatmap", height = 600),
fsoubes's avatar
fsoubes committed
1003 1004


fsoubes's avatar
fsoubes committed
1005 1006 1007
                    br(),br(),br(),br(),br(),br(),br(),br(),br(),
                    br(),br(),br(),br(),br(),br(),br(),br(),br(),
                    br(),br()
fsoubes's avatar
fsoubes committed
1008

fsoubes's avatar
fsoubes committed
1009 1010 1011 1012 1013
                    )
                  )
            )
            ),
                column(width=4,
fsoubes's avatar
fsoubes committed
1014

fsoubes's avatar
fsoubes committed
1015 1016
                       div(id="mypanheat", style="color: white;",
                      tabBox(
fsoubes's avatar
fsoubes committed
1017

fsoubes's avatar
fsoubes committed
1018 1019
                         title = "",
                         id = "tabset25",
fsoubes's avatar
fsoubes committed
1020 1021
                         width = NULL,

fsoubes's avatar
fsoubes committed
1022 1023 1024 1025 1026
                           tabPanel("Heatmap",id= "heatmpan", ##ADD8E6
                             style="background-color: #3c8dbc;",
                             value="widgetheat",
                          strong("Heatmap settings", style="font-size:25px;") ,
                          br(),
fsoubes's avatar
fsoubes committed
1027

fsoubes's avatar
fsoubes committed
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071
                           actionLink("resetAll",  label = ("reset all"), style="color:orange;float:right;font-size: 18px;"),
                           br(),
                           #wellPanel(
                             uiOutput("individusel"),
                             actionButton(
                               inputId = "allIndividus",
                               label = "Select all",
                               icon = icon("check-square-o"),
                               style =
                                 "color: #fff; background-color: #337ab7; border-color: #2e6da4"
                             ),
                             actionButton(
                               inputId = "noIndividus",
                               label = "Clear selection",
                               icon = icon("square-o"),
                               style ="color: #fff; background-color: #337ab7; border-color: #2e6da4"
                             ),
                           div(
                             id = "form",
                               # Creates a panel with a slightly inset border and grey background
                               uiOutput("testout"),
                               actionButton(
                                 # Action button that automatically react when triggered
                                 inputId = "allTests",label = "Select all",icon = icon("check-square-o"),
                                 style ="color: #fff; background-color: #337ab7; border-color: #2e6da4"
                               ),
                               actionButton(
                                 inputId = "noTests",label = "Clear selection",icon = icon("square-o"),
                                 style ="color: #fff; background-color: #337ab7; border-color: #2e6da4"
                               ),
                             br(),br(),
                             fluidRow( column(6,
                                              numericInput(
                                                # Create an input control for entry of numeric values
                                                'maxgen',
                                                'Maximal number of genes by comparison(s)',
                                                NULL,min = 100,max = 2500
                                              )),column(6,
                                                        br(),
                                                        selectInput(
                                                          "method2",
                                                          "Choose your statistical method",
                                                          choices = c("adj.p.val (FDR)"= "FDR", "p.value (raw)" = "None")
                                                        ))),
fsoubes's avatar
fsoubes committed
1072

fsoubes's avatar
fsoubes committed
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101
                             br(),
                             fluidRow( column(6,
                             sliderInput(
                               "pval",
                               "P-value treshold",
                               min = 0.01,
                               max = 0.05,
                               value = 0.05,
                               step = 0.01
                             )),
                             column(6,
                             sliderInput(
                               "fc",
                               "FC treshold",
                               min = 1,
                               max = 10,
                               value = 1,
                               step = 1
                             ))),
                             br(),
                             div(id = 'center', strong("Advanced settings",style = "font-family: 'times'; font-size:20px; font-style: strong; ")),
                             br(),
                             shiny::actionButton(
                               "toggleAdvanced",
                               "Advanced Computational Options",
                               href = "#",
                               style = "color: #fff; background-color: #337ab7; border-color: #2e6da4"
                             ),
                             br(),
fsoubes's avatar
fsoubes committed
1102
                             #includeHTML("HTML/tooltip.html"),
fsoubes's avatar
fsoubes committed
1103 1104 1105 1106 1107 1108 1109
                             shinyjs::hidden(div(
                               id = "advanced",
                                 fluidRow(
                                   column(6,
                                          numericInput('clusters', 'Cluster count', 3,
                                                       min = 1, max = 15)),
                                   column(6,
fsoubes's avatar
fsoubes committed
1110 1111 1112
                                          #addTooltip(session, id, title, placement = "bottom", trigger = "hover", options = NULL),
                                          #div(id = "mytext",
                                          #    p("Choose your matrix distance",includeHTML("HTML/tooltip.html")),
fsoubes's avatar
fsoubes committed
1113
                                          selectInput(
fsoubes's avatar
fsoubes committed
1114 1115 1116 1117
                                            "dist","Choose your matrix distance",choices = c("correlation", "euclidian","manhattan", "cosine")),
                                          div(id = "tooltipelem",
                                          bsTooltip(id = "dist", title = "correlation:\n dist = 1-corr", placement = "left", trigger="hover"))
                                          
fsoubes's avatar
fsoubes committed
1118 1119 1120 1121 1122 1123 1124 1125 1126
                                   )),
                                 fluidRow(
                                   column(6,
                                          checkboxInput("meangrp",
                                                        "Compute the mean for the different groups",
                                                        FALSE)),
                                   column(6,
                                          selectInput(
                                            "algomet","Choose your hierarchical clustering method",choices = c("ward.D2", "single","complete","average")))
fsoubes's avatar
fsoubes committed
1127

fsoubes's avatar
fsoubes committed
1128 1129 1130 1131 1132
                                 )))
                             ,br(),
                             shiny::actionButton("toggleAdvancedcolors","Advanced graphical Settings",
                               href = "#",style = "color: #fff; background-color: #337ab7; border-color: #2e6da4"
                             ),
fsoubes's avatar
fsoubes committed
1133

fsoubes's avatar
fsoubes committed
1134
                             br(),
fsoubes's avatar
fsoubes committed
1135

fsoubes's avatar
fsoubes committed
1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167
                             shinyjs::hidden(div(
                               id = "advancedcol",
                                 fluidRow(
                                   column(6,
                                          colourpicker::colourInput(
                                            "col1","Select colour for downregulated genes",firstcol,palette = "limited"
                                          )
                                   ),
                                   column(
                                     6,
                                     colourpicker::colourInput("col3", "Select colour for upregulated genes", lastcol,
                                                               palette = "limited")
                                   )
                                 ),
                                 fluidRow(column(4,
                                   numericInput(
                                     'rowsize','Row size',0.9,
                                     min = 0.2,max = 1.5,step = 0.1
                                   )
                                 ),
                                 column(4,
                                   numericInput(
                                     'colsize','Col size',0.9,
                                     min = 0.2,max = 1.5,step = 0.1
                                   )
                                 ),
                                 column(4,
                                   numericInput(
                                     'legsize','Legend size',0.8,
                                     min = 0.2,max = 1.5,step = 0.1
                                   )
                                 )
fsoubes's avatar
fsoubes committed
1168

fsoubes's avatar
fsoubes committed
1169
                                 ),
fsoubes's avatar
fsoubes committed
1170

fsoubes's avatar
fsoubes committed
1171 1172 1173 1174
                                 fluidRow(column(6,
                                   radioButtons("rowname",
                                                "show/hide rowname",
                                                c("hide", "show"))
fsoubes's avatar
fsoubes committed
1175

fsoubes's avatar
fsoubes committed
1176 1177 1178 1179 1180 1181
                                 ),
                                 column(6,
                                   radioButtons("colname",
                                                "show/hide colnames",
                                                c("show", "hide"))
                                 )),
fsoubes's avatar
fsoubes committed
1182

fsoubes's avatar
fsoubes committed
1183 1184 1185 1186 1187 1188 1189 1190
                              uiOutput('myPanel'),
                                 br()
                             ))), #end of the div "form"
                           br(),
                           shinyjs::hidden(div(
                             # Hide some widgets between the tags
                             id = "advancedgo",
                             wellPanel(
fsoubes's avatar
fsoubes committed
1191

fsoubes's avatar
fsoubes committed
1192 1193
                             )
                           )),
fsoubes's avatar
fsoubes committed
1194

fsoubes's avatar
fsoubes committed
1195 1196 1197
                           br(),
                           div(id = 'center', strong("Print Heatmap",style = "font-family: 'times'; font-size:20px; font-style: strong; ")),
                           br(),
fsoubes's avatar
fsoubes committed
1198

fsoubes's avatar
fsoubes committed
1199 1200 1201 1202 1203 1204 1205 1206
                           fluidRow(column(6, uiOutput("button")
                           ),
                           column(6,
                             checkboxInput("reactheat",
                                           "Add reactivity",
                                           FALSE))
                           ),
                          #shinyjs::disabled(actionButton("stop", "Stop")),
fsoubes's avatar
fsoubes committed
1207

fsoubes's avatar
fsoubes committed
1208
                           helpText("Note: It is highly advised to check this box if you're working with a set of genes close to 1000.",style="color:White; font-size:15px;"),
fsoubes's avatar
fsoubes committed
1209 1210


fsoubes's avatar
fsoubes committed
1211 1212
                           #conditionalPanel(condition = 'output.heatmbool',
                          conditionalPanel(condition = 'output.heatmbool',
fsoubes's avatar
fsoubes committed
1213 1214
                          #conditionalPanel(condition = 'input.button >0',

fsoubes's avatar
fsoubes committed
1215 1216 1217
                                            div(id = 'center', strong("Functional enrichment analysis",style = "font-family: 'times'; font-size:20px; font-style: strong; ")),
                                            br(),
                                            fluidRow(column( 4,
fsoubes's avatar
fsoubes committed
1218
                                                             selectInput("Species", "Choose your Species:", selected = "Mus musculus",
fsoubes's avatar
fsoubes committed
1219
                                                                         c("Mouse" = "Mus musculus", "Human" = "Homo sapiens", "Rat" = "Rattus norvegicus", "C. elegans" = "Caenorhabditis elegans",
fsoubes's avatar
fsoubes committed
1220
                                                                           "Zebrafish" = "Danio rerio",  "Pig" = "Sus scrofa",
fsoubes's avatar
fsoubes committed
1221 1222 1223
                                                                           "Chicken" = "Gallus gallus", "Chimpanzee" = " Pan troglodytes" ))),
                                                     column(4,
                                                       uiOutput("cutgo")),
fsoubes's avatar
fsoubes committed
1224
                                                     column(3,
fsoubes's avatar
fsoubes committed
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236
                                                            selectInput('catinfo','Category: ',
                                                              choices =  c( `BP`= "GOTERM_BP_ALL", `MF` = "GOTERM_MF_ALL", `CC`=  "GOTERM_CC_ALL", `Kegg`= "KEGG_PATHWAY"),
                                                              selected=  c( `BP`= "GOTERM_BP_ALL", `MF` = "GOTERM_MF_ALL", `CC`=  "GOTERM_CC_ALL", `Kegg`= "KEGG_PATHWAY"),
                                                              multiple = TRUE
                                                            )
                                                     )),
                                            fluidRow(
                                              column(4,br(),
                                                     actionButton("GO", "Run Analysis",style = "color: #fff; background-color: #337ab7; border-color: #2e6da4")),
                                              column(4,br(),
                                                     uiOutput("DAVID"))
                                            ),br(),
fsoubes's avatar
fsoubes committed
1237 1238
                                            helpText("Run Gene enrichment analysis, results are obtained by querying DWS (DAVID Web Services)", style="font-size:15px; color:white;")

fsoubes's avatar
fsoubes committed
1239 1240
                                            ),br(),br()

fsoubes's avatar
fsoubes committed
1241
                   ),
fsoubes's avatar
fsoubes committed
1242

fsoubes's avatar
fsoubes committed
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252
                tabPanel(
                  "Heatmap clustering",
                  value="test3",
                  strong("Cut heatmap settings", style="font-size:25px;") ,
                  br(),
                  uiOutput("cutcluster"),
                  selectizeInput('cutinfo', 'Choose your types of plots',
                                 choices = cutheatmlist),
                  # cutheatmlist is a variable defined in the global environment
                  br(),
fsoubes's avatar
fsoubes committed
1253

fsoubes's avatar
fsoubes committed
1254 1255 1256
                  selectInput("formcut","Choose your file format",choices = c("pdf", "png", "eps")
                  ), br(),
                  verbatimTextOutput("event"),
fsoubes's avatar
fsoubes committed
1257

fsoubes's avatar
fsoubes committed
1258 1259 1260
                  br(),
                  downloadButton("savecut", "Save your plot" , style =
                                   "color: #fff; background-color: #337ab7; border-color: #2e6da4")
fsoubes's avatar
fsoubes committed
1261

fsoubes's avatar
fsoubes committed
1262 1263 1264
                ))
                       )
                )
fsoubes's avatar
fsoubes committed
1265

fsoubes's avatar
fsoubes committed
1266 1267 1268 1269 1270 1271
    ))
 )
)
)

###############################
fsoubes's avatar
fsoubes committed
1272 1273
######## END dashboardbody    #
###############################
fsoubes's avatar
fsoubes committed
1274

fsoubes's avatar
fsoubes committed
1275
 shinyUI(
fsoubes's avatar
fsoubes committed
1276 1277 1278 1279 1280 1281
    dashboardPage(skin="blue",title = "MATRiX app",
    dbHeader,
    sidebar,
    body
  )
 )