-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCPS Cilantro Scenarios Figures.Rmd
487 lines (363 loc) · 20.5 KB
/
CPS Cilantro Scenarios Figures.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
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
---
title: "Baseline 1"
author: "UIUC"
date: "2023-01-11"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(ggplot2)
library(scales)
library(reshape2)
library(tidyverse)
library(ggnewscale)
```
```{r}
BS1 <- read.csv(file = "Data/Baseline1-upd.csv", header = TRUE )
Order<-(BS1$Scenarios2[1:15])
BS1$Scenarios <- as.factor(BS1$Scenarios)
BS1$Scenarios2 <- as.factor(BS1$Scenarios2)
BS1$Relative_Efficacy <-as.numeric(BS1$Detection_Rate)
BS1
Fig1 <- ggplot(BS1, aes(fill=Contamination, x=factor(Scenarios2, levels = rev(Order)), y=Relative_Efficacy)) +
geom_bar(position = "dodge", stat = "identity") +
labs(title="Unintentional irrigation with contaminated water \nevery day of a growing cycle", y="Overall Detection Rate", x="Sampling Scenario")+
scale_fill_discrete(name = "Contamination \nLevel")+#(values=c("#FF3366","#99CCFF")) +
#scale_y_continuous(labels = scales::percent)+
theme_bw()+
theme(plot.title = element_text(hjust = 0.5))+
#theme(axis.text.x = element_text(angle=45, vjust=1, hjust=1))+
coord_flip()+
theme(axis.text.x=element_text(size =12), axis.text.y=element_text(size =12),axis.title = element_text(size = 12))
Fig1
ggsave("Baseline1-Updated.jpg", width =9, height = 7, units = "in", dpi = 300)
```
```{r}
BS2 <- read.csv(file = "Data/Baseline2-upd.csv", header = TRUE )
Order<-(BS2$Scenarios2[1:15])
BS2$Scenarios <- as.factor(BS2$Scenarios)
BS2$Scenarios2 <- as.factor(BS2$Scenarios2)
BS2$Relative_Efficacy <-as.numeric(BS2$Detection_Rate)
BS2
Fig2 <- ggplot(BS2, aes(fill=Contamination, x=factor(Scenarios2, levels = rev(Order)), y=Relative_Efficacy)) +
geom_bar(position = "dodge", stat = "identity") +
labs(title="Unintentional irrigation with contaminated water\n one random day of a growing cycle", y="Overall Detection Rate", x="Sampling Scenario")+
scale_fill_discrete(name = "Contamination \nLevel")+#(values=c("#FF3366","#99CCFF")) +
#scale_y_continuous(labels = scales::percent)+
theme_bw()+
theme(plot.title = element_text(hjust = 0.5))+
#theme(axis.text.x = element_text(angle=45, vjust=1, hjust=1))+
coord_flip()+
theme(axis.text.x=element_text(size =12), axis.text.y=element_text(size =12),axis.title = element_text(size = 12))
#theme(legend.position=c(0.75, 0.70))
Fig2
ggsave("Baseline2-Updated.jpg", width =9, height = 7, units = "in", dpi = 300)
```
```{r}
Baseline_Binded<-rbind(BS1, BS2)
Baseline_Binded %>%
ggplot(aes(y= factor(Scenarios2, levels = rev(Order)), x = Detection_Rate, fill = Test_Type, alpha = Contamination))+
geom_col(color= "black")+
facet_grid(Type~Contamination, labeller = as_labeller(c("Daily Contamination " = "Daily Contamination" ,
"Random Contamination - Once" = "Random Contamintion\n Once per growing cycle",
"High" = "Contamination-High",
"Low" = "Contamination - Low")))+
theme_bw()+
theme(legend.position="bottom")+
scale_fill_discrete(name = "Test Type")+
scale_alpha_discrete(range = c(1, 0.8), )+
scale_fill_hue()+
scale_fill_manual(name = "Test Type:", values = c("Produce" = "darkgreen", "Water" = "darkblue", "Both" = "steelblue"))+
labs(title="Unintentional irrigation with contaminated water", x="Probability of Detection", y="Sampling Scenario")+
guides(alpha = FALSE)
ggsave("Combined-UpdatedR2.jpg", width =7, height = 6, units = "in", dpi = 300)
```
```{r}
BS3 <- read.csv(file = "Data/Baseline3-Supplemental.csv", header = TRUE )
Order<-(BS3$Scenarios2[1:15])
BS3$Scenarios <- as.factor(BS3$Scenarios)
BS3$Scenarios2 <- as.factor(BS3$Scenarios2)
BS3$Relative_Efficacy <-as.numeric(BS3$Detection_Rate)
BS3
Fig2 <- ggplot(BS3, aes(x=factor(Scenarios2, levels = rev(Order)), y=Relative_Efficacy,fill = Test_Type)) +
geom_bar(position = "dodge", stat = "identity") +
labs(title="Water is always contaminated, irrigation 4 times per season\n total 6 inches irrigated in 5,000 lb acre", y="Overall Detection Rate", x="Sampling Scenario")+
scale_fill_discrete(name = "Contamination \nLevel")+#(values=c("#FF3366","#99CCFF")) +
#scale_y_continuous(labels = scales::percent)+
theme_bw()+
theme(plot.title = element_text(hjust = 0.5))+
#theme(axis.text.x = element_text(angle=45, vjust=1, hjust=1))+
coord_flip()+
theme(axis.text.x=element_text(size =12), axis.text.y=element_text(size =12),axis.title = element_text(size = 12))+
scale_fill_manual(name = "Test Type:", values = c("Produce" = "darkgreen", "Water" = "darkblue", "Both" = "steelblue"))+
#theme(legend.position=c(0.75, 0.70))+
facet_grid(~Contamination)
Fig2
```
```{r}
BS4 <- read.csv(file = "Data/Baseline4-Supplemental.csv", header = TRUE )
Order<-(BS4$Scenarios2[1:15])
BS4$Scenarios <- as.factor(BS4$Scenarios)
BS4$Scenarios2 <- as.factor(BS4$Scenarios2)
BS4$Relative_Efficacy <-as.numeric(BS4$Detection_Rate)
BS4
Fig2 <- ggplot(BS4, aes(x=factor(Scenarios2, levels = rev(Order)), y=Relative_Efficacy,fill = Test_Type)) +
geom_bar(position = "dodge", stat = "identity") +
labs(title="Water is always contaminated, irrigation 4 times per season\n total 6 inches irrigated in 5,000 lb acre", y="Probability of Detection", x="Sampling Scenario")+
scale_fill_discrete(name = "Contamination \nLevel")+#(values=c("#FF3366","#99CCFF")) +
#scale_y_continuous(labels = scales::percent)+
theme_bw()+
theme(plot.title = element_text(hjust = 0.5))+
#theme(axis.text.x = element_text(angle=45, vjust=1, hjust=1))+
coord_flip()+
theme(axis.text.x=element_text(size =12), axis.text.y=element_text(size =12),axis.title = element_text(size = 12))+
scale_fill_manual(name = "Test Type:", values = c("Produce" = "darkgreen", "Water" = "darkblue", "Both" = "steelblue"))+
#theme(legend.position=c(0.75, 0.70))+
facet_grid(~Contamination)
Fig2
```
```{r}
Baseline_Binded<-rbind(BS3, BS4)
Baseline_Binded %>%
ggplot(aes(y= factor(Scenarios2, levels = rev(Order)), x = Detection_Rate, fill = Test_Type, alpha = Contamination))+
geom_col(color= "black")+
facet_grid(Type~Contamination, labeller = as_labeller(c("Daily Contamination " = "Daily Contamination" ,
"Random Contamination - Once" = "Random Contamintion\n Once per growing cycle",
"High" = "Contamination-High",
"Low" = "Contamination - Low")))+
theme_bw()+
theme(legend.position="bottom")+
scale_fill_discrete(name = "Test Type")+
scale_alpha_discrete(range = c(1, 0.8), )+
scale_fill_hue()+
scale_fill_manual(name = "Test Type:", values = c("Produce" = "darkgreen", "Water" = "darkblue", "Both" = "steelblue"))+
labs(title="Unintentional irrigation with contaminated water\n 5k lb yield, irrigation 4 times per season\n for total of 6 inches", x="Probability of Detection", y="Sampling Scenario")+
guides(alpha = FALSE)
ggsave("Suplemental Combined-Updated.jpg", width =7, height = 6, units = "in", dpi = 300)
```
```{r}
#together:
H_DPT<-read.csv(file = "Data/Detection_Rates_High_DPT_LOC-r2.csv")
H_DPT$Level = "Contamination - High"
H_DPT$Type = "Produce Testing - Daily"
H_FPT<-read.csv(file = "Data/Detection_Rates_High_FPT_LOC-r2.csv")
H_FPT$Level = "Contamination - High"
H_FPT$Type = "Produce Testing 1 sample - End"
H_FPT_10s<-read.csv(file = "Data/Detection_Rates_High_10s_FPT_LOC-r2.csv")
H_FPT_10s$Level = "Contamination - High"
H_FPT_10s$Type = "Produce Testing 10 samples - End"
H_FPT_45s<-read.csv(file = "Data/Detection_Rates_High_45s_FPT_LOC-r2.csv")
H_FPT_45s$Level = "Contamination - High"
H_FPT_45s$Type = "Produce Testing 45 samples - End"
L_DPT<-read.csv(file = "Data/Detection_Rates_Low_DPT_LOC-r2.csv")
L_DPT$Level = "Contamination - Low"
L_DPT$Type = "Produce Testing - Daily"
L_FPT<-read.csv(file = "Data/Detection_Rates_Low_FPT_LOC-r2.csv")
L_FPT$Level = "Contamination - Low"
L_FPT$Type = "Produce Testing 1 sample - End"
L_FPT_10s<-read.csv(file = "Data/Detection_Rates_Low_10s_FPT_LOC-r2.csv")
L_FPT_10s$Level = "Contamination - Low"
L_FPT_10s$Type = "Produce Testing 10 samples - End"
L_FPT_45s<-read.csv(file = "Data/Detection_Rates_Low_45s_FPT_LOC-r2.csv")
L_FPT_45s$Level = "Contamination - Low"
L_FPT_45s$Type = "Produce Testing 45 samples - End"
Detection_Rates_Binded = rbind(H_DPT,H_FPT,L_DPT,L_FPT,L_FPT_10s,H_FPT_10s,L_FPT_45s,H_FPT_45s)
Detection_Rates_Binded<-Detection_Rates_Binded[,-1]
Detection_Rates_Binded$Cluster<-round(Detection_Rates_Binded$Cluster,1)
Detection_Rates_Binded$Cluster<-as.factor(Detection_Rates_Binded$Cluster)
write.csv(Detection_Rates_Binded,file = "Data/DetectionRatesBinded-r2.csv")
Detection_Rates_Binded %>%
ggplot(aes(x = Cluster, y = Drates))+
geom_col(aes(fill = "Pdetect"), color = "black")+
scale_fill_manual(name = "", values = c("Pdetect" = "skyblue"))+
geom_point(aes( y = assay_rate, color = "black", fill = "Detection Rate Assay",shape = "Detection Rate Assay"), size =2,show_guide = T)+
geom_line(aes( y = assay_rate, group=1,color = "Detection Rate Assay"))+
geom_point(aes( y = samp_rate, fill = "Detection Rate Sample",color = "black",shape = "Detection Rate Sample"), size =2)+
geom_line(aes(y = samp_rate, group=1,color = "Detection Rate Sample"))+
labs(x = "Contamination Spread", y = "Overall Detection Rate")+
scale_color_manual(name = "", values = c("Detection Rate Sample" = "coral", "Detection Rate Assay" = "black"))+
scale_fill_manual(name = "", values = c("Detection Rate Sample" = "coral", "Detection Rate Assay" = "black"))+
scale_shape_manual(name = "", values = c("Detection Rate Sample" = 21, "Detection Rate Assay" = 22))+
scale_x_discrete(labels = function(x) paste0(x, "%"))+
theme_bw()+
theme(legend.position="bottom")+
facet_grid(Level~Type)
Detection_Rates_Binded %>%
ggplot(aes(x = Cluster, y = Drates))+
geom_col(aes(fill = "Pdetect"),color = "black")+
geom_point(aes( y = assay_rate, color = "Detection Rate Assay",shape = "Detection Rate Assay"), size =2)+
geom_line(aes( y = assay_rate, group=1,color = "Detection Rate Assay"))+
geom_point(aes( y = samp_rate,color = "Detection Rate Sample",shape = "Detection Rate Sample", ), size =2)+
geom_line(aes(y = samp_rate, group=1,color = "Detection Rate Sample"))+
scale_color_manual(name = "", values = c("Detection Rate Sample" = "coral", "Detection Rate Assay" = "black"), labels = c("Assay probability of detection\nif >0 oocysts in sample(s)", "Probability of collecting >0\n oocysts in sample"))+
scale_fill_manual(name = "", values = c("Pdetect" = "skyblue"),labels = c("Probability of detection \nsampling scheme"))+
scale_shape_manual(name = "", values = c("Detection Rate Sample" = 15, "Detection Rate Assay" = 16),labels = c("Assay probability of detection\nif >0 oocysts in sample(s)", "Probability of collecting >0\n oocysts in sample"))+
scale_linetype_manual(name = " ",values = 1, labels = c("Probability of detection \nsampling scheme")) +
scale_x_discrete(labels = function(x) paste0(x, "%"))+
theme_bw()+
theme(legend.position="bottom")+
theme(axis.text.x = element_text(angle = -45, vjust = -0.3))+
labs(x = "Contamination Spread", y = "Probability")+
facet_grid(Level~Type)
ggsave("Detection_Rates-r2.jpg", width =9, height = 6, units = "in", dpi = 300)
```
##Additional Scenarios
```{r}
#together:
H_DPT<-read.csv(file = "Detection_Rates_High_DPT_LOC_5k.csv")
H_DPT$Level = "Contamination - High"
H_DPT$Type = "Produce Testing - Daily"
H_FPT<-read.csv(file = "Detection_Rates_High_FPT_LOC_5k.csv")
H_FPT$Level = "Contamination - High"
H_FPT$Type = "Produce Testing 1 sample - End"
H_FPT_10s<-read.csv(file = "Detection_Rates_High_10s_FPT_LOC_5k.csv")
H_FPT_10s$Level = "Contamination - High"
H_FPT_10s$Type = "Produce Testing 10 samples - End"
H_FPT_45s<-read.csv(file = "Detection_Rates_High_45s_FPT_LOC_5k.csv")
H_FPT_45s$Level = "Contamination - High"
H_FPT_45s$Type = "Produce Testing 45 samples - End"
L_DPT<-read.csv(file = "Detection_Rates_Low_DPT_LOC_5k.csv")
L_DPT$Level = "Contamination - Low"
L_DPT$Type = "Produce Testing - Daily"
L_FPT<-read.csv(file = "Detection_Rates_Low_FPT_LOC_5k.csv")
L_FPT$Level = "Contamination - Low"
L_FPT$Type = "Produce Testing 1 sample - End"
L_FPT_10s<-read.csv(file = "Detection_Rates_Low_10s_FPT_LOC_5k.csv")
L_FPT_10s$Level = "Contamination - Low"
L_FPT_10s$Type = "Produce Testing 10 samples - End"
L_FPT_45s<-read.csv(file = "Detection_Rates_Low_45s_FPT_LOC_5k.csv")
L_FPT_45s$Level = "Contamination - Low"
L_FPT_45s$Type = "Produce Testing 45 samples - End"
Detection_Rates_Binded = rbind(H_DPT,H_FPT,L_DPT,L_FPT,L_FPT_10s,H_FPT_10s,L_FPT_45s,H_FPT_45s)
Detection_Rates_Binded<-Detection_Rates_Binded[,-1]
Detection_Rates_Binded$Cluster<-round(Detection_Rates_Binded$Cluster,1)
Detection_Rates_Binded$Cluster<-as.factor(Detection_Rates_Binded$Cluster)
Detection_Rates_Binded %>%
ggplot(aes(x = Cluster, y = Drates))+
geom_col(aes(fill = "Pdetect"), color = "black")+
scale_fill_manual(name = "", values = c("Pdetect" = "skyblue"))+
geom_point(aes( y = assay_rate, color = "black", fill = "Detection Rate Assay",shape = "Detection Rate Assay"), size =2,show_guide = T)+
geom_line(aes( y = assay_rate, group=1,color = "Detection Rate Assay"))+
geom_point(aes( y = samp_rate, fill = "Detection Rate Sample",color = "black",shape = "Detection Rate Sample"), size =2)+
geom_line(aes(y = samp_rate, group=1,color = "Detection Rate Sample"))+
labs(x = "Contamination Spread", y = "Overall Detection Rate")+
scale_color_manual(name = "", values = c("Detection Rate Sample" = "coral", "Detection Rate Assay" = "black"))+
scale_fill_manual(name = "", values = c("Detection Rate Sample" = "coral", "Detection Rate Assay" = "black"))+
scale_shape_manual(name = "", values = c("Detection Rate Sample" = 21, "Detection Rate Assay" = 22))+
scale_x_discrete(labels = function(x) paste0(x, "%"))+
theme_bw()+
theme(legend.position="bottom")+
facet_grid(Level~Type)
Detection_Rates_Binded %>%
ggplot(aes(x = Cluster, y = Drates))+
geom_col(aes(fill = "Pdetect"),color = "black")+
geom_point(aes( y = assay_rate, color = "Detection Rate Assay",shape = "Detection Rate Assay"), size =2)+
geom_line(aes( y = assay_rate, group=1,color = "Detection Rate Assay"))+
geom_point(aes( y = samp_rate,color = "Detection Rate Sample",shape = "Detection Rate Sample", ), size =2)+
geom_line(aes(y = samp_rate, group=1,color = "Detection Rate Sample"))+
scale_color_manual(name = "", values = c("Detection Rate Sample" = "coral", "Detection Rate Assay" = "black"), labels = c("Assay probability of detection\nif >0 oocysts in sample(s)", "Probability of collecting >0\n oocysts in sample"))+
scale_fill_manual(name = "", values = c("Pdetect" = "skyblue"),labels = c("Probability of detection \nsampling scheme"))+
scale_shape_manual(name = "", values = c("Detection Rate Sample" = 15, "Detection Rate Assay" = 16),labels = c("Assay probability of detection\nif >0 oocysts in sample(s)", "Probability of collecting >0\n oocysts in sample"))+
scale_linetype_manual(name = " ",values = 1, labels = c("Probability of detection \nsampling scheme")) +
scale_x_discrete(labels = function(x) paste0(x, "%"))+
theme_bw()+
theme(legend.position="bottom")+
theme(axis.text.x = element_text(angle = -45, vjust = -0.3))+
labs(x = "Contamination Spread", y = "Probability")+
facet_grid(Level~Type)
ggsave("Detection_Rates-2.0 Supplemental.jpg", width =9, height = 6, units = "in", dpi = 300)
```
```{r}
######
Detection_Rates_High_DPT<-read.csv(file = "Detection_Rates_High_DPT_LOC.csv")
Detection_Rates_High_DPT<-Detection_Rates_High_DPT[,-1]
Detection_Rates_High_DPT$Cluster<-round(Detection_Rates_High_DPT$Cluster,1)
Detection_Rates_High_DPT$Cluster<-as.factor(Detection_Rates_High_DPT$Cluster)
Detection_Rates_High_DPT %>%
ggplot(aes(x = Cluster, y = Drates))+
geom_col(fill = "skyblue", color = "black")+
geom_point(aes( y = assay_rate, color = "black", fill = "Detection Rate Assay"), shape = 21, size =2,show_guide = T)+
geom_line(aes( y = assay_rate, group=1,color = "Detection Rate Assay"))+
geom_point(aes( y = samp_rate, fill = "Detection Rate Sample",color = "black"), shape = 21, size =2)+
geom_line(aes(y = samp_rate, group=1,color = "Detection Rate Sample"))+
labs(x = "Contamination Spread", y = "Overall Detection Rate")+
scale_color_manual(name = "", values = c("Detection Rate Sample" = "coral", "Detection Rate Assay" = "black"))+
scale_fill_manual(name = "", values = c("Detection Rate Sample" = "coral", "Detection Rate Assay" = "black"))+
scale_x_discrete(labels = function(x) paste0(x, "%"))
theme_bw()
##############
Detection_Rates_High_DPT<-read.csv(file = "Detection_Rates_High_FPT_LOC.csv")
Detection_Rates_High_DPT<-Detection_Rates_High_DPT[,-1]
Detection_Rates_High_DPT$Cluster<-round(Detection_Rates_High_DPT$Cluster,1)
Detection_Rates_High_DPT$Cluster<-as.factor(Detection_Rates_High_DPT$Cluster)
Detection_Rates_High_DPT %>%
ggplot()+
geom_col(aes(x = Cluster, y = Drates),fill = "skyblue", color = "black")+
geom_point(aes(x= Cluster, y = assay_rate), color = "black", fill = "black", shape = 21, size =2)+
geom_line(aes(x= Cluster, y = assay_rate), color = "black")+
geom_point(aes(x = Cluster, y = samp_rate), fill = "coral",color = "black", shape = 21, size =2)+
labs(x = "Contamination Spread", y = "OVerall Detection Rate")+
theme_bw()
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Detection_Rates_High_DPT<-read.csv(file = "Detection_Rates_Low_DPT_LOC.csv")
Detection_Rates_High_DPT<-Detection_Rates_High_DPT[,-1]
Detection_Rates_High_DPT$Cluster<-round(Detection_Rates_High_DPT$Cluster,1)
Detection_Rates_High_DPT$Cluster<-as.factor(Detection_Rates_High_DPT$Cluster)
Detection_Rates_High_DPT %>%
ggplot()+
geom_col(aes(x = Cluster, y = Drates),fill = "skyblue", color = "black")+
geom_point(aes(x= Cluster, y = assay_rate), color = "black", fill = "black", shape = 21, size =2)+
geom_point(aes(x = Cluster, y = samp_rate), fill = "coral",color = "black", shape = 21, size =2)+
labs(x = "Contamination Spread", y = "Detection Rate")+
theme_bw()
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Detection_Rates_High_DPT<-read.csv(file = "Detection_Rates_Low_FPT_LOC.csv")
Detection_Rates_High_DPT<-Detection_Rates_High_DPT[,-1]
Detection_Rates_High_DPT$Cluster<-round(Detection_Rates_High_DPT$Cluster,1)
Detection_Rates_High_DPT$Cluster<-as.factor(Detection_Rates_High_DPT$Cluster)
Detection_Rates_High_DPT %>%
ggplot()+
geom_col(aes(x = Cluster, y = Drates),fill = "skyblue", color = "black")+
geom_point(aes(x= Cluster, y = assay_rate), color = "black", fill = "black", shape = 21, size =2)+
geom_point(aes(x = Cluster, y = samp_rate), fill = "coral",color = "black", shape = 21, size =2)+
labs(x = "Contamination Spread", y = "Detection Rate")+
theme_bw()
##%###########################################################
Detection_Rates_High_DPT<-read.csv(file = "Detection_Rates_Low_10s_FPT_LOC.csv")
Detection_Rates_High_DPT<-Detection_Rates_High_DPT[,-1]
Detection_Rates_High_DPT$Cluster<-round(Detection_Rates_High_DPT$Cluster,1)
Detection_Rates_High_DPT$Cluster<-as.factor(Detection_Rates_High_DPT$Cluster)
Detection_Rates_High_DPT %>%
ggplot()+
geom_col(aes(x = Cluster, y = Drates),fill = "skyblue", color = "black")+
geom_point(aes(x= Cluster, y = assay_rate), color = "black", fill = "black", shape = 21, size =2)+
geom_point(aes(x = Cluster, y = samp_rate), fill = "coral",color = "black", shape = 21, size =2)+
labs(x = "Contamination Spread", y = "Detection Rate")+
theme_bw()
##%###########################################################
Detection_Rates_High_DPT<-read.csv(file = "Detection_Rates_High_10s_FPT_LOC.csv")
Detection_Rates_High_DPT<-Detection_Rates_High_DPT[,-1]
Detection_Rates_High_DPT$Cluster<-round(Detection_Rates_High_DPT$Cluster,1)
Detection_Rates_High_DPT$Cluster<-as.factor(Detection_Rates_High_DPT$Cluster)
Detection_Rates_High_DPT %>%
ggplot()+
geom_col(aes(x = Cluster, y = Drates),fill = "skyblue", color = "black")+
geom_point(aes(x= Cluster, y = assay_rate), color = "black", fill = "black", shape = 21, size =2)+
geom_point(aes(x = Cluster, y = samp_rate), fill = "coral",color = "black", shape = 21, size =2)+
labs(x = "Contamination Spread", y = "Detection Rate")+
theme_bw()
```
```{r}
PS_High <- read.csv(file = "Detection_Rates_High_FPT.csv", header = TRUE )
PS_High<-PS_High[,-1]
PS_High<-melt(PS_High)
PS_High %>%
group_by(variable) %>%
summarise(mean = mean(value), q25 = quantile(value, 0.05), q975 = quantile(value, 0.95)) %>%
ggplot(aes(x = variable, y = mean, ymin = q25, ymax = q975))+
geom_col()+
#coord_flip()+
labs(x = "Contamination Cluster", y = "Detection Rate")
```