-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.R
7888 lines (6773 loc) · 398 KB
/
app.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
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#### Aquatic Microplastics Toxicology Shiny App
#### File created: September 23, 2020
#### Code contributors: Heili Lowman, Leah Thornton Hampton, Scott Coffin, Emily Darin
#### Setup ####
# Load packages
library(tidyverse) #General everything
library(shinydashboard)
library(RColorBrewer) #color palette
library(ggplot2) #plotting
library(calecopal) #Color palette devtools::install_github("an-bui/calecopal")
library(shiny) #Runs shiny
library(shinythemes) #Shiny theme for the page
library(shinyWidgets) #Widgets
library(scales) #SSD - Use the percent format
library(reshape2) #Overview tab - melts bars together
library(ssdtools) #SSD package
library(DT) #Build HTML data tables
library(plotly) #Make plots interactive
library(viridis) #Colors
library(shinyjs) #Exploration tab - reset button
library(tigerstats) #turns things into percents
library(ggbeeswarm) #plot all points
library(plotly)
library(ggdark) #dark mode ggplot
library(ggsci) #color palettes
library(collapsibleTree) #plot type for endpoint category tree
library(hrbrthemes) #theme for screening plot
library(ggrepel)
library(msm) ## rtnorm - get upper and lower limit of shape distribution
library(GeneralizedHyperbolic) ## normal-inverse Gaussian
library(stats)
library(caret) # for random forest predictions
library(randomForest) # for random forest predictions
# Load finalized dataset (prepped in RDAmaker.R)
aoc <- readRDS("aoc_setup_tomex2.RDS")
aoc_endpoint <- readRDS("aoc_endpoint_tomex2.RDS")
aoc_quality <- readRDS("aoc_quality_tomex2.RDS")
aoc_search <- readRDS("aoc_search_tomex2.RDS")
aoc_setup <- readRDS("aoc_setup_tomex2.RDS")
# aoc_v1 <- readRDS("aoc_v1.RDS")
aoc_z <- readRDS("aoc_z_tomex2.RDS")
#prediction models generated in aq_mp_tox_modelling repo (Scott_distributions_no_touchy.Rmd)
predictionModel_tissue.translocation <- readRDS("prediction/randomForest_oxStress.rds")
predictionModel_food.dilution <- readRDS("prediction/randomForest_foodDilution.rds")
test_data_prediction <- readr::read_csv("prediction/test_data_prediction.csv") %>% mutate_if(is.character, factor) %>% dplyr::select(-`...1`) #contains spaces!
test_data_calculator <- read.csv("calculator/test_data_calculator.csv", stringsAsFactors = TRUE)
valid_values <- readr::read_csv("prediction/valid_values.csv") %>% dplyr::select(-`...1`) #contains spaces!test_data_calculator <- read.csv("calculator/test_data_calculator.csv", stringsAsFactors = TRUE
train_data_prediction <- readr::read_csv("prediction/training_data_prediction.csv") %>% mutate_if(is.character, factor) %>% dplyr::select(-`...1`) #contains spaces!
# Load functions
source("functions.R")
## Create environmentally realistic data
synthetic_data_builder <- function(count){
#Preset parameters for pdfs
## Generate values for the three distributions
set.seed(123)
simulated.data <- data.frame(Size = numeric(0))
for(i in 1:count){
X <- X.func()
simulated.data <- rbind(simulated.data, X)}}
#### User Interface ####
ui <- dashboardPage(
dashboardHeader(title = "Toxicity of Microplastics Explorer 2.0", titleWidth = 400),
dashboardSidebar(width = 175,
sidebarMenu(
#Logo image
br(),
tags$img(src="main_logo_drop.png", width = "100%", height = "100%", style = 'display: block; margin-left: auto; margin-right: auto;'),
tags$div("Logo created by J.C. Leapman.", align = 'center', style = 'font-size: 10px; display: block; margin-left: auto; margin-right: auto;'),
br(),
#List of tabs
menuItem("Welcome", tabName = "Welcome", icon = icon("home")),
menuItem("Overview", tabName = "Overview", icon = icon("globe")),
menuItem("Search", tabName = "Search", icon = icon("search")),
menuItem("Exploration", tabName = "Exploration", icon = icon("chart-bar")),
menuItem("SSD", tabName = "SSD", icon = icon("fish")),
menuItem("Study Screening", tabName = "Screening", icon = icon("check-circle")),
menuItem("Calculators", tabName = "Calculators", icon = icon("calculator")),
menuItem("Predictions", tabName = "Predictions", icon = icon("brain")),
menuItem("Resources", tabName = "Resources", icon = icon("question-circle")),
menuItem("Data Submission", tabName = "Submission", icon = icon("fas fa-file-upload")),
menuItem("Contact", tabName = "Contact", icon = icon("envelope")),
br(),
br(),
#Twitter icon
menuItem("Human Health", href = "https://sccwrp.shinyapps.io/human_mp_tox_shiny-/", icon = icon("user")),
br(),
br(),
#Twitter icon
menuItem("Follow Us on Twitter!", href = "https://twitter.com/ToMExApp", icon = icon("twitter")))
), #End dashboard sidebar
dashboardBody(
#extends background color automatically
tags$head(tags$style(HTML('.content-wrapper { overflow: auto; }'))),
tabItems(
##### Welcome UI #####
tabItem(tabName = "Welcome",
#Header
h1("Welcome to the Toxicity of Microplastics Explorer 2.0,",br(),"Aquatic Organisms Database!", align = 'center'),
br(),
box(status = "primary", width = 12,
fluidRow(
#top right box
column(width = 12,
p(tags$img(src="welcome.png", width = "40%", height = "40%", style = "float:left; display: block; margin-left: auto; margin-right: 30px;")),
h3("Toxicity of Microplastics Explorer 2.0", align = "center"),
p("The Toxicity of Microplastics Explorer 2.0 (ToMEx 2.0) is a major expansion of the orginal ToMEx database coordinated by SCCWRP through
a four-part virtual workshop series of approximately 70 researchers from 14 different nations. ToMEx 2.0 will be released to the public in spring 2024."),
strong(p("Disclaimer: When using ToMEx 2.0, it is highly recommended that underlying data are carefully scrutinized before finalizing analyses or drawing major conclusions.")),
h3("What is the Microplastics Toxicity Database?", align = "center"),
strong(p("This database is a repository for microplastics
toxicity data for the California Microplastics Health Effects Workshop.")),
p("This web application allows users to explore toxicity
data using an intuitive interface while retaining the diversity and complexity inherent
to microplastics. Data is extracted from existing, peer-reviewed manuscripts containing
toxicity data pertaining to microplastics."),
p("A full length description of the database and web application is published in ",
a(href = "https://www.springeropen.com/collections/sccwrp", 'Microplastics and Nanoplastics'),
". To access the open access manuscript, ", a(href = "https://microplastics.springeropen.com/articles/10.1186/s43591-022-00032-4", 'click here'),"."),
p("Use the side panel on the left of the page to navigate to each section. Each section provides different information or data visualization options.
More specific instructions may be found within each section.")))),
#bottom left box
box(status = "primary", width = 12,
h3("Why was the Microplastics Toxicity Database and Web Application created?", align = "center"),
p("The database and application tools have been created for use by the participants of the ", a(href = "https://www.sccwrp.org/about/
research-areas/additional-research-areas/
trash-pollution/microplastics-health-effects-webinar-series/", 'Microplastics Health Effects Workshop',
.noWS = "outside"),".The purpose of this workshop is to identify the most sensitive and biologically critical endpoints associated with microplastics exposure,
prioritize which microplastics characteristics (e.g., size, shape, polymer) that are of greatest biological concern, and identify
critical thresholds for each at which those biological effects become pronounced. Workshop participants will also make reccomendations for future
research investments. Workshop findings will be published in a special issue of ", a(href ="https://microplastics.springeropen.com/", 'Microplastics and Nanoplastics', .noOWs = "outside"),".
These findings will be used directly by the state of California to fulfill ", a(href = "https://www.sccwrp.org/about/research-areas/
additional-research-areas/trash-pollution/microplastics-health-effects-webinar-series/history-california-microplastics-legislation/", 'legislative mandates',
.noWS = "outside")," regarding the management of microplastics in drinking water and the aquatic environment.")),
#bottom right box
box(status = "primary", width = 12,
h3("Contributors", align = "center"),
p(align = "center", a(href = "https://www.sccwrp.org/about/staff/leah-thornton-hampton/", 'Dr. Leah Thornton Hampton'),", Southern California Coastal Water Research Project ",
tags$a(href="https://twitter.com/DrLeahTH", icon("twitter")), tags$a(href="https://github.com/leahth", icon("github"))),
p(align = "center", a(href = "https://www.heililowman.com/", 'Dr. Heili Lowman'),", University of Nevada Reno ",
tags$a(href="https://twitter.com/heili_lowman", icon("twitter")), tags$a(href="https://github.com/hlowman", icon("github"))),
p(align = "center", a(href = "https://agency.calepa.ca.gov/staffdirectory/detail.asp?UID=69294&BDO=7&VW=DET&SL=S", 'Dr. Scott Coffin'),", California State Water Resources Control Board",
tags$a(href="https://twitter.com/DrSCoffin", icon("twitter")), tags$a(href="https://github.com/ScottCoffin", icon("github"))),
p(align = "center", a(href = "https://www.sccwrp.org/about/staff/emily-darin/", 'Emily Darin'),", Southern California Coastal Water Research Project",
tags$a(href="https://github.com/EmilyDarin", icon("github"))),
p(align = "center", a(href = "https://www.sfei.org/users/liz-miller", 'Dr. Ezra Miller'),", San Francisco Estuary Institute"),
p(align = "center", a(href = "https://rochmanlab.com/people/", 'Dr. Ludovic Hermabessiere'),", University of Toronto",
tags$a(href="https://twitter.com/HermabessiereL", icon("twitter"))),
p(align = "center", a(href = "https://rochmanlab.com/people/", 'Hannah De Frond'),", University of Toronto",
tags$a(href="https://twitter.com/HanDefrond", icon("twitter"))),
p(align = "center", "Vera de Ruitjer, Wageningen University"),
p(align = "center", "Dr. Samreen Siddiqui, Oregon State University"),
p(align = "center", "Andrea Faltynkova, Norwegian University of Science and Technology"),
p(align = "center", "Johannes Völker, Norwegian University of Science and Technology"),
p(align = "center", "Laura Monclús Anglada, Norwegian University of Science and Technology"),
p(align = "center", a(href = "https://www.sccwrp.org/about/staff/syd-kotar/", "Sydney Kotar"),", Southern California Coastal Water Research Project"),
p(align = "center", a(href = "http://wincowger.com/", 'Dr. Win Cowger'),", Moore Institute for Plastic Pollution Research",
tags$a(href="https://twitter.com/Win_OpenData", icon("twitter")), tags$a(href="https://github.com/wincowgerDEV", icon("github"))),
p(align = "center", a(href = "https://branderlab.net/", 'Dr. Susanne Brander'),", Oregon State University",
tags$a(href="https://twitter.com/smbrander", icon("twitter"))),
p(align = "center", a(href = "https://www.ntnu.edu/employees/martin.wagner", 'Dr. Martin Wagner'),", Norwegian University of Science and Technology",
tags$a(href="https://twitter.com/martiwag", icon("twitter"))),
p(align = "center", a(href = "https://www.wur.nl/en/Persons/Bart-prof.dr.-AA-Bart-Koelmans.htm", 'Dr. Bart Koelmans'),", Wageningen University",
tags$a(href="https://twitter.com/MicroplasticLab", icon("twitter"))),
p(align = "center", a(href = "https://rochmanlab.com/", 'Dr. Chelsea Rochman'),", University of Toronto",
tags$a(href="https://twitter.com/ChelseaRochman", icon("twitter"))),
p(align = "center", a(href = "https://www.sccwrp.org/about/staff/alvina-mehinto/", 'Dr. Alvine Mehinto'),", Southern California Coastal Water Research Project"),
p(align = "center", a(href = "https://www.sccwrp.org/about/staff/steve-weisberg/", 'Dr. Steve Weisberg'),", Southern California Coastal Water Research Project")),
#Logos with links to organizations
box(status = "primary", width = 12, align = "center",
splitLayout(align = "center",
tags$a(href="https://www.waterboards.ca.gov", tags$img(src="waterboard.png", width = "100%", height = "100%")),
tags$a(href="https://www.sccwrp.org", tags$img(src="sccwrp.png", width = "100%", height = "100%")),
tags$a(href="https://www.utoronto.ca", tags$img(src="toronto.png", width = "100%", height = "100%")),
tags$a(href="https://www.sfei.org/", tags$img(src="sfei.png", width = "100%", height = "100%")))),
),
##### Overview UI #####
tabItem(tabName = "Overview",
box(title = "Database Overview", status = "primary", width = 12, collapsible = TRUE,
p("Select tabs below to explore the database. Each bar displays the total number of measured endpoints where a
statistically signifcant effect was detected (Y) or where a measurement was made but a significant effect was not detected (N)."),
br(),
fluidRow(
tabBox(width = 12,
tabPanel("Organism Group",
plotOutput(outputId = "tax_plot"),
),
tabPanel(div(HTML("<i>In vitro</i> vs <i>In vivo</i>")),
plotOutput(outputId = "vivo_plot"),
),
tabPanel("Life Stage",
plotOutput(outputId = "life_plot"),
),
tabPanel("Exposure Route",
plotOutput(outputId = "exposure_plot"),
),
tabPanel("Polymer Type",
plotOutput(outputId = "polymer_plot"),
),
tabPanel("Particle Morphology",
plotOutput(outputId = "shape_plot"),
),
tabPanel("Particle Size",
plotOutput(outputId = "size_plot"),
)),
), #close fluid row
), #close box
box(title = "Biological Endpoint Catgorization", status = "primary", width = 12, collapsible = TRUE,
br(),
p("This plot displays the categorization of measured endpoints in the database. Nodes correspond to the Broad Endpoint Category,
the Specific Endpoint Category, Endpoints and the level of biological organization from left to right. The widget
below may be used to select endpoints at various Biological Levels of Organization. Click nodes to expand and collapse the plot."),
br(),
fluidRow(
column(width = 12,
column(width = 3,
pickerInput(inputId = "bio_check_endpoint",
label = "Level of Biological Organization",
choices = levels(aoc_endpoint$bio_f),
selected = levels(aoc_endpoint$bio_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
), #closes out column
column(width = 12,
#Go button
column(width = 3,
actionButton("go_endpoint", "Plot Current Selection", icon("rocket"), style="color: #fff; background-color: #117a65; border-color: #0e6655")),
), #closes out column
column(width = 12,
#collapsible tree plot
collapsibleTree::collapsibleTreeOutput("plot", height = "700px"),
), #closes out column
), #close fluid row
), #close box
), #close tab
##### Search UI #####
tabItem(tabName = "Search",
box(title = "Search Database", status = "primary", width = 12, height = "1000px",
column(width = 3,
downloadButton("download_search", "Download Selected Data (Excel File)", icon("download"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4")),
dataTableOutput("databaseDataTable", height = "600px")
), #close box
),#close search tab
##### Screening UI #####
tabItem(tabName = "Screening",
box(title = "Data Selection", status = "primary", width = 12, collapsible = TRUE,
shinyjs::useShinyjs(), # requires package for "reset" button, DO NOT DELETE - make sure to add any new widget to the reset_input in the server
id = "screen", # adds ID for resetting filters
p("This plot displays scores from the quality screening exercise developed by", a(href ="https://pubs.acs.org/doi/abs/10.1021/acs.est.0c03057", 'de Ruijter et al. (2020)', .noOWs = "outside"), "with some modification.
If a single study received multiple scores within a category, the highest score is shown in the plot.
For more information, including the scoring rubric used, see Resources."),
fluidRow(
tabBox(width = 12, height = "200px",
tabPanel("Data Type",
"Only 'Particle Only' data are included in the study screening dataset."
), #close tabpanel
tabPanel("Effect",
#Broad endpoint selection
column(width = 4,
pickerInput(inputId = "lvl1_quality", # endpoint checklist
label = "Broad Endpoint Category:",
choices = levels(aoc_quality$lvl1_f),
selected = levels(aoc_quality$lvl1_f),
options = list(`actions-box` = TRUE), # option to de/select all
multiple = TRUE)), # allows for multiple inputs
#Specific endpoint selection
column(width = 4, #Specific endpoint selection
pickerInput(inputId = "lvl2_quality",
label = "Specific Endpoint Category:",
choices = levels(aoc_quality$lvl2_f),
selected = levels(aoc_quality$lvl2_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#Effect y/n selection
column(width = 4,
pickerInput(inputId = "effect_quality",
label = "Effect:",
choices = levels(aoc_quality$effect_f),
selected = levels(aoc_quality$effect_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
), #close tabpanel
tabPanel("Biology",
#organism group selection
column(width = 4,
pickerInput(inputId = "organism_quality",
label = "Organisms:",
choices = levels(aoc_quality$org_f),
selected = levels(aoc_quality$org_f),
options = list(`actions-box` = TRUE),
multiple = TRUE),
#environment selection
pickerInput(inputId = "env_quality",
label = "Environment:",
choices = levels(aoc_quality$env_f),
selected = levels(aoc_quality$env_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#species selection
column(width = 4,
pickerInput(inputId = "species_quality",
label = "Species:",
choices = levels(aoc_quality$species_f),
selected = levels(aoc_quality$species_f),
options = list(`actions-box` = TRUE),
multiple = TRUE),
#biological organization selection
pickerInput(inputId = "bio_quality",
label = "Biological Organization:",
choices = levels(aoc_quality$bio_f),
selected = levels(aoc_quality$bio_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#life stage selection
column(width = 4,
pickerInput(inputId = "life_quality",
label = "Life Stages:",
choices = levels(aoc_quality$life_f),
selected = levels(aoc_quality$life_f),
options = list(`actions-box` = TRUE),
multiple = TRUE),
#exposure duration
pickerInput(inputId = "acute.chronic_quality",
label = "Exposure Duration:",
choices = levels(aoc_quality$acute.chronic_f),
selected = levels(aoc_quality$acute.chronic_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
), #close tabpanel
tabPanel("Particles",
#polymer selection
column(width = 4,
pickerInput(inputId = "poly_quality",
label = "Polymer:",
choices = levels(aoc_quality$poly_f),
selected = levels(aoc_quality$poly_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#shape selection
column(width = 4,
pickerInput(inputId = "shape_quality",
label = "Shape:",
choices = levels(aoc_quality$shape_f),
selected = levels(aoc_quality$shape_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#size category selection
column(width = 4,
pickerInput(inputId = "size_quality",
label = "Size Category:",
choices = levels(aoc_quality$size_f),
selected = levels(aoc_quality$size_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
), #close tabpanel
tabPanel("Study Screening",
column(width = 12,
strong("Warning:"),"'Red criteria' do not represent full scoring criteria.",
br(),
br(),
),
#technical quality selection
column(width = 4,
pickerInput(inputId = "tech_tier_zero_quality",
label = "Technical Criteria:",
choices = levels(aoc_quality$tier_zero_tech_f),
selected = levels(aoc_quality$tier_zero_tech_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#risk assessment quality selection
column(width = 4,
pickerInput(inputId = "risk_tier_zero_quality",
label = "Risk Assessment Criteria:",
choices = levels(aoc_quality$tier_zero_risk_f),
selected = levels(aoc_quality$tier_zero_risk_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#specfic study
column(width = 4,
pickerInput(inputId = "study_plus_quality",
label = "Study:",
choices = levels(aoc_quality$Study_plus),
selected = levels(aoc_quality$Study_plus),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
) #close tabpanel
), #close tab box
), #close fluid row
column(width = 3,
actionButton("go_quality", "Plot Current Selection", icon("rocket"), style="color: #fff; background-color: #117a65; border-color: #0e6655")),
column(width = 3,
actionButton("reset_quality", "Reset Filters", icon("redo"), style="color: #fff; background-color: #f39c12; border-color: #d68910")),
), #close box
box(title = "Visualize Data", status = "primary", width = 12,
p("Use the cursor to zoom and hover over the plot to view additional information about each study. Some studies are not visible until zoomed in.
Alternatively, specific studies may be selected using the filter in the 'Study Screening' tab above."),
br(),
p("'Red Criteria' are indicated by (*). Scores of 0, 1, and 2 are respresented by red, grey, and blue tiles respectively."),
br(),
plotlyOutput("tech_plotly", height = "600px"),
plotlyOutput("risk_plotly", height = "600px")
), #close box
), #closes out tab
##### Exploration UI #####
tabItem(tabName = "Exploration",
box(title = "Data Selection", status = "primary", width = 12, collapsible = TRUE,
shinyjs::useShinyjs(), # requires package for "reset" button, DO NOT DELETE - make sure to add any new widget to the reset_input in the server
id = "exploration", # adds ID for resetting filters
fluidRow(
tabBox(width = 12,
tabPanel("Data Type",
fluidRow(
#Data type selection
column(width = 4,
pickerInput(inputId = "exp_type_check",
label = "Data Type:",
choices = levels(aoc_setup$exp_type_f),
selected = "Particle Only",
options = list(`actions-box` = TRUE),
multiple = TRUE))),
), #close tabpanel
tabPanel("Effect",
fluidRow(
#Broad endpoint selection
column(width = 4,
pickerInput(inputId = "lvl1_check", # endpoint checklist
label = "Broad Endpoint Category:",
choices = levels(aoc_setup$lvl1_f),
selected = levels(aoc_setup$lvl1_f),
options = list(`actions-box` = TRUE), # option to de/select all
multiple = TRUE)), # allows for multiple inputs
#Specific endpoint selection
column(width = 4,
pickerInput(inputId = "lvl2_check",
label = "Specific Endpoint Category:",
choices = levels(aoc_setup$lvl2_f),
selected = levels(aoc_setup$lvl2_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#Effect y/n selection
column(width = 4,
pickerInput(inputId = "effect_check",
label = "Effect:",
choices = levels(aoc_setup$effect_f),
selected = levels(aoc_setup$effect_f),
options = list(`actions-box` = TRUE),
multiple = TRUE))),
), #close tabpanel
tabPanel("Biology",
fluidRow(
#organism group selection
column(width = 4,
pickerInput(inputId = "organism_check",
label = "Organisms:",
choices = levels(aoc_setup$org_f),
selected = levels(aoc_setup$org_f),
options = list(`actions-box` = TRUE),
multiple = TRUE),
#environment selection
pickerInput(inputId = "env_check",
label = "Environment:",
choices = levels(aoc_setup$env_f),
selected = levels(aoc_setup$env_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#species selection
column(width = 4,
pickerInput(inputId = "species_check",
label = "Species:",
choices = levels(aoc_setup$species_f),
selected = levels(aoc_setup$species_f),
options = list(`actions-box` = TRUE),
multiple = TRUE),
#biological organization selection
pickerInput(inputId = "bio_check",
label = "Biological Organization:",
choices = levels(aoc_setup$bio_f),
selected = levels(aoc_setup$bio_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#life stage selection
column(width = 4,
pickerInput(inputId = "life_check",
label = "Life Stages:",
choices = levels(aoc_setup$life_f),
selected = levels(aoc_setup$life_f),
options = list(`actions-box` = TRUE),
multiple = TRUE),
#exposure duration
pickerInput(inputId = "acute.chronic_check",
label = "Exposure Duration:",
choices = levels(aoc_setup$acute.chronic_f),
selected = levels(aoc_setup$acute.chronic_f),
options = list(`actions-box` = TRUE),
multiple = TRUE))),
), #close tabpanel
tabPanel("Particles",
fluidRow(
#polymer selection
column(width = 4,
pickerInput(inputId = "poly_check",
label = "Polymer:",
choices = levels(aoc_setup$poly_f),
selected = levels(aoc_setup$poly_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#shape selection
column(width = 4,
pickerInput(inputId = "shape_check",
label = "Shape:",
choices = levels(aoc_setup$shape_f),
selected = levels(aoc_setup$shape_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#size category selection
column(width = 4,
pickerInput(inputId = "size_check",
label = "Size Category:",
choices = levels(aoc_setup$size_f),
selected = levels(aoc_setup$size_f),
options = list(`actions-box` = TRUE),
multiple = TRUE))),
), #close tabpanel
tabPanel("Study Screening",
fluidRow(
column(width = 12,
strong("Warning:"),"Only 'Particle Only' data are included in the study screening dataset.",
br(),
"'Red criteria' do not represent full scoring criteria. Additional scoring criteria may be downloaded via the Search tab or visualized via the Study Screening tab.",
br(),
br(),
),
#technical quality selection
column(width = 4,
pickerInput(inputId = "tech_tier_zero_check",
label = "Technical Criteria:",
choices = levels(aoc_setup$tier_zero_tech_f),
selected = levels(aoc_setup$tier_zero_tech_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
#risk assessment quality selection
column(width = 4,
pickerInput(inputId = "risk_tier_zero_check",
label = "Risk Assessment Criteria:",
choices = levels(aoc_setup$tier_zero_risk_f),
selected = levels(aoc_setup$tier_zero_risk_f),
options = list(`actions-box` = TRUE),
multiple = TRUE))),
), #close tabpanel
tabPanel("Dose Metric",
fluidRow(
column(width = 4,
radioButtons(inputId = "dose_check",
label = "Dose Metric:",
choices = c("Particles/mL", "µg/mL", "µm3/mL", "µm2/mL", "µm2/µg/mL",
"Particles/kg sediment", "mg/kg sediment", "µm3/kg sediment", "µm2/kg sediment", "µm2/µg/kg sediment"),
selected = "µg/mL")),
column(width = 8,
radioButtons(inputId = "Rep_Con_rad",
label = "Do you want to use just the reported, just the converted, or all exposure concentrations?",
choices = c("reported", "converted", "all"),
selected = "all"))),
), #close tabpanel
tabPanel("Aesthetics",
fluidRow(
column(width = 4,
selectInput(inputId = "plot.type", "Plot Type:",
list(boxplot = "boxplot", violin = "violin", beeswarm = "beeswarm"))),
# checkboxInput(inputId = "show.points", "Show All Points", FALSE)),
column(width = 4,
selectInput(inputId = "theme.type_exp", "Dark or Light Mode:",
list(light = "light", dark = "dark"))),
column(width = 4,
selectInput(inputId = "color.type_exp", "Color Theme:",
list(default = "default", viridis = "viridis", brewer = "brewer", tron = "tron", locusZoom = "locusZoom", d3 = "d3", Nature = "Nature", JAMA = "JAMA")))),
), #close tabpanel
tabPanel("Alignment (Advanced)", height = "600px",
fluidRow(
column(width = 12,
p("A monodisperse effect concentration (e.g. 5 micron spheres) may be re-scaled to a default size range (e.g. 1 - 5,000 microns) using methods described in", a(href = "https://www.sciencedirect.com/science/article/pii/S0043135421006278", "Kooi et al., (2021)"), "Re-scaling to a default size range allows direct comparison to exposure concentrations for a default size range (which may also be re-scaled). The following radio buttons apply corrections for bioavailability (i.e. limiting available particles to max ingestable size), and a further correction for the ecologically relevant metric (ERM). For a given ERM, the threshold may be related to both mono- or polydisperse particles interchangeably so long as the total magnitude of ERM remains the same (Koelmans et al, 2020). If, for example, 'volume' is chosen below as an ERM, the monodisperse effect concentration is first corrected for bioavailability and aligned to whichever default size range the user chooses below. This aligned threshold (in particles/mL) is then multiplied by a correction for polydisperse volume based on the average volumes for the given range of microplastics in the environment.", strong("Only 'Particle Only' data are available for alignment."))),
br(),
#ERM Checkbox
column(width = 12,
radioButtons(inputId = "ERM_check", # ERM (particle, surface area, mass, volume, specific surface area)
label = "Ecologically Relevant Metric:",
choices = c("Unaligned","Particles", "Surface Area", "Volume", "Mass", "Specific Surface Area"),
selected = "Unaligned")),
column(width = 12,
strong("Starting alpha values are for marine surface water reported in ", a(href = "https://www.sciencedirect.com/science/article/pii/S0043135421006278", "Kooi et al., (2021)")),
br(),
br()),
column(width = 12,
radioButtons(inputId = "alpha.value.matrix",
label = "Alpha Values by Environmental Compartment:",
choices = c("Marine Surface Water", "Freshwater Surface Water", "Marine Sediment", "Freshwater Sediment"),
selected = "Marine Surface Water")),
#Alpha checkbox
column(width = 4,
numericInput(inputId = "alpha",
label = "Length Alpha Value",
value = 2.07,
step = 0.01)),
#Alpha surface area input
column(width = 4,
numericInput(inputId = "a.sa",
label = "Surface Area Alpha Value",
value = 1.50,
step = 0.01)),
#Alpha volume input
column(width = 4,
numericInput(inputId = "a.v",
label = "Volume Alpha Value",
value = 1.48,
step = 0.01)),
#Alpha mass input
column(width = 4,
numericInput(inputId = "a.m",
label = "Mass Alpha Value",
value = 1.32,
step = 0.01)),
#Alpha ssa input
column(width = 4,
numericInput(inputId = "a.ssa",
label = "Specific Surface Area Alpha Value",
value = 1.98,
step = 0.01)),
#average width to length ratio
column(width = 4,
numericInput(inputId = "R.ave",
label = "Average Particle Width to Length Ratio",
value = 0.77,
step = 0.01)),
#average density
column(width = 4,
numericInput(inputId = "p.ave",
label = "Average Particle Density (g/cm^3)",
value = 1.10,
step = 0.01)),
# lower length input
column(width = 4,
numericInput(inputId = "lower_length",
label = "Lower Length for Default Size Range (µm)",
value = 1)),
# upper length input
column(width = 4,
numericInput(inputId = "upper_length",
label = "Upper Length for Default Size Range (µm)",
value = 5000)),
# Switch to choose what determines bioaccessibility
column(width = 5,
radioButtons(inputId = "ingestion.translocation.switch",
label = "Bioaccessibility limited by tissue translocation (fixed) or mouth size opening (species-dependent)?",
choices = c("ingestion", "translocation"),
selected = "ingestion"
)),
# Tissue translocation size limit (if applicable)
column(width = 7,
numericInput(inputId = "upper.tissue.trans.size.um",
label = "Upper Length (µm) for Translocatable Particles (only works if bioaccessibility determined by translocation; also excludes data from experiments using particles longer than defined value)",
value = 83))),
) #close tabpanel
), #close tab box
), #close fluid row
column(width = 3,
actionButton("go", "Plot Current Selection", icon("rocket"), style="color: #fff; background-color: #117a65; border-color: #0e6655")),
column(width = 3,
actionButton("reset_input", "Reset Filters", icon("redo"), style="color: #fff; background-color: #f39c12; border-color: #d68910")),
column(width = 3,
downloadButton("downloadData", "Download Data (Excel File)", icon("download"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4")),
), #close box
box(title = "Data Visualization", status = "primary", width = 12,
fluidRow(
tabBox(width = 12,
tabPanel("Organism Group",
fluidRow(
column(width = 12,
plotOutput(outputId = "organism_plot_react", height = "600px")),
column(width = 3,
downloadButton("downloadexploration_org", "Download Plot", icon("download"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4"))),
),#closes tab panel
tabPanel("Broad Endpoint Category",
fluidRow(
column(width = 12,
plotOutput(outputId = "lvl_plot_react", height = "600px")),
column(width = 3,
downloadButton("downloadexploration_lvl1", "Download Plot", icon("download"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4"))),
),#closes tab panel
tabPanel("Specific Endpoint Category",
fluidRow(
column(width = 12,
plotOutput(outputId = "lvl2_plot_react", height = "auto")),
column(width = 3,
downloadButton("downloadexploration_lvl2", "Download Plot", icon("download"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4"))),
),#closes tab panel
tabPanel("Size",
fluidRow(
column(width = 12,
plotOutput(outputId = "size_plot_react", height = "600px")),
column(width = 3,
downloadButton("downloadexploration_size", "Download Plot", icon("download"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4"))),
),#closes tab panel
tabPanel("Shape",
fluidRow(
column(width = 12,
plotOutput(outputId = "shape_plot_react", height = "600px")),
column(width = 3,
downloadButton("downloadexploration_shape", "Download Plot", icon("download"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4"))),
),#closes tab panel
tabPanel("Polymer",
fluidRow(
column(width = 12,
plotOutput(outputId = "poly_plot_react", height = "600px")),
column(width = 3,
downloadButton("downloadexploration_poly", "Download Plot", icon("download"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4"))),
),#closes tab panel
br(),
p("Data labels on the far right of each plot represent the number of measurements and studies, respectively.")
), #closes tab box
), #closes fluid tab
), #closes box
), #closes out exploration tab
##### SSD UI #####
tabItem(tabName = "SSD",
box(title = "Data Selection", status = "primary", width = 12, collapsible = TRUE,
p("Species sensitivity distributions (SSDs) are cumulative probability distributions that estimate the percent of species affected by a given concentration of exposure using Maximum Likelihood and model averaging. A useful metric often used for setting risk-based thresholds is the concentration that affects 5% of the species, the 5% Hazard Concentration (HC). For more information on SSDs, refer to", a(href = "https://bit.ly/2Hy4q10", 'Posthuma, Suter II, and Traas (2001).')),
br(),
fluidRow(
tabBox(width = 12,
tabPanel("Data Type",
shinyjs::useShinyjs(), # requires package for "reset" button, DO NOT DELETE - make sure to add any new widget to the reset_input in the server
id = "ssd", # adds ID for resetting filters
fluidRow(
#Data type selection
column(width = 4,
pickerInput(inputId = "exp_type_check_ssd",
label = "Data Type:",
choices = levels(aoc_z$exp_type_f),
selected = "Particle Only",
options = list(`actions-box` = TRUE),
multiple = TRUE))),
), #close tabpanel
tabPanel("Effect",
fluidRow(
column(width = 4,
#Broad endpoint category selection
pickerInput(inputId = "lvl1_check_ssd",
label = "Broad Endpoint Category:",
choices = levels(aoc_z$lvl1_f),
selected = levels(aoc_z$lvl1_f),
options = list(`actions-box` = TRUE),
multiple = TRUE)),
column(width = 4,
#Specific endpoint category selection
pickerInput(inputId = "lvl2_check_ssd",
label = "Specific Endpoint Category:",
choices = levels(aoc_z$lvl2_f),
selected = levels(aoc_z$lvl2_f),
options = list(`actions-box` = TRUE),
multiple = TRUE))),
), #close tabpanel
tabPanel("Biology",