forked from Vitek-Lab/MSstatsSampleSize-Shiny
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
399 lines (387 loc) · 20.2 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
## MSstatsSampleSize Shiny UI
###############################################################
dashboardPage(
skin="black",
tags$head(
tags$style(
HTML(".shiny-notification {
height: 100px;
width: 800px;
opacity: 1;
position:fixed;
top: calc(50% - 50px);;
left: calc(55% - 400px);;
}
.shiny-output-error-validation {
color: red;
}"
)
)
),
##### Header #####
header = dashboardHeader(
title = "MSstats- Sample Size Estimator",
titleWidth = 350
),
#### SideBar ####
sidebar = dashboardSidebar(
shinyjs::useShinyjs(),
width = 250,
sidebarMenu(
id="tabs",
##### Home Tab ####
menuItem("Home", tabName = "home", icon = icon("home")),
#### Data Import Tab ####
menuItem("1: Import data", tabName = "import_data", icon = icon("file-import")),
#### Data Simulation Tab ####
menuItem("2: Simulate datasets",
tabName = "explore_simulated", icon = icon("project-diagram")),
#### Analyze Simulation Tab ####
menuItem("3: Plan experiment",
tabName = "plan_experiment", icon = icon("vial"))
)
),
##### Body ####
body = dashboardBody(
shinyjs::useShinyjs(),
tabItems(
#### Home Tab ####
tabItem(
tabName = "home",
includeMarkdown("www/Welcome.md"),
actionButton(inputId = "start_process",
label = "Start",
icon = icon("arrow-right"),
style = CSS_BUTTON,
width = '200px')
),
#### Import Data Tab ####
tabItem(
tabName = "import_data",
navbarPage("", id = "myNavBar",
tabPanel("Import", fluidPage(
box(title = "Data Import Wizard", width = 12,
solidHeader = T, status = 'primary',
includeHTML("www/data_import.Rmd"),
fluidRow(
column(width = 4,
selectInput("data_format", "Select Data Type",
choice = FORMATS_LIST,
selected = FORMATS_LIST[2])),
column(width = 4,
fileInput("standard_count", "Select Protein Abundance File",
multiple = FALSE,
accept = EXTENSTIONS)),
column(width = 4,
fileInput("standard_annot", "Select Sample Annotation File",
multiple = FALSE,
accept = EXTENSTIONS))
),
fluidRow(
column(width = 2,
actionButton("import_data", "Import dataset",
icon = icon("file-import"),
style = CSS_BUTTON_REG))
)
),
box(title = "Example Data", width = 12, solidHeader = T,
status = 'primary',
includeHTML("www/example.Rmd"))
)
),
tabPanel("Explore Data", fluidPage(
fluidRow(
column(9,
h3(textOutput("dataset_name"),
style="display: inline-block;")),
column(3,
actionButton(inputId = "nav_to_sim",
label = "Next Step",
icon = icon("arrow-right"),
style = CSS_BUTTON,
width = '200px'))
),
br(),
#### Summary Tables ####
fluidRow(
column(width = 6,
fluidRow(width = 12,
# Data table output for summary table
box(title = "Summary", solidHeader = T,
status = "primary", width = 12,
withSpinner(DT::dataTableOutput(
"sum_table"),
proxy.height = "100px"))),
br(),
# Data table output for condition summary
fluidRow(width = 12,
box(title = "Condition Summary", solidHeader = T,
status = "primary", width = 12,
withSpinner(DT::dataTableOutput(
"cond_sum_table"),
proxy.height = "100px"))
)
),
column(width = 6,# heatmap
box(title = "Mean-Variance Plot", solidHeader = T,
status = "primary", width = 12,
withSpinner(plotOutput("mean_sd_plot"),
proxy.height = "200px")
))
),
br(),
#### Box plots and HeatMap ####
fluidRow(
# Box plot
box(title = "QC Box Plot", solidHeader = T, status = "primary",
width = 12,
withSpinner(plotly::plotlyOutput("global_boxplot"))
)
)
)
)
)
),
#### Data Simulation Tab #####
tabItem(
tabName = "explore_simulated",
fluidRow(
column(9, h1("Simulate datasets",
style="display: inline-block;")),
column(3,
shinyjs::disabled(actionButton(inputId = "nav_to_exp",
label = "Next Step",
icon = icon("arrow-right"),
style = CSS_BUTTON,
width = '200px')))
),
##### Checkboxes for file Input and set seed options ####
fluidRow(
column(1, checkboxInput(input = "set_seed",
label = "Set Seed")),
column(1, numericInput(inputId = "seed",
label="Value", value=10,
step = 1))
),
fluidRow(
#### Box to input simulation parameters from the dashboard ######
box(id = "param_box", title = "Parameters For Simulating DataSets",
width = 4, solidHeader = T, status = "primary",
# Number of simulations
numericInput(inputId = "n_sim", label = "Number of Simulations",
value = 10, min = 10, max = 500, step = 1) %>%
shinyhelper::helper(type = "markdown", content = "n_sim"),
# number of sample to be simulated
textInput(inputId = "n_samp_grp", label = "Samples per group",
value = "5,10,20", placeholder = "5,10,20") %>%
shinyhelper::helper(type = "markdown", content = "n_samp_grp"),
# Use default fold change values?
checkboxInput(inputId = "exp_fc", label = "Use Default Fold Change",
value = T)%>%
shinyhelper::helper(type = "markdown", content = "exp_fc"),
selectInput(inputId = "b_group", label = "Baseline Group",
choices = NULL)%>%
shinyhelper::helper(type = "markdown", content = "b_group",
id = "b_group_help"),
# Render editable data.table for fold change values
DT::DTOutput('fc_values') %>%
shinyhelper::helper(type = "markdown", content = "fc_values",
id = "fc_values_help"),
br(),
# Input vector off different proteins
checkboxGroupInput(inputId = "da_prots", label = "How do you want to specify Differentially
abundant proteins ?", inline = T,
choiceNames = list("Text input", "Upload csv file"),
choiceValues = list(F, T), selected = F),
textInput(inputId = "diff_prot",
label = "List of Differential Abundant Proteins",
value = NULL,
placeholder = "List of comma separated Proteins") %>%
shinyhelper::helper(type = "markdown", content = "diff_prot",
id = "diff_prot_help"),
fileInput(inputId = "da_prots_file",
label = "DA Proteins File Upload", multiple = F,
accept = EXTENSTIONS),
# Select number/proportion the proteins be simulated with
selectInput(inputId = "sel_sim_prot", label = "Select Proteins To Simulate",
choices = c("Proportion", "Number"), #capitalize this
selected = "proportion") %>%
shinyhelper::helper(type = "markdown", content = "sel_sim_prot"),
# define the protein proportion
sliderInput(inputId = "prot_prop", label = "Protein Proportion",
value = 1, min = 0, max = 1, step = 0.01) %>%
shinyhelper::helper(type = "markdown", content = "prot_prop"),
# define number of proteins to be selected
sliderInput(inputId = "prot_num", label = "Protein Number",
value = 1, max = 1000, min = 1) %>%
shinyhelper::helper(type = "markdown", content = "prot_num"),
# should validation set be simulated as well?
selectInput(inputId = "sim_val", label = "Simulate Validation Set",
choices = c(T,F), selected = F) %>%
shinyhelper::helper(type = "markdown", content = "sim_val"),
# Define number of samples in the validation groups
numericInput(inputId = "n_val_samp_grp", label = "Valid samples per group",
value = 50, min = 50, max = 1000, step = 50) %>%
shinyhelper::helper(type = "markdown", content = "n_val_samp_grp",
id = "n_val_samp_grp_help"),
# Simulate the dataset provided inputs, gets enabled dynamically
shinyjs::disabled(
actionButton(inputId = "simulate", label = "Simulate Data",
icon = icon("project-diagram"),
style = CSS_BUTTON_REG))
),
#### Simulation details section #####
box(title = "Simulated Datasets", solidHeader = T, status = "primary",
width = 8,
fluidRow(
##### Select individual simulation, previous and next buttons #####
column(4, selectInput(inputId = "simulations", label = "Simulations", choices = NULL)),
column(2, shinyjs::disabled(actionButton(inputId = "back",
label = "Previous",
icon = icon("arrow-left"),
style = "margin-top: 25px;",
width = '100px'))),
column(2, shinyjs::disabled(actionButton(inputId = "fwd",
label = "Next",
icon = icon("arrow-right"),
style = "margin-top: 25px;",
width = '100px'))),
column(2, shinyjs::disabled(downloadButton(outputId = "download_pca",
label = "Download",
icon = icon("download"),
style = "margin-top: 25px;",
width = '150px')))
),
withSpinner(plotOutput("pca_plot"))
)
)
),
#### Analyse Simulation Tab ####
tabItem(
tabName = "plan_experiment",
h1("Plan Experiment"),
h3("Calculate Sample Size For Classification"),
#### Model Setup Box ####
fluidRow(
box(status = 'primary', solidHeader = T, title = "Model Setup",
width = 12,
fluidRow(
column(width = 2,
selectInput(inputId = "classifier", label = "Select Model to Train",
choice = MODELS, width = '200px')
),
column(width = 3,
checkboxGroupButtons(inputId = "checkbox_inputs",
label = "Options",
choices = c("Use h2o Package",
"Parameter Tuning"),
checkIcon = list(
yes = icon("check-square"),
no = icon("square-o")),
width = "300px")%>%
shinyhelper::helper(type = "markdown",
content = "checkbox_inputs",
id = "checkbox_inputs_help")
),
column(offset = 1, width = 1,
shinyjs::disabled(actionButton(inputId = "run_model",
label = "Run Model",
width = "100px",
style = CSS_BUTTON_RUN)),
),
column(offset= 1, width = 1,
shinyjs::disabled(downloadButton(outputId = "download_plots",
label = "Download Plots" ,
style = "margin-top:25px;",
width = "250px"))
),
column(offset=1, width = 1,
shinyjs::disabled(downloadButton(outputId ="generate_report",
label ="Generate Report",
style ="margin-top:25px;
margin-top: 25px;
display: inline-block;
color: #fff;
background-color: orange;
border-color: black;")))
),
column(width = 3,
selectInput(inputId = "stop_metric",
label = "Stopping Metric",
choices = STOPPING_METRIC) %>%
shinyhelper::helper(content = "h2o_stopping_metric",
id = "stop_metric_help"),
numericInput(inputId = "nfolds", label = "N-Folds",
value = 0, min = 0, max = 100, step = 1)%>%
shinyhelper::helper(content = "h2o_nfold",
id = "nfolds_help"),
selectInput(inputId = "f_assignment", label = "Fold Assignment",
choices = FOLD_ASSIGNMENT) %>%
shinyhelper::helper(content = "h2o_f_assignment",
id = "f_assignment_help"),
numericInput(inputId = "iters", label = "Iterations", value = 200,
min = 1, max = 1000, step = 10) %>%
shinyhelper::helper(content = "h2o_iters",
id = "iters_help"),
selectInput(inputId = "family", label = "Family", choices = FAMILY,
selected = "binomial") %>%
shinyhelper::helper(content = "h2o_family",
id = "family_help"),
sliderInput(inputId = "laplace", label = "Laplace", min = 0,
max = 1, value = 0) %>%
shinyhelper::helper(content = "h2o_laplace",
id = "laplace_help"),
numericInput(inputId = "caret_rf",
label = "Variables to Randomly Sample",
value = 2, min = 1, max = 1000, step = 1)%>%
shinyhelper::helper(content = "caret_rf",
id = "caret_rf_help")
),
column(width = 3,
selectInput(inputId = "link", label = "Link",
choices = LINK) %>%
shinyhelper::helper(content = "h2o_link",
id = "link_help"),
selectInput(inputId = "solver", label = "Solver",
choices = SOLVER) %>%
shinyhelper::helper(content = "h2o_solver",
id = "solver_help"),
sliderInput(inputId = "eps_sdev", label = "Cutoff Threshold",
min = 0, max = 1, step = 0.001, value = 0.01) %>%
shinyhelper::helper(content = "h2o_eps_sdev",
id = "eps_sdev_help"),
sliderInput(inputId = "min_sdev", label = "Minimum SD",
min = 0.01, value = 0.01, max = 1) %>%
shinyhelper::helper(content = "h2o_min_sdev",
id = "min_sdev_help"))
),
verbatimTextOutput("v3")
),
fluidRow(
##### Accuracy Box ####
box(width = 6, title = "Accuracy", status = "info", solidHeader = T,
withSpinner(plotOutput(outputId = 'acc_plot')),
verbatimTextOutput("default", placeholder = F)
),
##### Protein Importance Box ####
box(width = 6, title = "Protein Importance", status = "success",
solidHeader = T,
fluidRow(
column(width = 4,
selectInput(inputId = "s_size", label = "Sample Size",
choices = NULL)
),
shinyjs::disabled(actionButton(inputId = "back_varimp", label = "Prev.",
icon = icon("arrow-left"),
style = "margin-top: 25px;")),
shinyjs::disabled(actionButton(inputId = "fwd_varimp", label = "Next",
icon = icon("arrow-right"),
style = "margin-top: 25px;"))
),
withSpinner(plotOutput('importance_plot'))
)
)
)
)
)
)