inst/ui.r

library(shiny)
library(shinyIncubator)

shinyUI(bootstrapPage(
  
###########################################
## Add to the head element:
##    chromatoplotsgui stylesheet
##    page title/window name
###########################################

  tags$head(
    HTML('<link rel= "stylesheet" type = "text/css" href = "cgui.css" />'),
    tags$title("chromatoplotsGUI")),
   HTML('<div class = "span12" style = "padding:0;">
     <h1>chromatoplotsGUI</h1></div>'),


###########################################
## Menu nav bar
###########################################

  div(id = "menu", radioButtons("menuOpts", "",
                                c("Home" = "hm",
                                  "New Analysis" = "new",
                                  "Resume Analysis" = "old",
                                  "Preferences" = "prefs"))),

###########################################
## landing page
###########################################

  conditionalPanel(
    condition = "input.menuOpts == 'hm'",
    mainPanel(
      h5("Quick Start"),
      p("Start analysis by selecting from menu above. Choose New Analysis for individual 
        or sets of CDF files that have not been previously processed. Select 
        Continue Analysis for data objects output previously from chromatoplots, 
        chromatoplotsGUI or xcms."),
      h5("Documentation"),
      HTML('
<ul>
<li>In R <pre>help(package = "chromatoplotsgui")
help(package = "chromatoplots")
help(package = "xcms")</pre></li><br>
<li>Online</li>
<a href = "https://github.com/mariev/chromatoplotsgui">https://github.com/mariev/chromatoplotsgui</a>
</ul>')
        )),

###########################################
## new analysis
###########################################
  conditionalPanel(
    condition = "input.menuOpts == 'new'",
    ## user inputs: whether to display raw visualizations
    ##              location of raw files (load as temp file)
    ## program outputs: list of cdf filenames
    sidebarPanel(
      checkboxInput("displayraw", "Display Raw Data?", TRUE),
      fileInput('file1', 'Choose Data File(s)', multiple = TRUE, accept=c('CDF')),
      helpText("Select an individual file or process multiple files in the 
               experiment at once."),
      h3(textOutput("newraws"))
    ),
    
    ## workflow tabs
    tabsetPanel(id = "newparams",
        ## genProfile parameters
        tabPanel("genProfile", 
                 numericInput("step", "m/z step size:", 1),
                 checkboxInput('integrate', 'Integrate', FALSE),
                 conditionalPanel(
                   condition = "input.integrate == false",
                   numericInput("basespace", "Basespace:", 0),
                   numericInput("baselevel", "Baselevel:", NULL)),
                 actionButton(inputId = "runGenProf", label = "Apply Changes"),
                 downloadButton('saveGenProf', 'Save')),
        tabPanel("removeBaseline", 
                 div(id = "rmButtons", radioButtons("remBase", "", 
                  c("Median" = "med", "Robust Baseline Estimation" = "rbe"))),
                 conditionalPanel(
                   condition = "input.remBase == 'med'",
                   numericInput("mzrad", "mzrad", 0),
                   numericInput("scanrad", "scanrad", 100)),
                 conditionalPanel(
                   condition = "input.remBase == 'rbe'",
                   numericInput("span", "span", 0.15),
                   numericInput("runs", "runs", 3),
                   numericInput("b", "b", 3)),
                 actionButton(inputId = "runRemBase", label = "Apply Changes"),
                 downloadButton('savermbase', 'Save')),
                
        tabPanel("findPeaks", 
           div(id = "peaksButtons", selectInput("fPeaks", 
              "Choose peak fitting: " , 
              choices = c("Gaussian Fitting",
                          "Parabola Fitting",
                          "Matched Filter" ,
                          "Centroid Wavelet" ))),
           conditionalPanel(
             condition = "input.fPeaks == 'Gaussian Fitting'",
             numericInput("alpha", "alpha", 0.99, min = 0, max = 1, step = .01),
             checkboxInput("egh", "egh", TRUE)),
           conditionalPanel(
             condition = "input.fPeaks == 'Parabola Fitting'",
             numericInput("alpha", "alpha", 0.99, min = 0, max = 1, step = .01),
             checkboxInput("egh", "egh", TRUE)),
           conditionalPanel(
             condition = "input.fPeaks == 'Matched Filter'",
             numericInput("fwhm", "Full width half maximum", 30),
             numericInput("sigma", "sigma", 30/2.3548),
             numericInput("maxpeak", "Max No. of peaks per ion chromatogram", 5),
             numericInput("snthresh", "Signal to Noise Threshold", 10),
             numericInput("stepsize", "step size", 0.1),
             numericInput("mergesteps", "No. of steps to merge", 2),
             numericInput("mzdiff", "minumum m/z difference", 
                          0.8 - .1 * 2),
             checkboxInput("index", "Return indicies?", FALSE)),
           conditionalPanel(
             condition = "input.fPeaks == 'Centroid Wavelet'",
             numericInput("scanrange", "scanrange", NULL),
             numericInput("minEntries", "minEntries:", NULL),
             numericInput("dev", "dev: ", NULL),
             numericInput("snthreh", "signal to noise cutoff", 10),
             numericInput("noiserange", "noiserange: ", NULL),
             numericInput("minPeakWidth", "minPeakWidth", NULL),
             numericInput("scales", "scales", NULL),
             numericInput("maxGaussOverlap", "maxGaussOverlap", NULL),
             numericInput("minPtsAboveBaseLine", 'minPtsAboveBaseLine', NULL),
             numericInput("mzdiff", "mzdiff", -.001),
             numericInput("rtdiff", "retention time ", NULL),
             selectInput("integrateMethod", "integrate", choices = c(1,2)),
             checkboxInput("fitgauss", "Fit a gaussian peak?", FALSE)),
             actionButton(inputId = "runfpeaks", label = "Apply Changes"),
             downloadButton('savefpeaks', 'Save')),
          tabPanel("findComps",
             numericInput("tols", "tolerance", 1),
             actionButton(inputId = "runfcomps", label = "Apply Changes"),
             downloadButton("savefcomps", "Save")
          ),
          tabPanel("rtCorr",
                   div(id = "rtCorButtons", radioButtons("rtcor", "",
                                                         c("Smooth" = "smooth", "Loess" = 'loess', 
                                                           "none" = "none"))),
                   conditionalPanel(
                     condition = "input.rtcor == 'smooth'",
                     numericInput("missing", "missing", 1),
                     numericInput("extra", "extra", 1),
                     selectInput("model", "model", choices = c("loess", "linear")),
                     numericInput("span", "span", 0.2),
                     selectInput("family", "family", choices = c("deviation", "mdevden"))
                   ),
                   actionButton(inputId = "runrtCorr", label = "Apply Changes"),
                   downloadButton("savertcorr", "Save")
          ),
          tabPanel("groupComps",
                   div(id = "gCompButtons", radioButtons("gcomps", "", 
                                                         c("Density" = "den", "Angle" = "ang"))),
                   conditionalPanel(
                     condition = "input.gcomps == 'den'",
                     numericInput("bw", "bw", 30),
                     numericInput("minfrac", "minfrac", 0.5),
                     numericInput("minsamp", "minsamp", 1),
                     numericInput("mzwid", "mzwid", 0.25),
                     numericInput("maxgrp", "max", 50)
                   ),
                   conditionalPanel(
                     condition = "input.gcomps == 'ang'",
                     numericInput("rt_window", "rt_window", -1),
                     numericInput("distcutoff", "dist.cutoff", 0.05)
                   ),
                   actionButton(inputId = 'runGcomps', label = 'Apply Changes'),
                   downloadButton('savegc', "Save")
                   
                   
                   ## TODO show an error message if no input files specified
                   #                      conditionalPanel(
                   #                        condition = "length(output.rawfiles) > 0",
                   #                        h3("error")
                   #                        )
          ),
        tabPanel("processComps",
                 actionButton(inputId = "summarize", label = "Summarize"),
                 actionButton(inputId = "normalize", label = "Normalize")
        ),
        tabPanel("experimentDesign")
    
      )),
    conditionalPanel(
      condition = "input.menuOpts == 'old'",
      sidebarPanel(
        textInput('rawdatapath', 'Path to raw data files', value = getwd()),
        
        fileInput('file2', 'Resume Analysis', accept = c('text/rda', 'RDA')),
        helpText("Load a .rda or .RDA file that was previously saved using chromatoplotsGUI."),
        h5(textOutput("againfiles"))
      
    )
      
  ),

###########################################
## footer and debugging vals
###########################################
  HTML('<div id="footer">
        <div class="container">
          <p class="muted credit">chromatoplotsGUI v<span id="version" 
            class="shiny-text-output"></span> Marie Vendettuoli
            <span id = "vars" class="shiny-text-output" style="float:right;"></span></p>
  
        </div>
  
      </div>
          <span id = "genprofRun" class="shiny-text-output" style = "color:white;"></span>
           <span id = "rmbsRun" class="shiny-text-output" style = "color:white;"></span>
           <span id = "fpeaksrun" class="shiny-text-output" style = "color:white;"></span>
 

  ')

))
mariev/chromatoplotsgui documentation built on May 21, 2019, 11:46 a.m.