-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFig_S10_Viz.Rmd
227 lines (185 loc) · 9.63 KB
/
Fig_S10_Viz.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
---
title: "Fig_S10_Viz"
author: "Troy McDiarmid"
date: "2024-02-18"
output: html_document
---
```{r setup, include=FALSE}
library(tidyverse)
library("DNABarcodes")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
library(scales)
library("Biostrings")
library(ggridges)
```
```{r}
##Making heatmaps for BC1
Standard <- read_csv("/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/FigS10_Final_Figure_Datasets/MW_Edit_Scores_Comparison_Table.csv") %>%
filter(BC_Pool == 1) %>%
filter(Variant_Type == "Standard")
MW <- read_csv("/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/FigS10_Final_Figure_Datasets/MW_Edit_Scores_Comparison_Table.csv") %>%
filter(BC_Pool == 1) %>%
filter(!Variant_Type == "Standard") %>%
group_by(ID_Number) %>%
mutate(Median_K562 = median(K562)) %>%
mutate(Median_HEK293T = median(HEK293T)) %>%
mutate(Median_iPSC = median(iPSC)) %>%
ungroup()
MW <- MW %>%
separate(Variant_Type, into = c("Standard_Nucleotide", "SNV_Change"), remove = FALSE) %>%
mutate(SNV_Change = replace_na(SNV_Change, "Deletion")) %>%
mutate(K562_Log2_Fold_Change_Relative_To_Standard = log2(Median_K562/median(Standard$K562))) %>%
mutate(HEK293T_Log2_Fold_Change_Relative_To_Standard = log2(Median_HEK293T/median(Standard$HEK293T))) %>%
mutate(iPSC_Log2_Fold_Change_Relative_To_Standard = log2(Median_iPSC/median(Standard$iPSC)))
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = K562_Log2_Fold_Change_Relative_To_Standard)) +
theme_void() +
geom_tile() +
scale_fill_gradientn(colours = c("#55AFF4","white","red"),
values = rescale(c(-5,-1,5)),
guide = "colorbar", limits=c(-5,5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_K562_BC_1_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = HEK293T_Log2_Fold_Change_Relative_To_Standard)) +
theme_void() +
geom_tile() +
scale_fill_gradientn(colours = c("#55AFF4","white","red"),
values = rescale(c(-5,0,5)),
guide = "colorbar", limits=c(-5,5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_HEK293T_BC_1_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = iPSC_Log2_Fold_Change_Relative_To_Standard)) +
theme_void() +
geom_tile() +
scale_fill_gradientn(colours = c("#55AFF4","white","red"),
values = rescale(c(-5,0,5)),
guide = "colorbar", limits=c(-4.5, 4.5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_iPSC_BC_1_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
```
```{r}
##Making heatmaps for BC2
Standard <- read_csv("/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/FigS10_Final_Figure_Datasets/MW_Edit_Scores_Comparison_Table.csv") %>%
filter(BC_Pool == 2) %>%
filter(Variant_Type == "Standard")
MW <- read_csv("/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/FigS10_Final_Figure_Datasets/MW_Edit_Scores_Comparison_Table.csv") %>%
filter(BC_Pool == 2) %>%
filter(!Variant_Type == "Standard") %>%
group_by(ID_Number) %>%
mutate(Median_K562 = median(K562)) %>%
mutate(Median_HEK293T = median(HEK293T)) %>%
mutate(Median_iPSC = median(iPSC)) %>%
ungroup()
MW <- MW %>%
separate(Variant_Type, into = c("Standard_Nucleotide", "SNV_Change"), remove = FALSE) %>%
mutate(SNV_Change = replace_na(SNV_Change, "Deletion")) %>%
mutate(K562_Log2_Fold_Change_Relative_To_Standard = log2(Median_K562/median(Standard$K562))) %>%
mutate(HEK293T_Log2_Fold_Change_Relative_To_Standard = log2(Median_HEK293T/median(Standard$HEK293T))) %>%
mutate(iPSC_Log2_Fold_Change_Relative_To_Standard = log2(Median_iPSC/median(Standard$iPSC)))
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = K562_Log2_Fold_Change_Relative_To_Standard)) +
theme_void() +
geom_tile() +
scale_fill_gradientn(colours = c("#55AFF4","white","red"),
values = rescale(c(-5,3.25,5)),
guide = "colorbar", limits=c(-5,5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_K562_BC_2_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = HEK293T_Log2_Fold_Change_Relative_To_Standard)) +
theme_void() +
geom_tile() +
scale_fill_gradientn(colours = c("#55AFF4","white","red"),
values = rescale(c(-5,1,5)),
guide = "colorbar", limits=c(-5,5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_HEK293T_BC_2_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = iPSC_Log2_Fold_Change_Relative_To_Standard)) +
theme_void() +
geom_tile() +
scale_fill_gradientn(colours = c("#55AFF4","white","red"),
values = rescale(c(-5,0,5)),
guide = "colorbar", limits=c(-4.5, 4.5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_iPSC_BC_2_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
```
```{r}
##Making the heatmaps for BC1
##Reading in data
MW <- read_csv("/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/FigS10_Final_Figure_Datasets/MW_Edit_Scores_Comparison_Table.csv") %>%
filter(!Variant_Type == "Standard") %>%
filter(BC_Pool == 1)
MW <- MW %>%
separate(Variant_Type, into = c("Standard_Nucleotide", "SNV_Change"), remove = FALSE) %>%
mutate(SNV_Change = replace_na(SNV_Change, "Deletion"))
##Edit score heatmaps for each cell context
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = log2(K562))) +
theme_void() +
geom_tile() +
scale_fill_continuous(limits=c(-5, 5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_K562_BC_1_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = log2(HEK293T))) +
theme_void() +
geom_tile() +
scale_fill_continuous(limits=c(-5, 5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_HEK293T_BC_1_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = log2(iPSC))) +
theme_void() +
geom_tile() +
scale_fill_continuous(limits=c(-5, 5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_iPSC_BC_1_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
```
```{r}
##Making the heatmaps for BC2
##Reading in data
MW <- read_csv("/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/FigS10_Final_Figure_Datasets/MW_Edit_Scores_Comparison_Table.csv") %>%
filter(!Variant_Type == "Standard") %>%
filter(BC_Pool == 2)
MW <- MW %>%
separate(Variant_Type, into = c("Standard_Nucleotide", "SNV_Change"), remove = FALSE) %>%
mutate(SNV_Change = replace_na(SNV_Change, "Deletion"))
##Edit score heatmaps for each cell context
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = log2(K562))) +
theme_void() +
geom_tile() +
scale_fill_continuous(limits=c(-5, 5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_K562_BC_2_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = log2(HEK293T))) +
theme_void() +
geom_tile() +
scale_fill_continuous(limits=c(-5, 5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_HEK293T_BC_2_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
ggplot(MW, aes(x = Variant_Position, fct_relevel(SNV_Change, "T", "G", "C", "A", "Deletion"), fill = log2(iPSC))) +
theme_void() +
geom_tile() +
scale_fill_continuous(limits=c(-5, 5)) +
theme(axis.ticks.length=unit(0, "cm")) +
theme(legend.position = "none")
labs(title = "", x = "", y = "")
ggsave("MW_iPSC_BC_2_Heatmap.jpeg", width = 38, height = 2.5, path = "/Users/troymcdiarmid/Documents/U6_pro_series/Figs/Pub_Figs/")
```