-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_index_hopping.R
58 lines (51 loc) · 2.36 KB
/
plot_index_hopping.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
library(ggplot2)
library(ggstatsplot)
library(dplyr)
library(readr)
# get data from GitHub
urlfile="https://raw.githubusercontent.com/roberta-davidson/Davidson_etal_2024-Twist/main/index_hopping_stats2.tsv"
all_data<-read_delim(url(urlfile), delim="\t")
#index hopping 1 round of twist
ggbetweenstats(subset(all_data, rounds="1"), Type, rate, type="r") #+
#index hopping 2 round of twist
ggbetweenstats(subset(all_data, rounds="2"), Type, rate, type="r")
all_data$Type[all_data$Type == "HE"] <- "4-library Pools"
all_data$Type[all_data$Type == "LE"] <- "2-library Pools"
all_data$Type[all_data$Type == "SG"] <- "All Other Pairs of Libraries (Capture & Shotgun)"
all_data$Type[all_data$Type == "TW"] <- "All Other Pairs of Libraries (Capture & Shotgun)"
all_data$Type[all_data$Type == "TW_SG"] <- "All Other Pairs of Libraries (Capture & Shotgun)"
all_data$Round_type <- paste0(all_data$Type," ", "TW", all_data$rounds )
all_data$Round_type[all_data$Round_type == "All Other Pairs of Libraries (Capture & Shotgun) TW1"] <- "All Other Pairs of Libraries (Capture & Shotgun)"
all_data$Round_type[all_data$Round_type == "All Other Pairs of Libraries (Capture & Shotgun) TW2"] <- "All Other Pairs of Libraries (Capture & Shotgun)"
png("<path>/index_hopping_1.png",
width = 8,
height = 6,
units = "in",
res = 1200)
ggbetweenstats(all_data, Type, rate,
xlab = "Index Hopping Group",
ylab = "Single-Index Hopping Rate",
type="r",
pairwise.display = "s",
results.subtitle=FALSE) +
theme(axis.title.y.right = element_blank(),
axis.text.y.right = element_blank(),
axis.ticks.y.right = element_blank()) +
scale_color_manual(values = c("#019dfe", "#001bcc", "#ff5500"))
dev.off()
png("<path>/index_hopping_2.png",
width = 12,
height = 6,
units = "in",
res = 1200)
ggbetweenstats(all_data, Round_type, rate,
xlab = "Index Hopping Group",
ylab = "Single-Index Hopping Rate",
type="r",
pairwise.display = "s",
results.subtitle=FALSE) +
theme(axis.title.y.right = element_blank(),
axis.text.y.right = element_blank(),
axis.ticks.y.right = element_blank()) +
scale_color_manual(values = c("#00b6c1", "#007f92", "#01b277", "#00998b", "#ff5500"))
dev.off()