-
Notifications
You must be signed in to change notification settings - Fork 2
/
stacked_supplement_w_captions.Rmd
314 lines (255 loc) · 11.9 KB
/
stacked_supplement_w_captions.Rmd
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
---
output:
pdf_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,
message = FALSE,
warning = FALSE,
fig.width = 10,
fig.height = 9)
library(tidyverse)
library(toxEval)
library(ggpubr)
library(cowplot)
source(file = "read_chemicalSummary.R")
source(file = "R/analyze/get_sites_ready.R")
source(file = "R/report/stack_plots.R")
source(file = "R/report/combo_plot2.R")
source(file = "R/analyze/explore_detection_limits.R")
source(file = "SI_site_mix_figure.R")
tox_list <- create_toxEval(file.path(Sys.getenv("PASSIVE_PATH"), "data","data_for_git_repo","clean",
"passive.xlsx"))
site_info <- prep_site_list(tox_list$chem_site)
cas_final <- readRDS(file.path(Sys.getenv("PASSIVE_PATH"),
"data", "data_for_git_repo",
"clean",
"cas_df.rds"))
graphData_tox_det <- readRDS(file.path(Sys.getenv("PASSIVE_PATH"),
"data", "data_for_git_repo",
"clean","graphData_tox_det.rds"))
color_map <- class_colors(tox_list)
font_size <- 8
ordered_class <- levels(graphData_tox_det$Class)
levels(chemicalSummary$Class)[levels(chemicalSummary$Class) == "Food Additive/Plasticizer"] <- "Food Additive"
levels(chemicalSummary$Class)[levels(chemicalSummary$Class) == "Antimicrobial disinfectant"] <- "Antimicrobial"
ordered_class[ordered_class == "Food Additive/Plasticizer"] <- "Food Additive"
ordered_class[ordered_class == "Antimicrobial disinfectant"] <- "Antimicrobial"
tox_list$chem_info$Class[tox_list$chem_info$Class == "Food Additive/Plasticizer"] <- "Food Additive"
tox_list$chem_info$Class[tox_list$chem_info$Class == "Antimicrobial disinfectant"] <- "Antimicrobial"
name_key <- chemicalSummary %>%
select(CAS, chnm) %>%
distinct() %>%
left_join(select(cas_final, CAS, chnm_new = chnm), by = "CAS") %>%
arrange(chnm)
name_key$chnm_new[name_key$chnm_new == "Tris(1,3-dichloro-2-propyl)phosphate (TDCPP)"] <- "Tris(1,3-dichloro-2-propyl)phosphate"
name_key$chnm_new[name_key$chnm_new == "Tris(2-butoxyethyl)phosphate (TBEP)"] <- "Tris(2-butoxyethyl)phosphate"
name_key$chnm_new[name_key$chnm_new == "Tris(1-chloro-2-propyl)phosphate (TCPP)"] <- "Tris(1-chloro-2-propyl)phosphate"
name_key$chnm_new[name_key$chnm_new == "Tris(2-ethylhexyl)phosphate (TEHP)"] <- "Tris(2-ethylhexyl)phosphate"
levels(chemicalSummary$chnm) <- name_key$chnm_new[which(name_key$chnm == levels(chemicalSummary$chnm))]
classes <- unique(tox_list$chem_info$Class)
num_chem_to_keep <- 5
class_plots <- list()
site_info <- site_info %>%
arrange(`Short Name`)
levels(site_info$`Short Name`) <- paste0(levels(site_info$`Short Name`),
" (",site_info$map_nm,")")
color_6 <- colorspace::rainbow_hcl(6,
start = -360, end = -55,
c = 100, l = 64)
for(i in ordered_class){
chem_i <- chemicalSummary %>%
dplyr::filter(Class == i,
EAR > 0)
if(nrow(chem_i) == 0){
next
}
orig_levels <- levels(chem_i$chnm)
chem_i$chnm <- droplevels(chem_i$chnm)
graphData <- graph_chem_data(chem_i)
orderChem_df <- graphData %>%
mutate(logEAR = log(meanEAR),
chnm = as.character(chnm)) %>%
group_by(chnm) %>%
summarise(max = max(logEAR[logEAR != 0], na.rm = TRUE)) %>%
ungroup()
orderChem_df$max[is.na(orderChem_df$max)] <- min(orderChem_df$max, na.rm = TRUE) - 1
orderChem_df <- arrange(orderChem_df, max)
new_levels <- orderChem_df$chnm %>%
rev()
chem_i$chnm <- factor(as.character(chem_i$chnm), levels = new_levels)
if(length(levels(chem_i$chnm)) > num_chem_to_keep+1){
just_right <- levels(chem_i$chnm)[1:num_chem_to_keep]
too_small <- levels(chem_i$chnm)[(num_chem_to_keep+1):length(levels(chem_i$chnm))]
too_small_text <- paste0("Other [",length(too_small),"]")
chem_i$chnm <- as.character(chem_i$chnm)
chem_i$chnm[chem_i$chnm %in% too_small] <- too_small_text
chem_i$chnm <- factor(chem_i$chnm, levels = c(just_right, too_small_text))
}
color_i <- color_6[1:length(levels(chem_i$chnm))]
names(color_i) <- levels(chem_i$chnm)
if(grepl("Other",names(color_i)[length(color_i)])){
color_i[length(color_i)] <- "grey77"
}
class_plots[[i]] <- whole_stack(chem_i, site_info, tox_list,
color_i, font_size,
category = "Chemical",
title = i)
}
rel_widths <- c(3.25,3,rep(c(1,3),2), 1, 4)
general_lp <- c(0.05,0.87)
```
```{r fig1, fig.height=13}
create_DL_plot(tox_list)
```
Figure SI 1: Exposure activity ratios (EARs) at the detection level for chemicals monitored with passive samplers in Great Lakes tributaries, 2010-2014.
```{r fig2A}
plot_grid(
class_plots[[ordered_class[1]]]$chem_count,
class_plots[[ordered_class[1]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[2]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[2]]]$no_axis +
theme(legend.position = general_lp ,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[3]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[3]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[4]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[4]]]$no_axis +
theme(legend.position = c(0.015, 0.84),
strip.text.y =
element_text(size = 1.25*font_size),
axis.title.x = element_blank()),
rel_widths = rel_widths,
nrow = 1, labels = c("A")
)
```
\begin{center}
Sum of Maximum EAR\textsubscript{chem} Values
\end{center}
Figure SI 2-A: Maximum exposure-activity ratios (EAR) for `r paste0(tolower(ordered_class[1:4]), collapse = ", ")` computed from passive sampler chemistry data from 69 Great Lakes tributaries collected in 2010 and 2014 for chemicals included in the ToxCast database. [Site names are followed parenthetically by the map names from Figure 1; # Chems, number of chemicals with computed EAR values; EAR~chem~, exposure activity ratio]")
```{r fig2B}
plot_grid(
class_plots[[ordered_class[5]]]$chem_count ,
class_plots[[ordered_class[5]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[6]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[6]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[7]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[7]]]$no_axis +
theme(legend.position = general_lp ,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[8]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[8]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_text(size = 1.25*font_size),
axis.title.x = element_blank()),
rel_widths = rel_widths,
nrow = 1, labels = c("B")
)
```
\begin{center}
Sum of Maximum EAR\textsubscript{chem} Values
\end{center}
Figure SI 2-B: Maximum exposure-activity ratios (EAR) for `r paste0(tolower(ordered_class[5:8]), collapse = ", ")` computed from passive sampler chemistry data from 69 Great Lakes tributaries collected in 2010 and 2014 for chemicals included in the ToxCast database. [Site names are followed parenthetically by the map names from Figure 1; # Chems, number of chemicals with computed EAR values; EAR~chem~, exposure activity ratio]")
```{r fig2C}
plot_grid(
class_plots[[ordered_class[9]]]$chem_count ,
class_plots[[ordered_class[9]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[10]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[10]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[11]]]$chem_count +
theme(axis.text.y = element_blank()),
class_plots[[ordered_class[11]]]$no_axis +
theme(legend.position = c(0.025, 0.92) ,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[12]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[12]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_text(size = 1.25*font_size),
axis.title.x = element_blank()),
rel_widths = rel_widths,
nrow = 1, labels = c("C")
)
```
\begin{center}
Sum of Maximum EAR\textsubscript{chem} Values
\end{center}
Figure SI 2-C: Maximum exposure-activity ratios (EAR) for `r paste0(tolower(ordered_class[9:12]), collapse = ", ")` computed from passive sampler chemistry data from 69 Great Lakes tributaries collected in 2010 and 2014 for chemicals included in the ToxCast database. [Site names are followed parenthetically by the map names from Figure 1; # Chems, number of chemicals with computed EAR values; EAR~chem~, exposure activity ratio]")
```{r fig2D}
plot_grid(
class_plots[[ordered_class[13]]]$chem_count ,
class_plots[[ordered_class[13]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[14]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[14]]]$no_axis +
theme(legend.position = general_lp,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[15]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[15]]]$no_axis +
theme(legend.position = c(0.05, 0.92) ,
strip.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[16]]]$chem_count +
theme(axis.text.y = element_blank(),
axis.title.x = element_blank()),
class_plots[[ordered_class[16]]]$no_axis +
theme(legend.position = c(0.05, 0.90),
strip.text.y = element_text(size = 1.25*font_size),
axis.title.x = element_blank()),
rel_widths = rel_widths,
nrow = 1, labels = c("D")
)
```
\begin{center}
Sum of Maximum EAR\textsubscript{chem} Values
\end{center}
Figure SI 2-D: Maximum exposure-activity ratios (EAR) for `r paste0(tolower(ordered_class[12:16]), collapse = ", ")` computed from passive sampler chemistry data from 69 Great Lakes tributaries collected in 2010 and 2014 for chemicals included in the ToxCast database. [Site names are followed parenthetically by the map names from Figure 1; # Chems, number of chemicals with computed EAR values; EAR~chem~, exposure activity ratio]")
```{r fig3}
plot_mixes()
```
Figure SI 3: Monitoring sites with exposure activity ratios > 10-3 at 10% or more of monitored sites for gene targets and associated chemical mixtures as defined in Table 1.