-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHUVEC_iMARGI_summary.r
231 lines (181 loc) · 9.6 KB
/
HUVEC_iMARGI_summary.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
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
##### iMARGI statistics
total_control = 65879147
total_T3d = 53291562
total_T7d = 50031654
total_control_2 = 12495439
total_T7d_2 = 15880128
thres = 2*10^-7
######## Summary plot for number of reads
n = 2
directory = "/mnt/extraids/OceanStor-SysCmn-2/rcalandrelli/MARGI/iMARGI_merged_replicates"
######################## Figure 2b
sample=rep(c("0", "3", "7"), 2)
feature=c(rep("Intra" , 3), rep("Inter" , 3))
intra_control_merge = 0.5 * (45041974/total_control + 6140189/total_control_2)
error_intra_control_merge = sd(c(45041974/total_control, 6140189/total_control_2)) / sqrt(2)
intra_T3d_merge = 22872181 / total_T3d
intra_T7d_merge = 0.5 * (14858759/total_T7d + 6713214/total_T7d_2)
error_intra_T7d_merge = sd(c(14858759/total_T7d , 6713214/total_T7d_2)) / sqrt(2)
inter_control_merge = 0.5 * (20837173/total_control + 6355250/total_control_2)
error_inter_control_merge = sd(c(20837173/total_control , 6355250/total_control_2)) / sqrt(2)
inter_T3d_merge = 30419381 / total_T3d
inter_T7d_merge = 0.5 * (35172895/total_T7d + 9166914/total_T7d_2)
error_inter_T7d_merge = sd(c(35172895/total_T7d , 9166914/total_T7d_2)) / sqrt(2)
value = c(intra_control_merge, intra_T3d_merge, intra_T7d_merge, inter_control_merge, inter_T3d_merge, inter_T7d_merge)
error = c(error_intra_control_merge, 0, error_intra_T7d_merge, error_inter_control_merge, 0, error_inter_T7d_merge)
data=data.frame(sample,feature,value,error)
data$feature <- factor(data$feature, levels = c("Intra", "Inter"))
data$error_pos = NA
data$error_pos[data$feature == "Intra"] = NA
data$error_pos[data$feature == "Inter"] = data$value[data$feature == "Inter"]
directory = "/mnt/extraids/OceanStor-SysCmn-2/rcalandrelli/MARGI/iMARGI_merged_replicates"
png(paste0(directory,"/Figure_2b.png"), width = 8, height = 10, units = "in", res = 200)
ggplot(data, aes(fill=feature, y=value, x=sample)) +
geom_bar(stat="identity") +
scale_fill_manual(values = c("#ffeb00","blue")) +
labs(x = "Day", y = "Number of read pairs / total pairs") +
geom_errorbar(aes(ymin=error_pos-error, ymax=error_pos+error), width=.2, size = 0.8) +
scale_y_continuous(name="Number of read pairs / total pairs", breaks = c(0,0.5,1), labels = c("0","0.5","1")) +
theme(legend.title = element_blank(),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
text = element_text(size=34),
axis.text.x = element_text(size = 34, color = "black"),
axis.text.y = element_text(size = 34, color = "black"),
axis.ticks.length = unit(0.2, "cm"),
legend.position = "none")
dev.off()
######################## Figure 2e
sample=rep(c("N+M", "H+T"), 2)
feature=c(rep("RNA end in SE" , 2), rep("DNA end in SE" , 2))
value_1 = c((5006772)/total_control, (3819106 + 3572835)/(total_T3d+total_T7d),
(2867551)/total_control, (1176042 + 984091)/(total_T3d+total_T7d))
value_2 = c((929342)/total_control_2, (1179473)/total_T7d_2,
(422729)/total_control_2, (453641)/total_T7d_2)
value_means = (value_1 + value_2) / 2
errors = c()
for (i in 1:4){
errors = c(errors,sd(c(value_1[i],value_2[i]))/sqrt(2))
}
data=data.frame(sample,feature,value_means,errors)
data$feature <- factor(data$feature, levels = c("RNA end in SE", "DNA end in SE"))
data$sample <- factor(data$sample, levels = c("N+M","H+T"))
# Data update to plot first RNA and then DNA
data$sample = c("N+M","N+M","H+T","H+T")
data$sample <- factor(data$sample, levels = c("N+M","H+T"))
data$feature <- c("a","b","c","d")
directory = "/mnt/extraids/OceanStor-SysCmn-2/rcalandrelli/MARGI/iMARGI_merged_replicates"
png(paste0(directory,"/Figure_2e.png"), width = 8, height = 10, units = "in", res = 200)
ggplot(data, aes(fill=feature, y=value_means, x=sample)) +
geom_bar(stat="identity", position=position_dodge(width=1), width=0.95) +
scale_fill_manual(values=c("#f8766d","#f8766d","#00bdc4","#00bdc4")) +
labs(x = "", y = "Number of read pairs / total pairs") +
geom_errorbar(aes(ymin=value_means-errors, ymax=value_means+errors), width=.2, size = 1, position=position_dodge(1)) +
theme(legend.title = element_blank(),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
text = element_text(size=34),
axis.text.x = element_text(size = 34, color = "black"),
axis.text.y = element_text(size = 34, color = "black"),
axis.ticks.length = unit(0.2, "cm"),
legend.position = "none") +
geom_hline(yintercept = 0.009, color='black', linetype="dashed", size = 1.5)
dev.off()
######################## Supplementary Figure 4a
sample=rep(c("N+M", "H+T"), 2)
feature=c(rep("RNA end in E" , 2), rep("DNA end in E" , 2))
value_1 = c((6567581)/total_control, (4681588 + 4287159)/(total_T3d+total_T7d),
(5208882)/total_control, (3365440 + 3116817)/(total_T3d+total_T7d))
value_2 = c((1136509)/total_control_2, (1396885)/total_T7d_2,
(912612)/total_control_2, (1050455)/total_T7d_2)
value_means = (value_1 + value_2) / 2
errors = c()
for (i in 1:4){
errors = c(errors,sd(c(value_1[i],value_2[i]))/sqrt(2))
}
data=data.frame(sample,feature,value_means,errors)
data$feature <- factor(data$feature, levels = c("RNA end in E", "DNA end in E"))
data$sample <- factor(data$sample, levels = c("N+M","H+T"))
# Data update to plot first RNA and then DNA
data$sample = c("N+M","N+M","H+T","H+T")
data$sample <- factor(data$sample, levels = c("N+M","H+T"))
data$feature <- c("a","b","c","d")
directory = "/mnt/extraids/OceanStor-SysCmn-2/rcalandrelli/MARGI/iMARGI_merged_replicates"
png(paste0(directory,"/Supplementary_Figure_4a.png"), width = 8, height = 10, units = "in", res = 200)
ggplot(data, aes(fill=feature, y=value_means, x=sample)) +
geom_bar(stat="identity", position=position_dodge(width=1), width=0.95) +
scale_fill_manual(values=c("#f8766d","#f8766d","#00bdc4","#00bdc4")) +
labs(x = "", y = "Number of read pairs / total pairs") +
geom_errorbar(aes(ymin=value_means-errors, ymax=value_means+errors), width=.2, size = 1, position=position_dodge(1)) +
theme(legend.title = element_blank(),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
text = element_text(size=34),
axis.text.x = element_text(size = 34, color = "black"),
axis.text.y = element_text(size = 34, color = "black"),
axis.ticks.length = unit(0.2, "cm"),
legend.position = "none") +
geom_hline(yintercept = 0.009, color='black', linetype="dashed", size = 1.5)
dev.off()
######################## Supplementary Figure 4b
sample=rep(c("Day0", "Day7"), 2)
feature=c(rep("Intra" , 2), rep("Inter" , 2))
value_1 = c(1281, 532,
506, 3253)
value_2 = c(923, 910,
1286, 2318)
value_means = (value_1 + value_2) / 2
errors = c()
for (i in 1:4){
errors = c(errors,sd(c(value_1[i],value_2[i]))/sqrt(2))
}
data=data.frame(sample,feature,value_means,errors)
# Data update to plot first RNA and then DNA
data$sample = c("Day0","Day0","Day7","Day7")
data$sample <- factor(data$sample, levels = c("Day0","Day7"))
data$feature <- c("a","b","c","d")
directory = "/mnt/extraids/OceanStor-SysCmn-2/rcalandrelli/MARGI/iMARGI_merged_replicates"
png(paste0(directory,"/Supplementary_Figure_4b.png"), width = 8, height = 10, units = "in", res = 200)
ggplot(data, aes(fill=feature, y=value_means, x=sample)) +
geom_bar(stat="identity", position=position_dodge(width=1), width=0.95) +
scale_fill_manual(values=c("#f8766d","#f8766d","#00bdc4","#00bdc4")) +
labs(x = "", y = "Number of SE pairs") +
geom_errorbar(aes(ymin=value_means-errors, ymax=value_means+errors), width=.2, size = 1, position=position_dodge(1)) +
theme(legend.title = element_blank(),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
text = element_text(size=34),
axis.text.x = element_text(size = 34, color = "black"),
axis.text.y = element_text(size = 34, color = "black"),
axis.ticks.length = unit(0.2, "cm"),
legend.position = "none")
dev.off()
######################## Supplementary Figure 4f
sample=rep(c("Nodes"), 2)
feature=c(rep("Day0" , 1), rep("Day7" , 1))
value_1 = c(131, 456)
value_2 = c(303, 419)
value_means = (value_1 + value_2) / 2
errors = c()
for (i in 1:2){
errors = c(errors,sd(c(value_1[i],value_2[i]))/sqrt(2))
}
data=data.frame(sample,feature,value_means,errors)
# Data update to plot first RNA and then DNA
data$feature <- c("a","b")
directory = "/mnt/extraids/OceanStor-SysCmn-2/rcalandrelli/MARGI/iMARGI_merged_replicates"
png(paste0(directory,"/Supplementary_Figure_4f.png"), width = 8, height = 10, units = "in", res = 200)
ggplot(data, aes(fill=feature, y=value_means, x=sample)) +
geom_bar(stat="identity", position=position_dodge(width=1), width=0.95) +
scale_fill_manual(values=c("#f8766d","#f8766d")) +
labs(x = "", y = "Number of SE nodes") +
geom_errorbar(aes(ymin=value_means-errors, ymax=value_means+errors), width=.2, size = 1, position=position_dodge(1)) +
theme(legend.title = element_blank(),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
text = element_text(size=34),
axis.text.x = element_text(size = 34, color = "black"),
axis.text.y = element_text(size = 34, color = "black"),
axis.ticks.length = unit(0.2, "cm"),
legend.position = "none")
dev.off()