inst/shiny-examples/nmyo_app/ui.R

require(shinydashboard)
require(shiny)
require(shinyjs)
require(DT)
require(shinyBS)
require(plotly)
source("helpers.R")
celltype_choices<-c("B_cell: Sham-MI",
                    "Endothelial: Sham-MI",
                    "Endothelial_ECM: Sham-MI",
                    "Fibroblast: Sham-MI",
                    "Lymph_Endothelial: Sham-MI",
                    "MF_Pop1: Sham-MI",
                    "MF_Pop2: Sham-MI",
                    "Neutrophil: Sham-MI",
                    "Pericyte: Sham-MI",
                    "SMC: Sham-MI",
                    "T_cell: Sham-MI",
                    "Unknown: Sham-MI",
                    "Endothelial-Rest",
                    "Endothelial_ECM-Rest",
                    "Fibroblast-Rest",
                    "B_cell-Rest",
                    "MF_Pop1-Rest",
                    "MF_Pop2-Rest",
                    "Neutrophil-Rest",
                    "T_cell-Rest",
                    "Lymph_Endothelial-Rest",
                    "Pericyte-Rest",
                    "SMC-Rest",
                    "Unknown-Rest")

shinyUI(
  dashboardPage(skin="black", title="nMyo",
  dashboardHeader(title = "nMyo",
                  dropdownMenuOutput("messageMenu")
                  ),

  dashboardSidebar(collapsed=TRUE,
    sidebarMenu(id="tabs",
      menuItem("Home",tabName="home",icon=icon("home")),
      menuItem("Quick Analysis", tabName = "quickTab", icon = icon("bolt"))
    )
  ),

  dashboardBody(
    useShinyjs(),
    tags$head(tags$style(HTML('
    /* active selected tab in the sidebarmenu */
      .main-sidebar .sidebar .sidebar-menu .active a{
        background-color: #004c99;
      }'))),
    tabItems(
      tabItem(tabName="home",
              fluidRow(useShinyjs(),
                       inlineCSS(appCSS),
                       div(
                         id = "loading-content",
                         h2("Please wait while nMyo is initializing.......")
                       ),
                  column(width=12, h3("Welcome to the ",withTags({a(href="https://github.com/ArisStefanosSn/", target="_blank", "nMyo R shiny applet")})),

                         "Details on the package installation and the associated help pages are available in our ", withTags({a(href="https://github.com/ArisStefanosSn/", target="_blank", "nMyo's GitHub page.")}),

                         "The nMyo package together with this website's Shiny implementation is written by Efthymios Motakis & Diana Low.",

                         "The data have been generated by Matt Ackers on behalf of the ", withTags({a(href="http://foo-lab.com/", target="_blank", "Foo lab.")}),
                         br(),br()
                         #"Running from your local R installation?",br(),br(),
                         #column(width=4,
                         #       withTags({pre("require(shiny)\nrunGitHub(\"SPLINTER-web\",username=\"dianalow\")")})
                         #)
                  ),
                  column(width=12,br(),
                         actionButton("gotostart", "Get Started!", icon("upload"),
                                      style="color: #fff; background-color: #16A085; border-color: #0E6655"
                         )),
                  column(width=3,br(),br(),
                         box(title="Contact Us", width=NULL, background="navy",
                             HTML("<p align=\"left\">Efthymios Motakis @ CVRI, NUS<br>",
                                  "<a href=\"http://foo-lab.com\">Foo Lab</a><br>",
                                  "<p align=\"left\">Diana Low<br><br>",
         "Suggestions/improvements? <a href=\"mailto:mdcefmo@nus.edu.sg\">Let us know</a>. </p>"))),
                  column(width=12,
                         "This website is running nMyo release 1.2.0 (updated xxxxx)")

                )),

      tabItem(tabName = "quickTab", h3("Quick Analysis: Single-cell RNA-seq"),
              fluidRow(
                column(width=3,
                       box(title = "Mouse cardiac non-myocytes", solidHeader = TRUE, width=NULL,
                           withBusyIndicatorUI(downloadButton('downloadData', 'Download data')),
                           br(),
                           "*Download will include all original files and plots saved using 'Save data to download' function during analysis",
                       br(),



                       br(),
                                h4("Steps"),
                                tags$ol(
                                  tags$li("Select the gene ID",
                                          tags$ul(
                                            tags$li("Symbol"),
                                            tags$li("Ensembl"))),
                                  tags$li("Select a plot type",
                                          tags$ul(
                                            tags$li("t-SNE scatterplot"),
                                            tags$li("Split Violin"),
                                            tags$li("Volcano or MA")
                                          )),
                                  tags$li("Interactive plot",
                                          tags$ul(
                                            tags$li("Screen it"),
                                            tags$li("Save it")
                                          ))


                       )

              ),

              ),

              column(width=9,
                     box(title="1. Feature selection",width=NULL,solidHeader = TRUE,
                         fluidRow(
                           column(width=4,
                                  textInput("genename",label="Type a gene", value="Postn"),
                                  disabled(actionButton("loadGeneButton", "Load gene", icon("eye"),
                                                        style="color: #fff; background-color: #5D6D7E; border-color: #AEB6BF"
                                  ))),
                           column(width=8,style="margin-top: +25px;",
                                  textOutput("geneloadstatus"))
                         )),
                     box(title="2. Plot options",width=NULL,solidHeader=TRUE,
                         fluidRow(width=NULL, column(width=4,selectInput('plottypeSelect', 'Plot type', c("t-SNE","MA","Volcano", "Violin"),
                                                             multiple=FALSE, selectize=FALSE)),
                                  column(width=7,

                                         fluidRow(width=NULL,style = "background-color:#ffc2c2;",
                                                  column(style="margin-top: +10px;",width=3,"t-SNE/Violin"),
                                                  column(style="margin-top: +10px;", width=3,"by condition"),
                                                  column(width=6, solidHeader=TRUE,
                                                         checkboxInput("scatterCheckbox","", FALSE))),
                                         br(),
                                         fluidRow(width=NULL, style = "background-color:#ff9d9d;",
                                                  column(style="margin-top: +25px;",width=3,
                                                         "Volcano/MA"),
                                                  column(width=9,
                                                  fluidRow(width=NULL,
                                                           column(style="margin-top: +25px;",width=3, "Cell type"),
                                                           column(width=9,
                                                                  selectInput(
                                                                    'celltypeSelect', label = "", choices = celltype_choices))),
                                                  fluidRow(width=NULL,
                                                           column(style="margin-top: +25px;",width=3, "LogFC"),
                                                           column(width=9,
                                                                  numericInput("logfc", label="", 1))),
                                                  fluidRow(width=NULL,
                                                           column(style="margin-top: +25px;",width=3, "FDR"),
                                                           column(width=9,
                                                                  numericInput("fdr", label="",0.01,min=0,max=1,step=0.005)))
                                                  ))
                                  )
                                  ),

                         fluidRow(
                           column(width=12,
                                  disabled(actionButton("showdataButton", "Show data", icon("eye"),
                                                        style="color: #fff; background-color: #5D6D7E; border-color: #AEB6BF"
                                  )),
                                  disabled(actionButton("savedataButton", "Save data", icon("save"),
                                                        style="color: #fff; background-color: #5D6D7E; border-color: #AEB6BF"
                                  )),br(),br(),
                                  withBusyIndicatorUI(disabled(downloadButton('downloadsavedData', 'Download saved data'))
                                  ))
                         )),
                     box(title="Interactive Plot", width=NULL,
                         plotlyOutput("plotgraph"))
              )),
      )
    )
  )
))
dianalow/nMyo documentation built on June 2, 2020, 12:03 a.m.