ui.R 5.88 KB
Newer Older
dmattek's avatar
dmattek committed
1
#
dmattek's avatar
dmattek committed
2
3
# Time Course Inspector: Shiny app for plotting time series data
# Author: Maciej Dobrzynski
dmattek's avatar
dmattek committed
4
#
dmattek's avatar
dmattek committed
5
6
7
# This is the user-interface definition for a Shiny web application.
#

8
9
10
11
12
13
14
required_packages = c("shiny", "shinyjs", "shinyBS", "shinycssloaders",
                  "data.table", "DT", "ggplot2", "gplots", "plotly",
                  "scales", "grid", "dendextend", "RColorBrewer",
                  "ggthemes", "sparcl", "dtw", "factoextra", "imputeTS",
                  "MASS", "robust", "pracma", "Hmisc")
missing_packages <- required_packages[!(required_packages %in% installed.packages()[,"Package"])]
if(length(missing_packages)) install.packages(missing_packages)
dmattek's avatar
dmattek committed
15
16

library(shiny)
dmattek's avatar
dmattek committed
17
18
library(shinyjs) # http://deanattali.com/shinyjs/
library(shinyBS) # for tooltips
dmattek's avatar
dmattek committed
19
library(shinycssloaders) # for loader animations
dmattek's avatar
dmattek committed
20
21

shinyUI(fluidPage(
dmattek's avatar
dmattek committed
22
23
  useShinyjs(),
  # Include shinyjs
dmattek's avatar
dmattek committed
24
25
26
27
  
  # Application title
  title = "Timecourse Inspector",
  
dmattek's avatar
dmattek committed
28
  sidebarLayout(
Maciej Dobrzynski's avatar
Maciej Dobrzynski committed
29
    sidebarPanel(width = 3,
dmattek's avatar
dmattek committed
30
31
32
      #Selector for file upload
      fileInput(
        'inFileLoadNuc',
dmattek's avatar
dmattek committed
33
        "Select data file and click Load Data",
dmattek's avatar
dmattek committed
34
35
36
37
        accept = c("text/csv", 
                   "text/comma-separated-values,text/plain", 
                   "application/gzip", 
                   "application/bz2"), 
dmattek's avatar
dmattek committed
38
      ),
dmattek's avatar
dmattek committed
39

dmattek's avatar
dmattek committed
40
41
      radioButtons("inRbutLongWide", actionLink("alDataFormat", "Data Format:"), c("Long" = 0, "Wide" = 1), inline = T),
      bsAlert("alertAnchorSidePanelDataFormat"),
dmattek's avatar
dmattek committed
42
      
dmattek's avatar
dmattek committed
43
44
      actionButton("inButLoadNuc", "Load Data"),
      actionButton("butReset", "Reset file input"),
dmattek's avatar
dmattek committed
45
      
46
      actionButton('inDataGen1', 'Synthetic data'),
dmattek's avatar
dmattek committed
47
      bsTooltip('inDataGen1', helpText.server[["inDataGen1"]], placement = "top", trigger = "hover", options = NULL),
dmattek's avatar
Added:    
dmattek committed
48
49
      
      tags$hr(),
dmattek's avatar
dmattek committed
50
      checkboxInput('chBtrajRem', 'Upload tracks to remove'),
dmattek's avatar
dmattek committed
51
      bsTooltip('chBtrajRem', helpText.server[["chBtrajRem"]], placement = "top", trigger = "hover", options = NULL),
dmattek's avatar
Added:    
dmattek committed
52
53
54
55
      
      uiOutput('uiFileLoadTrajRem'),
      uiOutput('uiButLoadTrajRem'),
      
56
      #tags$hr(),
57
      checkboxInput('chBstim', 'Upload stimulation pattern'),
dmattek's avatar
dmattek committed
58
      bsTooltip('chBstim', helpText.server[["chBstim"]], placement = "top", trigger = "hover", options = NULL),
59
60
61
62
      
      uiOutput('uiFileLoadStim'),
      uiOutput('uiButLoadStim'),
      
63
      #tags$hr(),
dmattek's avatar
dmattek committed
64
      checkboxInput('chBtrackUni', 'Create unique track ID', F),
dmattek's avatar
dmattek committed
65
      bsTooltip('chBtrackUni', helpText.server[["chBtrackUni"]], placement = "top", trigger = "hover", options = NULL),
dmattek's avatar
dmattek committed
66
      uiOutput('varSelSite'),
67
68
69
      
      tags$hr(),

dmattek's avatar
dmattek committed
70
      uiOutput('varSelTrackLabel'),
71
      
dmattek's avatar
dmattek committed
72
73
      checkboxInput('chBgroup', 'Group data', F),                
      bsTooltip('chBgroup', helpText.server[["chBgroup"]], placement = "top", trigger = "hover", options = NULL),
74

dmattek's avatar
dmattek committed
75
76
77
78
      uiOutput('varSelGroup'),
      uiOutput('varSelTime'),
      uiOutput('varSelMeas1'),
      radioButtons(
Maciej Dobrzynski's avatar
Maciej Dobrzynski committed
79
        'inSelMath', width = '50%',
80
        'Math on 1st and 2nd meas.:',
dmattek's avatar
dmattek committed
81
82
83
84
85
86
87
88
89
        c(
          'None' = '',
          'Divide' = " / ",
          'Sum' = " + ",
          'Multiply' = " * ",
          'Subtract' = ' - ',
          '1 / X' = '1 / '
        )
      ),
dmattek's avatar
dmattek committed
90
      bsTooltip('inSelMath', helpText.server[["inSelMath"]], placement = "top", trigger = "hover", options = NULL),
91
      
dmattek's avatar
dmattek committed
92
93
      uiOutput('varSelMeas2'),
      
dmattek's avatar
dmattek committed
94
      tags$hr(),
dmattek's avatar
dmattek committed
95
96
      checkboxInput('chBtimeTrim', 'Trim X-axis', FALSE),
      bsTooltip('chBtimeTrim', helpText.server[["chBtimeTrim"]], placement = "top", trigger = "hover", options = NULL),
dmattek's avatar
dmattek committed
97
      uiOutput('uiSlTimeTrim'),
98

dmattek's avatar
dmattek committed
99
100
101
102
103
      checkboxInput('chBtrajInter', 'Interpolate NAs and missing data', value = F),
      bsAlert("alertAnchorSidePanelNAsPresent"),
      bsTooltip('chBtrajInter', helpText.server[["chBtrajInter"]], placement = "top", trigger = "hover", options = NULL),
      uiOutput('varSelTimeFreq'),
      
dmattek's avatar
dmattek committed
104
      checkboxInput('chBnorm', 'Normalization', FALSE),
dmattek's avatar
dmattek committed
105
      bsTooltip('chBnorm', helpText.server[["chBnorm"]], placement = "top", trigger = "hover", options = NULL),
dmattek's avatar
dmattek committed
106
107
108
      uiOutput('uiChBnorm'),
      uiOutput('uiSlNorm'),
      uiOutput('uiChBnormRobust'),
dmattek's avatar
dmattek committed
109
      uiOutput('uiChBnormGroup'),
110

dmattek's avatar
dmattek committed
111
      tags$hr(),
dmattek's avatar
dmattek committed
112
      downloadButton('downloadDataClean', 'Download processed data'),
dmattek's avatar
dmattek committed
113
      bsTooltip('downloadDataClean', helpText.server[["downloadDataClean"]], placement = "top", trigger = "hover", options = NULL)
114
    ),
dmattek's avatar
dmattek committed
115
    
116
117
118
119
120
    mainPanel(
      tabsetPanel(
        tabPanel(
          "Time series",
          h4(
dmattek's avatar
dmattek committed
121
            "Plot time series: averages per group or individual"
122
123
          ),
          br(),
dmattek's avatar
dmattek committed
124
          modSelOutliersUI('returnOutlierIDs'),
125
          tabsetPanel(
dmattek's avatar
dmattek committed
126
            tabPanel("Averages",
127
128
129
130
131
132
133
                     br(),
                     modTrajRibbonPlotUI('modTrajRibbon')
            ),
            
            tabPanel(
              "Individual",
              br(),
134
              checkboxInput('chBhighlightTraj', 'Highlight trajectories', FALSE),
135
136
137
              uiOutput('varSelHighlight'),
              br(),
              modTrajPlotUI('modTrajPlot')
138
139
140
141
142
143
            ),
            
            tabPanel(
              "Power Spectral Density",
              br(),
              modPSDPlotUI('modPSDPlot')
144
145
            )
          )
dmattek's avatar
Added:    
dmattek committed
146
        ),
dmattek's avatar
Added:    
dmattek committed
147
        
148
149
        tabPanel(
          "AUC",
dmattek's avatar
dmattek committed
150
          tabAUCplotUI('tabAUC')
151
152
153
        ),
        
        tabPanel(
dmattek's avatar
dmattek committed
154
          "Distributions",
dmattek's avatar
dmattek committed
155
          tabDistPlotUI('tabDistPlot')
156
157
158
159
160
161
162
163
164
        ),
        
        
        # scatter plot
        tabPanel(
          'Scatter',
          tabScatterPlotUI('tabScatter')
        ),
        
dmattek's avatar
dmattek committed
165
        # hierarchical clustering
166
167
168
        tabPanel(
          'Hierarchical',
          clustHierUI('tabClHier')
dmattek's avatar
dmattek committed
169
        ),
170
171
        
        # sparse hierarchical clustering package sparcl temporarily unavailable from CRAN
dmattek's avatar
dmattek committed
172
        tabPanel(
dmattek's avatar
dmattek committed
173
174
           'Hierarchical Sparse',
           clustHierSparUI('tabClHierSpar')
dmattek's avatar
dmattek committed
175
176
177
178
179
180
        ),
        
        # cluster validation
        tabPanel(
          'Validation',
          clustValidUI('tabClValid')
dmattek's avatar
dmattek committed
181
        )
182
      ))
dmattek's avatar
dmattek committed
183
184
  )
))