-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCVDSBG_density.Rmd
268 lines (149 loc) · 11.1 KB
/
CVDSBG_density.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
---
title: "Untitled"
output: html_document
---
```{r overlapped complex density}
rm(list = ls())
library(ggplot2)
library(ggplot2)
library(readxl)
library(ggpubr)
serum<-read.csv("matrix/serum_protein_matrix_20200518.csv",row.names = 1)
urine<-read.csv("matrix/urine_protein_matrix_20200506.csv",row.names = 1)
serum2<-serum[,which(names(serum)%in%names(urine))]
urine2<-urine[,which(names(urine)%in%names(serum))]
df<-data.frame(row.names(serum))
for (i in 8:35) {
for(k in (i+1):37){
df1<-data.frame(log2(serum2[,i])-log2(serum2[,k]))
names(df1)<-c(paste0(names(serum2)[i],"_",names(serum2[k])))
df<-cbind(df,df1)
}
}
df1<-data.frame()
for (i in 2:ncol(df)) {
data4<-data.frame(df[,1],names(df)[i],df[,i])
df1<-rbind(data4,df1)
}
names(df1)<-c("type","prot","value")
df2<-data.frame(row.names(urine))
for (i in 8:35) {
for(k in (i+1):37){
df3<-data.frame(log2(urine2[,i])-log2(urine2[,k]))
names(df3)<-c(paste0(names(urine2)[i],"_",names(urine2[k])))
df2<-cbind(df2,df3)
}
}
df4<-data.frame()
for (i in 2:ncol(df2)) {
data4<-data.frame(df2[,1],names(df2)[i],df2[,i])
df4<-rbind(data4,df4)
}
names(df4)<-c("type","prot","value")
urineComplexMatrix<-read.csv("complex_0612/urineComplexMatrix0612.csv",row.names = 1)
serumComplexMatrix<-read.csv("complex_0612/serumComplexMatrix0612.csv",row.names = 1)
urineComplex<-urineComplexMatrix[,names(urineComplexMatrix)%in%names(serumComplexMatrix)]
serumComplex<-serumComplexMatrix[,names(serumComplexMatrix)%in%names(urineComplexMatrix)]
write.csv(urineComplex,"complex_0612/urineComplex_overlap.csv")
write.csv(serumComplex,"complex_0612/serumComplex_overlap.csv")
df5<-data.frame()
for (i in 8:ncol(urineComplex)) {
data4<-data.frame(urineComplex[,4],names(urineComplex)[i],urineComplex[,i])
df5<-rbind(data4,df5)
}
names(df5)<-c("DiseaseType","prot","value")
df6<-data.frame()
for (i in 8:ncol(serumComplex)) {
data4<-data.frame(serumComplex[,4],names(serumComplex)[i],serumComplex[,i])
df6<-rbind(data4,df6)
}
names(df6)<-c("DiseaseType","prot","value")
serumRest<-df1
urineRest<-df4
serumCompex<-df6
urineCompex<-df5
write.csv(serumRest,"complex_0612/serumRest.csv",row.names = F)
write.csv(urineRest,"complex_0612/urineRest.csv",row.names = F)
write.csv(serumCompex,"complex_0612/serumCompex_density.csv",row.names = F)
write.csv(urineCompex,"complex_0612/urineCompex_density.csv",row.names = F)
```
```{r Complex_rest density plot}
rm(list=ls())
library(ggplot2)
serumRest<-read.csv("complex_0612/serumRest.csv")
urineRest<-read.csv("complex_0612/urineRest.csv")
serumCompex<-read.csv("complex_0612/serumCompex_density.csv")
urineCompex<-read.csv("complex_0612/urineCompex_density.csv")
serumRest2<-data.frame("serumrest",serumRest[,2:3])
names(serumRest2)<-c(names(serumCompex))
serumDentisy<-rbind(serumRest2,serumCompex)
serumDentisy2<-data.frame(serumDentisy[,c(1:3)])
serum_rest_healthy<-data.frame(serumDentisy2[which(serumDentisy2$DiseaseType%in%c("serumrest","healthy")),])
serum_rest_non_covid<-data.frame(serumDentisy2[which(serumDentisy2$DiseaseType%in%c("serumrest","non_covid")),])
serum_rest_non_severe<-data.frame(serumDentisy2[which(serumDentisy2$DiseaseType%in%c("serumrest","non_severe")),])
serum_rest_severe<-data.frame(serumDentisy2[which(serumDentisy2$DiseaseType%in%c("serumrest","severe")),])
healthy<-ggplot(serum_rest_healthy, aes(x = value))+geom_density(aes(color = DiseaseType,fill=DiseaseType),alpha=0.2)+
theme(legend.direction = 'horizontal',legend.position = 'top',legend.text = element_text(size = 15,color = "black"), legend.title = element_text(size=15,color="black") ,panel.grid.major =element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(),axis.line = element_line(colour = "black"))+ theme(panel.grid =element_blank())+
theme(axis.text = element_text(size = 15,color = "black"))+
theme(plot.subtitle=element_text(size=30, hjust=0, color="black"))+
theme(axis.title.x=element_text(size=17, hjust=0.5, color="black"))+
theme(axis.title.y=element_text(size=17, hjust=0.5, color="black"))
non_covid<-ggplot(serum_rest_non_covid, aes(x = value))+geom_density(aes(color = DiseaseType,fill=DiseaseType),alpha=0.2)+
theme(legend.direction = 'horizontal',legend.position = 'top',legend.text = element_text(size = 15,color = "black"), legend.title = element_text(size=15,color="black") ,panel.grid.major =element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(),axis.line = element_line(colour = "black"))+ theme(panel.grid =element_blank())+
theme(axis.text = element_text(size = 15,color = "black"))+
theme(plot.subtitle=element_text(size=30, hjust=0, color="black"))+
theme(axis.title.x=element_text(size=17, hjust=0.5, color="black"))+
theme(axis.title.y=element_text(size=17, hjust=0.5, color="black"))
non_severe<-ggplot(serum_rest_non_severe, aes(x = value))+geom_density(aes(color = DiseaseType,fill=DiseaseType),alpha=0.2)+
theme(legend.direction = 'horizontal',legend.position = 'top',legend.text = element_text(size = 15,color = "black"), legend.title = element_text(size=15,color="black") ,panel.grid.major =element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(),axis.line = element_line(colour = "black"))+ theme(panel.grid =element_blank())+
theme(axis.text = element_text(size = 15,color = "black"))+
theme(plot.subtitle=element_text(size=30, hjust=0, color="black"))+
theme(axis.title.x=element_text(size=17, hjust=0.5, color="black"))+
theme(axis.title.y=element_text(size=17, hjust=0.5, color="black"))
severe<-ggplot(serum_rest_severe, aes(x = value))+geom_density(aes(color = DiseaseType,fill=DiseaseType),alpha=0.2)+
theme(legend.direction = 'horizontal',legend.position = 'top',legend.text = element_text(size = 15,color = "black"), legend.title = element_text(size=15,color="black") ,panel.grid.major =element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(),axis.line = element_line(colour = "black"))+ theme(panel.grid =element_blank())+
theme(axis.text = element_text(size = 15,color = "black"))+
theme(plot.subtitle=element_text(size=30, hjust=0, color="black"))+
theme(axis.title.x=element_text(size=17, hjust=0.5, color="black"))+
theme(axis.title.y=element_text(size=17, hjust=0.5, color="black"))
ggsave("complex_0612/serum_healthy_complex_rest.pdf",plot =healthy,device = NULL)
ggsave("complex_0612/serum_non_covid_complex_rest.pdf",plot =non_covid,device = NULL)
ggsave("complex_0612/serum_non_severe_complex_rest.pdf",plot =non_severe,device = NULL)
ggsave("complex_0612/serum_severe_complex_rest.pdf",plot =severe,device = NULL)
urineRest2<-data.frame("urinerest",urineRest[,2:3])
names(urineRest2)<-c(names(urineCompex))
urineDentisy<-rbind(urineRest2,urineCompex)
urineDentisy2<-data.frame(urineDentisy[,c(1:3)])
urine_rest_healthy<-data.frame(urineDentisy2[which(urineDentisy2$DiseaseType%in%c("urinerest","healthy")),])
urine_rest_non_covid<-data.frame(urineDentisy2[which(urineDentisy2$DiseaseType%in%c("urinerest","non_covid")),])
urine_rest_non_severe<-data.frame(urineDentisy2[which(urineDentisy2$DiseaseType%in%c("urinerest","non_severe")),])
urine_rest_severe<-data.frame(urineDentisy2[which(urineDentisy2$DiseaseType%in%c("urinerest","severe")),])
healthy<-ggplot(urine_rest_healthy, aes(x = value))+geom_density(aes(color = DiseaseType,fill=DiseaseType),alpha=0.2)+
theme(legend.direction = 'horizontal',legend.position = 'top',legend.text = element_text(size = 15,color = "black"), legend.title = element_text(size=15,color="black") ,panel.grid.major =element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(),axis.line = element_line(colour = "black"))+ theme(panel.grid =element_blank())+
theme(axis.text = element_text(size = 15,color = "black"))+
theme(plot.subtitle=element_text(size=30, hjust=0, color="black"))+
theme(axis.title.x=element_text(size=17, hjust=0.5, color="black"))+
theme(axis.title.y=element_text(size=17, hjust=0.5, color="black"))
non_covid<-ggplot(urine_rest_non_covid, aes(x = value))+geom_density(aes(color = DiseaseType,fill=DiseaseType),alpha=0.2)+
theme(legend.direction = 'horizontal',legend.position = 'top',legend.text = element_text(size = 15,color = "black"), legend.title = element_text(size=15,color="black") ,panel.grid.major =element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(),axis.line = element_line(colour = "black"))+ theme(panel.grid =element_blank())+
theme(axis.text = element_text(size = 15,color = "black"))+
theme(plot.subtitle=element_text(size=30, hjust=0, color="black"))+
theme(axis.title.x=element_text(size=17, hjust=0.5, color="black"))+
theme(axis.title.y=element_text(size=17, hjust=0.5, color="black"))
non_severe<-ggplot(urine_rest_non_severe, aes(x = value))+geom_density(aes(color = DiseaseType,fill=DiseaseType),alpha=0.2)+
theme(legend.direction = 'horizontal',legend.position = 'top',legend.text = element_text(size = 15,color = "black"), legend.title = element_text(size=15,color="black") ,panel.grid.major =element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(),axis.line = element_line(colour = "black"))+ theme(panel.grid =element_blank())+
theme(axis.text = element_text(size = 15,color = "black"))+
theme(plot.subtitle=element_text(size=30, hjust=0, color="black"))+
theme(axis.title.x=element_text(size=17, hjust=0.5, color="black"))+
theme(axis.title.y=element_text(size=17, hjust=0.5, color="black"))
severe<-ggplot(urine_rest_severe, aes(x = value))+geom_density(aes(color = DiseaseType,fill=DiseaseType),alpha=0.2)+
theme(legend.direction = 'horizontal',legend.position = 'top',legend.text = element_text(size = 15,color = "black"), legend.title = element_text(size=15,color="black") ,panel.grid.major =element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(),axis.line = element_line(colour = "black"))+ theme(panel.grid =element_blank())+
theme(axis.text = element_text(size = 15,color = "black"))+
theme(plot.subtitle=element_text(size=30, hjust=0, color="black"))+
theme(axis.title.x=element_text(size=17, hjust=0.5, color="black"))+
theme(axis.title.y=element_text(size=17, hjust=0.5, color="black"))
ggsave("complex_0612/urine_healthy_complex_rest.pdf",plot =healthy,device = NULL)
ggsave("complex_0612/urine_non_covid_complex_rest.pdf",plot =non_covid,device = NULL)
ggsave("complex_0612/urine_non_severe_complex_rest.pdf",plot =non_severe,device = NULL)
ggsave("complex_0612/urine_severe_complex_rest.pdf",plot =severe,device = NULL)
```