-
Notifications
You must be signed in to change notification settings - Fork 6
/
figures.Rmd
522 lines (393 loc) · 19.2 KB
/
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
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
---
title: "Figures"
output:
html_document:
toc: yes
html_notebook:
code_folding: hide
df_print: paged
highlight: kate
theme: yeti
toc: yes
---
```{r load libraries, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
# # initiate git repository
# system('git config --global user.email "[email protected]"')
# system('git config --global user.name "shannon"')
source("scr/libraries.R")
source("scr/ggplot.R")
source("scr/VCFfilterstats.R")
# source("scr/HaplotypR.R")
source("scr/xtrafunctions.R")
# source("scr/genind.R")
```
# Figure 1: Library effects
```{r}
# load data
LibEffect <- read.table("data/SNAPPER/Snapper_LibEffect.txt",
header = TRUE, stringsAsFactors = FALSE)
# View(LibEffect)
# Cairo(width = 8, height = 4,
# file = "results/fig/Figure1.png", type = "png", pointsize = 12,
# bg = "transparent", canvas = "white",
# units = "in", dpi = 300)
#
# # plot
# ggplot(LibEffect, aes(x = LD1, y = LD2, fill = Library, shape = Library)) +
# geom_point(size = 2) +
# labs(x = "PC1", y = "PC2") +
# facet_grid(. ~ LIBEFFECT) +
# scale_fill_manual(values = c("#258039", "#F5BE41", "#CF3721", "#375E97")) +
# scale_shape_manual(values = c(21, 22, 23, 24)) +
# theme_standard
#
# dev.off()
# library(svglite)
# svg("results/fig/Figure1.svg", width = 14, height = 7)
ggplot(LibEffect, aes(x = LD1, y = LD2, fill = Library, shape = Library)) +
geom_point(size = 2, stroke = 0.25) +
labs(x = "PC1", y = "PC2") +
facet_grid(. ~ LIBEFFECT) +
scale_fill_manual(values = c("#258039", "#F5BE41", "#CF3721", "#375E97")) +
scale_shape_manual(values = c(21, 22, 23, 24)) +
theme_standard
# dev.off()
ggsave("results/fig/Figure1.svg", device = "svg", scale = 1,
width = 169, height = 120, units = "mm", dpi = 300)
```
# Figure 2: Distribution of missing data red snapper
```{r, fig.height=6, fig.width=8}
# Figure 2a ----
raw_lmiss_rs <- read.table("results/SNAPPER_raw.lmiss",
header = TRUE, stringsAsFactors = FALSE)
ggplot(raw_lmiss_rs, aes(x = F_MISS)) +
geom_histogram(binwidth = .025, color = "black", fill = "#F5BE41") +
geom_vline(aes(xintercept = mean(F_MISS, na.rm = TRUE)),
color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(aes(xintercept = 0.1),
color = "#375E97", linetype = "dotted", size = 1) +
scale_x_continuous(limits = c(0, 1)) +
scale_y_continuous(limits = c(0, 150000)) +
labs(x = " ", y = "number of loci") +
theme_standard
ggsave("results/fig/Figure2a.svg", device = "svg", scale = 1,
width = 80, height = 60, units = "mm", dpi = 300)
# Figure 2b ----
minQ20minDP5meanDP10_lmiss_rs <- read.table("results/SNAPPER_minQ20minDP5meanDP10.lmiss",
header = TRUE, stringsAsFactors = FALSE)
ggplot(minQ20minDP5meanDP10_lmiss_rs, aes(x = F_MISS)) +
geom_histogram(binwidth = .025, color = "black", fill = "#F5BE41") +
geom_vline(aes(xintercept = mean(F_MISS, na.rm = TRUE)),
color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(aes(xintercept = 0.1),
color = "#375E97", linetype = "dotted", size = 1) +
scale_x_continuous(limits = c(0, 1)) +
labs(x = "missing data per locus", y = "number of loci") +
theme_standard
ggsave("results/fig/Figure2b.svg", device = "svg", scale = 1,
width = 80, height = 60, units = "mm", dpi = 300)
# Figure 2c ----
raw_imiss_rs <- read.table("results/SNAPPER_raw.imiss",
header = TRUE, stringsAsFactors = FALSE)
ggplot(raw_imiss_rs, aes(x = F_MISS)) +
geom_histogram(binwidth = .025, color = "black", fill = "#F5BE41") +
geom_vline(aes(xintercept = mean(F_MISS, na.rm = TRUE)),
color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(aes(xintercept = 0.25),
color = "#375E97", linetype = "dotted", size = 1) +
scale_x_continuous(limits = c(0, 1)) +
labs(x = " ", y = "number of indv") +
theme_standard
ggsave("results/fig/Figure2c.svg", device = "svg", scale = 1,
width = 80, height = 60, units = "mm", dpi = 300)
# Figure 2d ----
minQ20minDP5meanDP10_imiss_rs <- read.table("results/SNAPPER_minQ20minDP5meanDP10.imiss",
header = TRUE, stringsAsFactors = FALSE)
ggplot(minQ20minDP5meanDP10_imiss_rs, aes(x = F_MISS)) +
geom_histogram(binwidth = .025, color = "black", fill = "#F5BE41") +
geom_vline(aes(xintercept = mean(F_MISS, na.rm = TRUE)),
color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(aes(xintercept = 0.25),
color = "#375E97", linetype = "dotted", size = 1) +
scale_x_continuous(limits = c(0, 1)) +
labs(x = "missing data per indv", y = "number of indv") +
theme_standard
ggsave("results/fig/Figure2d.svg", device = "svg", scale = 1,
width = 80, height = 60, units = "mm", dpi = 300)
```
# Figure 3: Distribution of missing data southern Flounder
```{r, fig.height=6, fig.width=8}
# Figure 3a ----
raw_lmiss_rs <- read.table("results/FLOUNDER_raw.lmiss",
header = TRUE, stringsAsFactors = FALSE)
ggplot(raw_lmiss_rs, aes(x = F_MISS)) +
geom_histogram(binwidth = .025, color = "black", fill = "#F5BE41") +
geom_vline(aes(xintercept = mean(F_MISS, na.rm = TRUE)),
color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(aes(xintercept = 0.1),
color = "#375E97", linetype = "dotted", size = 1) +
scale_x_continuous(limits = c(0, 1)) +
labs(x = " ", y = "number of loci") +
theme_standard
ggsave("results/fig/Figure3a.svg", device = "svg", scale = 1,
width = 80, height = 60, units = "mm", dpi = 300)
# Figure 3b ----
minQ20minDP5meanDP10_lmiss_rs <- read.table("results/FLOUNDER_minQ20minDP5meanDP10.lmiss",
header = TRUE, stringsAsFactors = FALSE)
ggplot(minQ20minDP5meanDP10_lmiss_rs, aes(x = F_MISS)) +
geom_histogram(binwidth = .025, color = "black", fill = "#F5BE41") +
geom_vline(aes(xintercept = mean(F_MISS, na.rm = TRUE)),
color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(aes(xintercept = 0.1),
color = "#375E97", linetype = "dotted", size = 1) +
scale_x_continuous(limits = c(0, 1)) +
labs(x = "missing data per locus", y = "number of loci") +
theme_standard
ggsave("results/fig/Figure3b.svg", device = "svg", scale = 1,
width = 80, height = 60, units = "mm", dpi = 300)
# Figure 3c ----
raw_imiss_rs <- read.table("results/FLOUNDER_raw.imiss",
header = TRUE, stringsAsFactors = FALSE)
ggplot(raw_imiss_rs, aes(x = F_MISS)) +
geom_histogram(binwidth = .025, color = "black", fill = "#F5BE41") +
geom_vline(aes(xintercept = mean(F_MISS, na.rm = TRUE)),
color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(aes(xintercept = 0.25),
color = "#375E97", linetype = "dotted", size = 1) +
scale_x_continuous(limits = c(0, 1)) +
labs(x = " ", y = "number of indv") +
theme_standard
ggsave("results/fig/Figure3c.svg", device = "svg", scale = 1,
width = 80, height = 60, units = "mm", dpi = 300)
# Figure 3d ----
minQ20minDP5meanDP10_imiss_rs <- read.table("results/FLOUNDER_minQ20minDP5meanDP10.imiss",
header = TRUE, stringsAsFactors = FALSE)
p4 <- ggplot(minQ20minDP5meanDP10_imiss_rs, aes(x = F_MISS)) +
geom_histogram(binwidth = .025, color = "black", fill = "#F5BE41") +
geom_vline(aes(xintercept = mean(F_MISS, na.rm = TRUE)),
color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(aes(xintercept = 0.25),
color = "#375E97", linetype = "dotted", size = 1) +
scale_x_continuous(limits = c(0, 1)) +
labs(x = "missing data per indv", y = "number of indv") +
theme_standard
ggsave("results/fig/Figure3d.svg", device = "svg", scale = 1,
width = 80, height = 60, units = "mm", dpi = 300)
```
# Figure 4: Depth distribution red snapper
```{r}
depth <- read.table("results/SNAPPER_FIL-4.ldepth.mean",
stringsAsFactors = FALSE, header = TRUE)
mode <- as.numeric(Mode(depth$MEAN_DEPTH))
quantile <- as.numeric(quantile(depth$MEAN_DEPTH, probs = c(.95)))
ggplot(depth, aes(x = MEAN_DEPTH)) +
geom_histogram(binwidth = 5, color = "black", fill = "#F5BE41") +
geom_vline(xintercept = 2*mode, color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(xintercept = quantile, color = "#375E97", linetype = "dotted", size = 1) +
labs(x = "mean depth per locus", y = "number of loci") +
theme_standard
ggsave("results/fig/Figure4.svg", device = "svg", scale = 1,
width = 160, height = 100, units = "mm", dpi = 300)
```
# Figure 5: Allele balance drum
Allele balance is the ratio of reads for reference allele to all reads, considering only reads from individuals called as heterozygous. Values range from 0 - 1; allele balance (for real loci) should be approx. 0.5. Filter contigs SNPs for which the with allele balance < 0.25 and > 0.75. Filter contigs with SNP calls with AB > 0.2, AB > 0.8; retain loci very close to 0 (retain loci that are fixed variants).
```{r, fig.height=7, fig.width=4}
read.table("data/DRUM/DRUM_raw.AB",
col.names = "AB", stringsAsFactors = FALSE) %>%
ggplot(aes(x = AB)) +
geom_histogram(binwidth = 0.02, color = "black", fill = "#F5BE41") +
geom_vline(xintercept = 0.5, color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(xintercept = 0.2, color = "#375E97", linetype = "dotted", size = 1) +
geom_vline(xintercept = 0.8, color = "#375E97", linetype = "dotted", size = 1) +
labs(x = " ") +
theme_standard
ggsave("results/fig/Figure5a.svg", device = "svg", scale = 1,
width = 160, height = 120, units = "mm", dpi = 300)
read.table("data/DRUM/DRUM_minQ20minDP5meanDP10geno70ind50.AB",
col.names = "AB", stringsAsFactors = FALSE) %>%
ggplot(aes(x = AB)) +
geom_histogram(binwidth = 0.02, color = "black", fill = "#F5BE41") +
geom_vline(xintercept = 0.5, color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(xintercept = 0.2, color = "#375E97", linetype = "dotted", size = 1) +
geom_vline(xintercept = 0.8, color = "#375E97", linetype = "dotted", size = 1) +
labs(x = " ") +
theme_standard
ggsave("results/fig/Figure5b.svg", device = "svg", scale = 1,
width = 160, height = 120, units = "mm", dpi = 300)
read.table("data/DRUM/DRUM_minQ20mac3minDP5meanDP10geno70ind50.AB",
col.names = "AB", stringsAsFactors = FALSE) %>%
ggplot(aes(x = AB)) +
geom_histogram(binwidth = 0.02, color = "black", fill = "#F5BE41") +
geom_vline(xintercept = 0.5, color = "#CF3721", linetype = "dashed", size = 1) +
geom_vline(xintercept = 0.2, color = "#375E97", linetype = "dotted", size = 1) +
geom_vline(xintercept = 0.8, color = "#375E97", linetype = "dotted", size = 1) +
labs(x = "Allele balance") +
theme_standard
ggsave("results/fig/Figure5c.svg", device = "svg", scale = 1,
width = 160, height = 120, units = "mm", dpi = 300)
```
# Figure 6 Map quality ratios
Remove loci based on ratio of mapping quality for reference and alternate allele, i.e. sites that have a high discrepancy between the mapping qualities of two alleles.
MQM: mapping quality for alternate allele
MQMR: Mapping quality reference allele
"MQM / MQMR > 0.25 & MQM / MQMR < 1.75"
```{r plot map qual ratios, fig.height=4, fig.width=8}
# plot mac filter
temp <- read.table("data/FLOUNDER/FLOUNDER_minQ20mac3minDP5meanDP10geno70ind50.MQM", col.names = "MQM")
mapqual <- read.table("data/FLOUNDER/FLOUNDER_minQ20mac3minDP5meanDP10geno70ind50.MQMR", col.names = "MQMR")
mapqual <- bind_cols(mapqual, temp) %>%
mutate(ratio = MQM/MQMR)
filter <- mapqual %>%
filter(ratio < 0.25 | ratio > 1.75)
ggplot(mapqual, aes(x = MQM, y = MQMR)) +
geom_point(shape = 1) +
geom_abline(intercept = 0, slope = 1, size = 1, color = "red", linetype = "dashed") +
geom_abline(intercept = 0, slope = 4, size = 1, color = "darkblue", linetype = "dashed") +
geom_abline(intercept = 0, slope = 0.571, size = 1, color = "darkblue", linetype = "dashed") +
geom_point(data = filter, aes(x = MQM, y = MQMR), shape = 1, color = "red") +
scale_x_continuous(limits = c(0, 65)) +
scale_y_continuous(limits = c(0, 65)) +
labs(x = "", y = "") +
theme_standard
ggsave("results/fig/Figure6a.png", device = "png", scale = 1,
width = 100, height = 85, units = "mm", dpi = 300)
# plot no mac filter
temp <- read.table("data/FLOUNDER/FLOUNDER_minQ20minDP5meanDP10geno70ind50.MQM", col.names = "MQM")
mapqual <- read.table("data/FLOUNDER/FLOUNDER_minQ20minDP5meanDP10geno70ind50.MQMR", col.names = "MQMR")
mapqual <- bind_cols(mapqual, temp) %>%
mutate(ratio = MQM/MQMR)
filter <- mapqual %>%
filter(ratio < 0.25 | ratio > 1.75)
ggplot(mapqual, aes(x = MQM, y = MQMR)) +
geom_point(shape = 1) +
geom_abline(intercept = 0, slope = 1, size = 1, color = "red", linetype = "dashed") +
geom_abline(intercept = 0, slope = 4, size = 1, color = "darkblue", linetype = "dashed") +
geom_abline(intercept = 0, slope = 0.571, size = 1, color = "darkblue", linetype = "dashed") +
geom_point(data = filter, aes(x = MQM, y = MQMR), shape = 1, color = "red") +
scale_x_continuous(limits = c(0, 65)) +
scale_y_continuous(limits = c(0, 65)) +
labs(x = " ", y = " ") +
theme_standard
ggsave("results/fig/Figure6b.png", device = "png", scale = 1,
width = 100, height = 85, units = "mm", dpi = 300)
```
# Figure 7: Strand balance
SRF: Number of reference observations on the forward strand
SRR: Number of reference observations on the reverse strand
SAF: Number of alternate observations on the forward strand
SAR: Number of alternate observations on the reverse strand
Paired end reads should not overlap, and a SNP site should only be covered by either the forward or reverse read (strand).
```{r plot strandedness, fig.height=4, fig.width=8, message=FALSE, warning=FALSE}
SAF <- read.table("data/SNAPPER/genome/SNAPPER_minQ20minDP5meanDP10geno70ind50.SAF",
col.names = "SAF")
SAR <- read.table("data/SNAPPER/genome/SNAPPER_minQ20minDP5meanDP10geno70ind50.SAR",
col.names = "SAR")
strands1 <- bind_cols(SAF, SAR)
SAF <- read.table("data/SNAPPER/genome/SNAPPER_minQ20mac3minDP5meanDP10geno70ind50.SAF",
col.names = "SAF")
SAR <- read.table("data/SNAPPER/genome/SNAPPER_minQ20mac3minDP5meanDP10geno70ind50.SAR",
col.names = "SAR")
strands2 <- bind_cols(SAF, SAR)
# plot no mac ----
ggplot(strands1, aes(x = SAF, y = SAR)) +
geom_point(shape = 1) +
geom_abline(intercept = 0, slope = 0.01, color = "darkblue", linetype = "dashed", size = 0.8) +
geom_abline(intercept = 0, slope = 100, color = "darkblue", linetype = "dashed", size = 0.8) +
labs(x = " ", y = " " ) +
scale_y_continuous(limits = c(0, 67000)) +
scale_x_continuous(limits = c(0, 67000)) +
theme_standard
ggsave("results/fig/Figure7a.png", device = "png", scale = 1,
width = 100, height = 85, units = "mm", dpi = 300)
scientific_10 <- function(x) {
parse(text = gsub("e", " %*% 10^", scales::scientific_format()(x)))
}
# plot no mac logarithmic----
ggplot(strands1, aes(x = SAF, y = SAR)) +
geom_point(shape = 1) +
geom_abline(intercept = 0, slope = 0.01, color = "darkblue", linetype = "dashed", size = 0.8) +
geom_abline(intercept = 0, slope = 100, color = "darkblue", linetype = "dashed", size = 0.8) +
labs(x = " ", y = " " ) +
scale_y_continuous(trans = "log10", labels = scientific_10,
limits = c(0.00001, 100010),
breaks = c(0, 0.00001, 0.001, 0.1, 10, 1000, 100000)) +
scale_x_continuous(trans = "log10", labels = scientific_10,
limits = c(0.00001, 100001),
breaks = c(0, 0.00001, 0.001, 0.1, 10, 1000, 100000)) +
theme_standard
ggsave("results/fig/Figure7a_log.png", device = "png", scale = 1,
width = 110, height = 85, units = "mm", dpi = 300)
# plot mac ----
ggplot(strands2, aes(x = SAF, y = SAR)) +
geom_point(shape = 1) +
geom_abline(intercept = 0, slope = 0.01, color = "darkblue", linetype = "dashed", size = 0.8) +
geom_abline(intercept = 0, slope = 100, color = "darkblue", linetype = "dashed", size = 0.8) +
labs(x = " ", y = " " ) +
scale_y_continuous(limits = c(0, 67000)) +
scale_x_continuous(limits = c(0, 67000)) +
theme_standard
ggsave("results/fig/Figure7b.png", device = "png", scale = 1,
width = 100, height = 85, units = "mm", dpi = 300)
# plot mac logarithmic ----
ggplot(strands2, aes(x = SAF, y = SAR)) +
geom_point(shape = 1) +
geom_abline(intercept = 0, slope = 0.01, color = "darkblue", linetype = "dashed", size = 0.8) +
geom_abline(intercept = 0, slope = 100, color = "darkblue", linetype = "dashed", size = 0.8) +
labs(x = " ", y = " " ) +
scale_y_continuous(trans = "log10", labels = scientific_10,
limits = c(0.00001, 100010),
breaks = c(0, 0.00001, 0.001, 0.1, 10, 1000, 100000)) +
scale_x_continuous(trans = "log10", labels = scientific_10,
limits = c(0.00001, 100001),
breaks = c(0, 0.00001, 0.001, 0.1, 10, 1000, 100000)) +
theme_standard
ggsave("results/fig/Figure7b_log.png", device = "png", scale = 1,
width = 110, height = 85, units = "mm", dpi = 300)
```
Keep SNP sites that have > 100x more forward alternate reads than reverse alternate reads and > 100x more forward reverse reads than reverse alternate reads.
# Figure 8: high read depth/qual
```{r plot depth vs qual II}
# depth
depth <- read.table("data/BONNET/BONNET_minQ20minDP5meanDP10geno70ind50.DEPTH",
col.names = "depth")
# quality score
qual <- read.table("data/BONNET/BONNET_minQ20minDP5meanDP10geno70ind50.QUAL",
col.names = c("locus", "pos", "qual"))
# mean depth
mean_depth <- mean(depth$depth)
# standard deviation
std <- sd(depth$depth)
# mode
mode <- Mode(depth$depth)
cutoff <- sum(mean_depth + (2*std))
# identify SNP sites with depth > mean depth + 1 standard deviation and quality score < 2x the depth at that site
temp <- bind_cols(qual, depth) %>%
filter(depth > cutoff) %>%
filter(qual < 2*depth) %>%
select(locus)
write.table(temp, "data/DRUM//DEPTH.lowQloci", col.names = FALSE, row.names = FALSE, quote = FALSE)
df <- bind_cols(qual, depth) %>%
mutate(qualcutoff = 2*depth)
removeloc <- df %>%
filter(depth > cutoff) %>%
filter(qual < 2*depth)
ggplot(df, aes(x = depth, y = qual)) +
geom_point(shape = 1) +
geom_point(data = removeloc, aes(x = depth, y = qual), shape = 1, color = "red") +
geom_line(data = df, aes(x = depth, y = qualcutoff), color = "darkblue", linetype = "dashed", size = 1) +
geom_vline(xintercept = cutoff, color = "darkblue", linetype = "dashed", size = 1) +
labs(x = "total depth per locus", y = "SNP quality per locus") +
scale_x_continuous() +
theme_standard
svg("results/fig/Figure8.svg", width = 8, height = 4)
ggplot(df, aes(x = depth, y = qual)) +
geom_point(shape = 1) +
geom_point(data = removeloc, aes(x = depth, y = qual), shape = 1, color = "red") +
geom_line(data = df, aes(x = depth, y = qualcutoff), color = "darkblue", linetype = "dashed", size = 1) +
geom_vline(xintercept = cutoff, color = "darkblue", linetype = "dashed", size = 1) +
labs(x = "total depth per locus", y = "SNP quality per locus") +
scale_x_continuous() +
theme_standard
dev.off()
```