-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathui.R
421 lines (416 loc) · 38.3 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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
source("funcs/functions.R", local = TRUE)
# load modules
for (f in list.files('./modules')) {
source(file.path('modules', f), local=TRUE)
}
# Define UI for application
shinyUI(tagList(
shinyjs::useShinyjs(),
navbarPage(theme=shinythemes::shinytheme('united'), id='tabs', collapsible=TRUE,
title='Wallace',
tabPanel("Intro", value=0),
tabPanel("1 Occ Data", value=1),
tabPanel("2 Process Occs", value=2),
tabPanel("3 Env Data", value=3),
tabPanel("4 Process Envs", value=4),
tabPanel("5 Partition Occs", value=5),
tabPanel("6 Model", value=6),
tabPanel("7 Visualize", value=7),
tabPanel("8 Project", value=8),
tabPanel("Session Code", value='rmd'),
fluidRow(column(4,
wellPanel(
includeCSS("css/styles.css"),
includeScript("js/scroll.js"),
conditionalPanel("input.tabs == 0",
# actionButton('load', 'HACK'),
includeMarkdown("Rmd/text_intro_tab.Rmd")
),
# COMPONENT 1 ####
conditionalPanel("input.tabs == 1",
h4("Obtain Occurrence Data"),
radioButtons("occSel", "Modules Available:",
choices = list("Query Database" = 'db', "User-specified" = 'user', "Galaxy History User" = 'galaxy'),
selected = 'db'),
HTML('<hr>'),
conditionalPanel("input.occSel == 'db'",
div('Module: Query Database', id="mod"),
uiTop('spocc', 'Interface to Species Occurrence Data Sources'),
HTML('<hr>'),
queryDb_UI('c1_queryDb'),
actionButton("goDbOccs", "Query Database"), br(), br(),
HTML('<hr>'),
strong("Download database occurrence localities (.csv)"), br(), br(),
actionButton('dlDbOccs_G', "Get in Galaxy"),
downloadButton('dlDbOccs', "Download"),
HTML('<hr>'),
uiBottom("Jamie M. Kass, Bruno Vilela, Robert P. Anderson", 'spocc', "Scott Chamberlain, Karthik Ram, Ted Hart")
),
conditionalPanel("input.occSel == 'user'",
div('Module: User-specified Occurrences', id="mod"),
HTML('<hr>'),
userOccs_UI('c1_userOccs'),
actionButton("goUserOccs", "Load Occurrences"),
HTML('<hr>'),
div('Module Developers: Jamie M. Kass, Bruno Vilela, Robert P. Anderson', id="pkgDes")
),
conditionalPanel("input.occSel == 'galaxy'",
div('Module: Galaxy History User', id="mod"),
HTML('<hr>'),
galaxyOccs_UI('c1_galaxyOccs'),
actionButton("goGalaxyOccs", "Load Occurrences"),
HTML('<hr>'),
div('Module Developers: Jamie M. Kass, Bruno Vilela, Robert P. Anderson', id="pkgDes")
)
),
# COMPONENT 2 ####
conditionalPanel("input.tabs == 2",
h4("Process Occurrence Data"),
radioButtons("procOccSel", "Modules Available:",
choices = list("Select Occurrences On Map" = 'selOccs',
"Remove Occurrences By ID" = 'remID',
"Spatial Thin" = 'spthin')),
HTML('<hr>'),
conditionalPanel("input.procOccSel == 'selOccs'",
div('Module: Select Occurrences On Map', id="mod"),
uiTop('leaflet.extras', "Extra functionality for 'leaflet' Package"),
HTML('<hr>'),
selectOccs_UI('c2_selectOccs'),
strong("Select occurrences intersecting drawn polygon"), br(),
"(", HTML("<font color='blue'><b>NOTE</b></font>"),
': to begin drawing, click hexagon icon on map toolbar,
and when complete, press "Finish" and then the "Select Occurrences" button)', br(), br(),
actionButton("goSelectOccs", "Select Occurrences")
),
conditionalPanel("input.procOccSel == 'remID'",
div('Module: Remove Occurrences By ID', id="mod"),
HTML('<hr>'),
removeByID_UI('c2_removeByID'),
actionButton("goRemoveByID", "Remove Occurrence")
),
# placeholder for select on map
conditionalPanel("input.procOccSel == 'spthin'",
div('Module: Spatial Thin', id="mod"),
uiTop('spThin', 'Spatial Thinning of Species Occurrence Records'),
HTML('<hr>'),
thinOccs_UI('c2_thinOccs'),
actionButton("goThinOccs", "Thin Occurrences")
), br(),
strong("Reset to original occurrences"), br(), br(),
actionButton("goResetOccs", "Reset"),
HTML('<hr>'),
strong("Download processed occurrence localities (.csv)"), br(), br(),
actionButton('dlProcOccs_G', "Get in Galaxy"),
downloadButton('dlProcOccs', "Download"),
HTML('<hr>'),
conditionalPanel("input.procOccSel == 'selOccs'",
uiBottom("Jamie M. Kass, Robert P. Anderson", 'leaflet.extras', 'Bhaskar Karambelkar, Bangyou Zheng')),
conditionalPanel("input.procOccSel == 'remID'",
uiBottom("Jamie M. Kass, Robert P. Anderson")),
conditionalPanel("input.procOccSel == 'spthin'",
uiBottom("Jamie M. Kass, Matthew E. Aiello-Lammens, Robert P. Anderson", 'spThin', "Matthew E. Aiello-Lammens, Rob A. Boria,
Alex Radosavljevic, Bruno Vilela, Robert P. Anderson"),
" | ", a("software note", href="http://onlinelibrary.wiley.com/doi/10.1111/ecog.01132/abstract", target = "_blank"))
),
# COMPONENT 3 ####
conditionalPanel("input.tabs == 3",
h4("Obtain Environmental Data"),
radioButtons("envDataSel", "Modules Available:",
choices = list("WorldClim Bioclims" = 'wcbc',
"User-specified" = 'user', "Galaxy History User" = 'galaxy')),
HTML('<hr>'),
conditionalPanel("input.envDataSel == 'wcbc'",
div('Module: WorldClim Bioclims', id="mod"),
uiTop('raster', 'Geographic Data Analysis and Modeling'),
HTML('<hr>'),
wcBioclims_UI("c3_wcBioclims"),
strong("Using map center coordinates as reference for tile download."),
textOutput('ctrLatLon'), br(),
actionButton("goEnvData", "Load Env Data")
),
conditionalPanel("input.envDataSel == 'user'",
div('Module: User-specified Environmental Data', id="mod"),
HTML('<hr>'),
userEnvs_UI('c3_userEnvs'),
actionButton('goUserEnvs', 'Load Env Data')
),
conditionalPanel("input.envDataSel == 'galaxy'",
div('Module: Galaxy-dataset-specified Environmental Data', id="mod"),
HTML('<hr>'),
galaxyEnvs_UI('c3_galaxyEnvs'),
actionButton('goGalaxyEnvs', 'Load Env Data')
),
# br(), br(),
# strong("Download environmental predictors"), br(), br(),
# downloadButton('dlEnvs', "Download"),
HTML('<hr>'),
uiBottom("Jamie M. Kass, Robert P. Anderson", 'raster', "Robert J. Hijmans, Jacob van Etten, Joe Cheng, Matteo Mattiuzzu,
Michael Sumner, Jonathan A. Greenberg, Oscar Perpinan Lamigueriro, Andrew Bevan,
Etienne B. Racine, Ashton Shortridge"),
" | ", a("WorldClim", href="http://worldclim.org", target="_blank")
),
# COMPONENT 4 ####
conditionalPanel("input.tabs == 4",
h4("Process Environmental Data"),
radioButtons("envProcSel", "Modules Available:",
choices = list("Select Study Region" = "bgSel",
"User-specified" = "bgUser","Galaxy History User" = 'galaxy')),
HTML('<hr>'),
conditionalPanel("input.envProcSel == 'bgSel'",
div('Module: Select Study Region', id="mod"),
uiTop('sp', 'Title Classes and Methods for Spatial Data'),
uiTop('rgeos', 'Interface to Geometry Engine - Open Source (GEOS)'),
HTML('<hr>'),
div("Step 1:", id="step"), div("Choose Background Extent", id="stepText"), br(), br(),
bgExtent_UI('c4_bgExtent'),
actionButton("goBgExt", "Select")),
conditionalPanel("input.envProcSel == 'bgUser'",
div('Module: User-specified Study Region', id="mod"),
div("Step 1:", id="step"), div("Choose Background Extent", id="stepText"), br(), br(),
userBgExtent_UI('c4_userBgExtent'),
actionButton("goUserBg", "Load")),
conditionalPanel("input.envProcSel == 'galaxy'",
div('Module: User-specified Study Region', id="mod"),
div("Step 1:", id="step"), div("Choose Background Extent", id="stepText"), br(), br(),
galaxyBgExtent_UI('c4_galaxyBgExtent'),
actionButton("goGalaxyBg", "Load")),
conditionalPanel("input.envProcSel == 'bgSel' | input.envProcSel == 'bgUser' | input.envProcSel == 'galaxy'",
HTML('<hr>'),
div("Step 2:", id="step"), div("Sample Background Points", id="stepText"), br(), br(),
strong('Mask predictor rasters by background extent and sample background points'), br(), br(),
bgMskAndSamplePts_UI('c4_bgMskAndSamplePts'),
actionButton("goBgMask", "Sample"), br(), br(),
HTML('<hr>'),
selectInput('bgMskFileType', label = "Select download file type",
choices = list("GRD" = 'raster', "ASCII" = 'ascii', "GeoTIFF" = 'GTiff')),
strong("Download predictor rasters masked to background extent"), br(), br(),
actionButton('dlMskEnvs_G', "Get in Galaxy"),
downloadButton('dlMskEnvs', "Download"),
HTML('<hr>'),
uiBottom("Jamie M. Kass, Bruno Vilela, Robert P. Anderson", 'sp', "Edzer Pebesma, Roger Bivand, Barry Rowlingson, Virgilio Gomez-Rubio,
Robert Hijmans, Michael Sumner, Don MacQueen, Jim Lemon, Josh O\'Brien"), br(),
uiBottom(NULL, 'rgeos', "Roger Bivand, Colin Rundel, Edzer Pebesma, Karl Ove Hufthammer"))
),
# COMPONENT 5 ####
conditionalPanel("input.tabs == 5",
h4("Partition Occurrence Data"),
radioButtons("partSel", "Modules Available:",
choices = list("Non-spatial Partition" = 'nsp',
"Spatial Partition" = 'sp')),
HTML('<hr>'),
conditionalPanel("input.partSel == 'sp'",
div('Module: Spatial Partition', id="mod"),
uiTop('ENMeval', 'Automated Runs and Evaluations of Ecological Niche Models'),
HTML('<hr>'),
partSp_UI('c5_partSp'),
actionButton("goPartSp", "Partition")),
conditionalPanel("input.partSel == 'nsp'",
div('Module: Non-spatial Partition', id="mod"),
uiTop('ENMeval', 'Automated Runs and Evaluations of Ecological Niche Models'),
HTML('<hr>'),
partNsp_UI('c5_partNsp'),
actionButton("goPartNsp", "Partition")),
HTML('<hr>'),
strong("Download occurrence and background localities with partition values (.csv)"), br(), br(),
actionButton('dlPart_G', "Get in Galaxy"),
downloadButton('dlPart', "Download"),
HTML('<hr>'),
uiBottom("Jamie M. Kass, Bruno Vilela, Robert P. Anderson", 'ENMeval', 'Robert Muscarella, Peter J. Galante, Mariano Soley-Guardia, Robert A. Boria,
Jamie M. Kass, Maria Uriarte, Robert P. Anderson'),
" | ", a("software note", href="http://onlinelibrary.wiley.com/doi/10.1111/2041-210X.12261/abstract", target = "_blank")
),
# COMPONENT 6 ####
conditionalPanel("input.tabs == 6",
h4("Build and Evaluate Niche Model"),
radioButtons("enmSel", "Modules Available:",
choices = list("BIOCLIM", "Maxent")),
HTML('<hr>'),
conditionalPanel("input.enmSel == 'Maxent'",
div('Module: Maxent', id="mod"),
uiTop('ENMeval', 'Automated Runs and Evaluations of Ecological Niche Models'),
uiTop('dismo', 'Species Distribution Modeling'),
HTML('<hr>'),
htmlOutput('maxentJar'), br(),
"(", HTML("<font color='blue'><b>NOTE</b></font>"),
": see module guidance for troubleshooting tips if you are experiencing problems.)",
HTML('<hr>'),
maxent_UI('c6_maxent'),
actionButton('goMaxent', 'Run')),
conditionalPanel("input.enmSel == 'BIOCLIM'",
div('Module: BIOCLIM', id="mod"),
uiTop('ENMeval', 'Automated Runs and Evaluations of Ecological Niche Models'),
uiTop('dismo', 'Species Distribution Modeling'),
HTML('<hr>'),
bioclim_UI('c6_bioclim'),
actionButton('goBioclim', 'Run')),
HTML('<hr>'),
uiBottom("Jamie M. Kass, Robert Muscarella, Bruno Vilela, Robert P. Anderson", 'ENMeval', 'Robert Muscarella, Peter J. Galante, Mariano Soley-Guardia, Robert A. Boria,
Jamie M. Kass, Maria Uriarte, Robert P. Anderson'),
" | ", a("software note", href="http://onlinelibrary.wiley.com/doi/10.1111/2041-210X.12261/abstract", target = "_blank"), br(),
uiBottom(NULL, 'dismo', 'Robert J. Hijmans, Steven Phillips, John Leathwick, Jane Elith')
),
# COMPONENT 7 ####
conditionalPanel("input.tabs == 7",
h4("Visualize Model Results"),
radioButtons("visSel", "Modules Available:",
choices = list("BIOCLIM Envelope Plots" = 'bcPlots',
"Maxent Evaluation Plots" = 'mxEval',
"Plot Response Curves" = 'response',
"Map Prediction" = 'map')),
HTML('<hr>'),
conditionalPanel("input.visSel == 'bcPlots'",
div('Module: BIOCLIM Envelope Plots', id="mod"),
uiTop('dismo', 'Species Distribution Modeling'),
HTML('<hr>'),
bcPlots_UI('c7_bcPlots')),
conditionalPanel("input.visSel == 'mxEval'",
div('Module: Maxent Evaluation Plots', id="mod"),
uiTop('ENMeval', 'Automated Runs and Evaluations of Ecological Niche Models'),
uiTop('dismo', 'Species Distribution Modeling'),
HTML('<hr>'),
mxEvalPlots_UI('c7_mxEvalPlots')),
conditionalPanel("input.visSel == 'response'",
div('Module: Response Curves', id="mod"),
uiTop('dismo', 'Species Distribution Modeling'),
HTML('<hr>'),
respPlots_UI('c7_respPlots')),
conditionalPanel("input.visSel == 'map'",
div('Module: Map Prediction', id="mod"),
uiTop('dismo', 'Species Distribution Modeling'),
HTML('<hr>'),
conditionalPanel("input.enmSel == 'Maxent'", mapPredsMaxent_UI('c7_mapPredsMaxent')),
conditionalPanel("input.enmSel != 'Maxent'", mapPreds_UI('c7_mapPreds')),
actionButton("goMapPreds", "Plot"), br(), br(),
HTML('<hr>'),
selectInput('predFileType', label = "Select download file type",
choices = list("GRD" = 'raster', "ASCII" = 'ascii',
"GeoTIFF" = 'GTiff', "PNG" = 'png')),
strong("Download displayed raster"), br(), br(),
actionButton('dlPred_G', "Get in galaxy"),
downloadButton('dlPred', "Download")),
HTML('<hr>'),
conditionalPanel("input.visSel == 'mxEval'",
uiBottom("Jamie M. Kass, Robert Muscarella, Bruno Vilela, Robert P. Anderson", 'ENMeval', 'Robert Muscarella, Peter J. Galante, Mariano Soley-Guardia, Robert A. Boria,
Jamie M. Kass, Maria Uriarte, Robert P. Anderson'),
" | ", a("software note", href="http://onlinelibrary.wiley.com/doi/10.1111/2041-210X.12261/abstract", target = "_blank"), br()
),
conditionalPanel("input.visSel != 'mxEval'",
uiBottom("Jamie M. Kass, Bruno Vilela, Robert P. Anderson")
),
uiBottom(NULL, 'dismo', 'Robert J. Hijmans, Steven Phillips, John Leathwick, Jane Elith')
),
# COMPONENT 8 ####
conditionalPanel("input.tabs == 8",
h4("Project Model"),
radioButtons("projSel", "Modules Available:",
choices = list("Project to New Extent" = 'projArea',
"Project to New Time" = 'projTime',
"Calculate Environmental Similarity" = 'mess'),
selected = 'projArea'),
HTML('<hr>'),
conditionalPanel("input.projSel == 'projArea'",
div('Module: Project to New Extent', id="mod"),
uiTop('dismo', 'Species Distribution Modeling'),
HTML('<hr>'),
strong("Project model to current extent"), br(), br(),
actionButton('goProjectArea', "Project"), br(), br(),
projectArea_UI('c8_projectArea')),
conditionalPanel("input.projSel == 'projTime'",
div('Module: Project to New Time', id="mod"),
uiTop('dismo', 'Species Distribution Modeling'),
HTML('<hr>'),
projectTime_UI('c8_projectTime'),
strong("Project model to new time for current extent"), br(), br(),
actionButton('goProjectTime', "Project")),
conditionalPanel("input.projSel == 'mess'",
div('Module: Calculate Environmental Similarity', id="mod"),
uiTop('dismo', 'Species Distribution Modeling'),
HTML('<hr>'),
envSimilarity_UI('c8_envSimilarity'),
strong("Calculate MESS for current extent"), br(), br(),
actionButton('goEnvSimilarity', "Calculate MESS")),
strong("Reset projection extent"), br(), br(),
actionButton("goResetProj", "Reset"),
HTML('<hr>'),
selectInput('projFileType', label = "Select download file type",
choices = list("GRD" = 'raster', "ASCII" = 'ascii', "GeoTIFF" = 'GTiff',
"PNG" = "png")),
strong("Download displayed raster"), br(), br(),
actionButton('dlProj_G', "Get in Galaxy"),
downloadButton('dlProj', "Download"),
HTML('<hr>'),
uiBottom("Jamie M. Kass, Bruno Vilela, Robert P. Anderson", 'dismo', 'Robert J. Hijmans, Steven Phillips, John Leathwick, Jane Elith')
),
# SESSION CODE ####
conditionalPanel("input.tabs == 'rmd'",
h4("Download Session Code"),
HTML('<hr>'),
uiTop('rmarkdown', 'Dynamic Documents for R'),
uiTop('knitr', 'A General-Purpose Package for Dynamic Report Generation in R'),
HTML('<hr>'),
selectInput('rmdFileType', label = "Select download file type",
choices = list("Rmd", "PDF", "HTML", "Word")),
actionButton('dlRMD_G', 'Get in Galaxyy'),
downloadButton('dlRMD', 'Download Session Code'),
HTML('<hr>'),
uiBottom("Jamie M. Kass, Bruno Vilela, Robert P. Anderson", 'rmarkdown', 'JJ Allaire, Joe Cheng, Yihui Xie, Jonathan McPherson,
Winston Chang, Jeff Allen, Hadley Wickham, Aron Atkins, Rob Hyndman, Ruben Arslan'), br(),
uiBottom(NULL, 'knitr', 'Yihui Xie')
)
)),
# RESULTS WINDOW ####
column(8,
conditionalPanel("input.tabs != 0 & input.tabs != 'rmd'",
div(id = "wallaceLog", class = "scrollbox", htmlOutput("log")),
absolutePanel(top = -10, right = 20, width = 150, draggable = TRUE,
selectInput("bmap", "Change Base Map",
choices = c('ESRI Topo'="Esri.WorldTopoMap",
'Stamen Terrain'="Stamen.Terrain",
'Open Topo'="OpenTopoMap",
'ESRI Imagery'="Esri.WorldImagery",
'ESRI Nat Geo'='Esri.NatGeoWorldMap'),
selected = "Esri.WorldTopoMap")),
absolutePanel(top = 60, right = 20, width = 150, draggable = TRUE,
uiOutput("modSelUI")),
absolutePanel(top = 60, right = 180, width = 150, draggable = TRUE,
uiOutput("envSelUI"))
),
br(),
conditionalPanel("input.tabs != 'rmd' & input.tabs != 0",
tabsetPanel(id = 'main',
tabPanel('Map', leaflet::leafletOutput("map", height=600)),
tabPanel('Occs Tbl', DT::dataTableOutput('occTbl')),
tabPanel('Results',
conditionalPanel("input.tabs == 3", verbatimTextOutput('envsPrint')),
conditionalPanel("input.tabs == 6", uiOutput('evalTbls')),
conditionalPanel("input.tabs == 7 && input.visSel == 'response'",
imageOutput('respPlots')),
conditionalPanel("input.tabs == 7 && input.visSel == 'bcPlots' && input.enmSel == 'BIOCLIM'",
imageOutput('bcEnvelPlot')),
conditionalPanel("input.tabs == 7 && input.visSel == 'mxEval' && input.enmSel == 'Maxent'",
imageOutput('mxEvalPlots'))
),
tabPanel('Component Guidance', uiOutput('gtext_comp')),
tabPanel('Module Guidance', uiOutput('gtext_mod'))
)
),
conditionalPanel("input.tabs == 'rmd'",
column(8,
includeMarkdown("Rmd/text_sessionCode.Rmd")
)
),
conditionalPanel("input.tabs == 0",
tabsetPanel(id = 'introTabs',
tabPanel('Intro', includeMarkdown("Rmd/text_intro.Rmd")),
tabPanel('About',
fluidRow(
column(8, includeMarkdown("Rmd/text_about.Rmd")
)
)
)
)
)
)
)
)
))