-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.R
More file actions
153 lines (140 loc) · 6.77 KB
/
ui.R
File metadata and controls
153 lines (140 loc) · 6.77 KB
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
library(shiny)
library(markdown)
# Load model into the local environment
source("model.R", local = TRUE)
# Build an input UI from the model
modelInputs <- list(
# Sidebar header text
helpText(HTML(markdownToHTML(text = sidebarHeader, fragment.only = TRUE)))
# state input boxes
, lapply( names(state)
, function(name) {
numericInput( name
, stateFormat(name)
, state[name]
, step = state[name] / 2
)
}
)
# parameter input boxes
, lapply( names(parameters)
, function(name) {
numericInput( name
, parameterFormat(name)
, parameters[name]
, step = parameters[name] / 2
)
}
)
# Time scale adjustment
, sliderInput( "time.end"
, "Time scale"
, min = time["end"] * 0.1
, max = time["end"] * 10
, value = time["end"]
, step = time["end"] * 0.1
)
# Save to summary button
, br()
# Sidebar footer text
, helpText(HTML(markdownToHTML(text = sidebarFooter, fragment.only = TRUE)))
)
controls <- tagList(modelInputs)
kineticsTab <- tabPanel( "Kinetic time course"
, plotOutput("modelPlot")
, wellPanel( sliderInput( "ymax"
, "Y-axis scale:"
, min = 0
, max = max(state)
, value = c(0, 0.1 * max(state))
)
)
)
summaryVars <- c(names(parameters), names(state))
names(summaryVars) <- c(parameterFormat(names(parameters)), stateFormat(names(state)))
simControls <- div( fluidRow( column( 3
, selectInput( 'simParameter'
, 'Variable'
, choices = summaryVars
)
)
, column( 3
, numericInput( 'simStart'
, 'Start value'
, 0
)
)
, column( 3
, numericInput( 'simEnd'
, 'End'
, 1
)
)
, column( 3
, selectInput( 'simPlot'
, "Plot"
, choices = names(state.summary)
)
)
)
, fluidRow( column( 3
, textInput( 'simSeries'
, 'Series name'
, "series1"
)
)
, column( 9
, sliderInput( 'simRun'
, "Run simulation"
, min = 0
, max = 1
, value = 1
, animate = animationOptions(interval = simulationTime / simluationSteps)
)
)
)
, fluidRow( actionButton("resetSummary", "Clear data")
, downloadButton('downloadSummaryData', 'Download Data')
)
)
simTab <- tabPanel( "Simulation"
, br()
, wellPanel(simControls)
, plotOutput('summaryPlot')
# , actionButton("resetSummary", "Clear data")
# , downloadButton('downloadSummaryData', 'Download Data')
)
# # TODO implement a less ugly horizontal well
# , wellPanel( class = "well container-fluid"
# , div( class = "row-fluid"
# , div( class = "span5"
# , selectInput( "summaryY"
# , "Summarize:"
# , choices = names(state.summary)
# )
# )
# , div( class = "span5"
# , selectInput("summaryX"
# , "As a function of:"
# , choices = c( stateFormat(names(state))
# , parameterFormat(names(parameters))
# )
# )
# )
# )
# )
#
# ,
# , actionButton("resetSummary", "Clear data")
# , downloadButton('downloadSummaryData', 'Download Data')
# )
shinyUI( fluidPage( titlePanel(headerText)
, fluidRow( column( 3
, wellPanel(controls)
)
, column( 9
, tabsetPanel(kineticsTab, simTab, id = 'tabs')
)
)
)
)