forked from guozihuaa/PCa_ceRNA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
112-Gene_set_interaction.R
213 lines (160 loc) · 6.47 KB
/
112-Gene_set_interaction.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
rm(list = ls())
library(UpSetR)
load("result/GEO-GSE104131_mRNA_DEG.RData")
mrna_DEG$names <- rownames(mrna_DEG)
GSE104131up <- dplyr::filter(mrna_DEG, pvalue <= 0.01, log2FoldChange > 0.263) %>%
dplyr::select(names) %>%
unlist() %>%
unname()
GSE104131down <- dplyr::filter(mrna_DEG, pvalue <= 0.01, log2FoldChange < -0.263)%>%
dplyr::select(names) %>%
unlist() %>%
unname()
#############
load("result/GEO-GSE89223_mRNA_DEG.RData")
mrna_DEG$names <- rownames(mrna_DEG)
GSE89223up <- dplyr::filter(mrna_DEG, pvalue <= 0.01, log2FoldChange > 0.263) %>%
dplyr::select(names) %>%
unlist() %>%
unname()
GSE89223down <- dplyr::filter(mrna_DEG, pvalue <= 0.01, log2FoldChange < -0.263)%>%
dplyr::select(names) %>%
unlist() %>%
unname()
#############
load("result/TCGA-PRAD_mRNA_DEG.RData")
mrna_DEG$names <- rownames(mrna_DEG)
TCGA_PRADup <- dplyr::filter(mrna_DEG, pvalue <= 0.01, log2FoldChange > 0.263) %>%
dplyr::select(names) %>%
unlist() %>%
unname()
TCGA_PRADdown <- dplyr::filter(mrna_DEG, pvalue <= 0.01, log2FoldChange < -0.263)%>%
dplyr::select(names) %>%
unlist() %>%
unname()
########### upsetR
uiongeneup <- union(union(GSE104131up, GSE89223up), TCGA_PRADup)
uiongenedown <- union(union(GSE104131down, GSE89223down), TCGA_PRADdown)
indexup <- lapply(list(GSE104131up, GSE89223up, TCGA_PRADup), function(x){as.numeric(uiongeneup %in% x)}) %>%
as.data.frame()
names(indexup) <- c("GSE104131up", "GSE89223up", "TCGA_PRADup")
rownames(indexup) <- uiongeneup
indexdown <- lapply(list(GSE104131down, GSE89223down, TCGA_PRADdown), function(x){as.numeric(uiongenedown %in% x)}) %>%
as.data.frame()
names(indexdown) <- c("GSE104131down", "GSE89223down", "TCGA_PRADdown")
####
tiff("Plot00.tiff", width = 2600, height = 1500, units = 'px', res = 300)
upset(indexup,
main.bar.color = "blue",
matrix.color = "red",
sets.bar.color = "blue",
point.size = 3,
line.size = 1,
mb.ratio = c(0.7, 0.3),
text.scale = 2)
dev.off()
tiff("Plot1.tiff", width = 2600, height = 1500, units = 'px', res = 300)
upset(indexdown,
main.bar.color = "blue",
matrix.color = "red",
sets.bar.color = "blue",
point.size = 3,
line.size = 1,
mb.ratio = c(0.7, 0.3),
text.scale = 2)
dev.off()
intersetup <- intersect(intersect(GSE104131up, GSE89223up), TCGA_PRADup)
intersectdown <- intersect(intersect(GSE104131down, GSE89223down), TCGA_PRADdown)
save(intersectdown, intersetup, file = "result/intersect_Gene.RData")
###########################3
## miRNA 画图
rm(list = ls())
mirbase <- read_csv("rawdata/mirbase_aliases.csv", col_names = F)
maturename <- str_split(mirbase$X2, ";")
mibaseindex <- data.frame(ids = rep(mirbase$X1, sapply(maturename, length)),
names = unlist(maturename)) %>%
dplyr::filter(names != "")
save(mibaseindex, file = "rawdata/mibaseIndex.RData")
###
load("result/GEO-GSE75415_miRNA_DEG.RData")
mrna_DEG$names <- rownames(mrna_DEG)
mrna_DEG <- inner_join(mrna_DEG, mibaseindex, by = c("names" = "names"))
GSE75415up <- dplyr::filter(mrna_DEG, pvalue <= 0.05, log2FoldChange > 0.263) %>%
dplyr::select(ids) %>%
unlist() %>%
as.character() %>%
unname()
GSE75415down <- dplyr::filter(mrna_DEG, pvalue <= 0.05, log2FoldChange < -0.263)%>%
dplyr::select(ids) %>%
unlist() %>%
as.character() %>%
unname()
#######
load("result/GEO-GSE76260_miRNA_DEG.RData")
mrna_DEG$names <- rownames(mrna_DEG)
paltform_index <- read_tsv("rawdata/miRNA/GSE76260/GPL8179_humanMI_V2_R0_XS0000124-MAP.txt/GPL8179_humanMI_V2_R0_XS0000124-MAP.txt")
targetname <- str_split(paltform_index$TargetMatureName, ",")
GPL8179index <- data.frame(ids = rep(paltform_index$SYMBOL, sapply(targetname, length)),
names = unlist(targetname)) %>%
dplyr::filter(names != "") %>%
distinct() %>%
inner_join(mibaseindex, by = c("names" = "names"))
mrna_DEG <- inner_join(mrna_DEG, GPL8179index, by = c("names" = "ids.x"))
GSE76260up <- dplyr::filter(mrna_DEG, pvalue <= 0.05, log2FoldChange > 0.263) %>%
dplyr::select(ids.y) %>%
unlist() %>%
as.character() %>%
unname()
GSE76260down <- dplyr::filter(mrna_DEG, pvalue <= 0.05, log2FoldChange < -0.263)%>%
dplyr::select(ids.y) %>%
unlist() %>%
as.character() %>%
unname()
###############
load("result/TCGA-PRAD_miRNA_DEG.RData")
mrna_DEG$names <- rownames(mrna_DEG)
mrna_DEG <- inner_join(mrna_DEG, mibaseindex, by = c("names" = "names"))
TCGA_PRADup <- dplyr::filter(mrna_DEG, pvalue <= 0.05, log2FoldChange > 0.263, baseMean > 0) %>%
dplyr::select(ids) %>%
unlist() %>%
as.character() %>%
unname()
TCGA_PRADdown <- dplyr::filter(mrna_DEG, pvalue <= 0.05, log2FoldChange < -0.263, baseMean > 0)%>%
dplyr::select(ids) %>%
unlist() %>%
as.character() %>%
unname()
####################
uiongeneup <- union(union(GSE75415up, GSE76260up), TCGA_PRADup)
uiongenedown <- union(union(GSE75415down, GSE76260down), TCGA_PRADdown)
indexup <- lapply(list(GSE75415up, GSE76260up, TCGA_PRADup), function(x){as.numeric(uiongeneup %in% x)}) %>%
as.data.frame()
names(indexup) <- c("GSE75415up", "GSE76260up", "TCGA_PRADup")
rownames(indexup) <- uiongeneup
indexdown <- lapply(list(GSE75415down, GSE76260down, TCGA_PRADdown), function(x){as.numeric(uiongenedown %in% x)}) %>%
as.data.frame()
names(indexdown) <- c("GSE75415down", "GSE76260down", "TCGA_PRADdown")
####
tiff("Plot00_mirna.tiff", width = 2600, height = 1500, units = 'px', res = 300)
upset(indexup,
main.bar.color = "blue",
matrix.color = "red",
sets.bar.color = "blue",
point.size = 3,
line.size = 1,
mb.ratio = c(0.7, 0.3),
text.scale = 2)
dev.off()
tiff("Plot1_miRNA.tiff", width = 2600, height = 1500, units = 'px', res = 300)
upset(indexdown,
main.bar.color = "blue",
matrix.color = "red",
sets.bar.color = "blue",
point.size = 3,
line.size = 1,
mb.ratio = c(0.7, 0.3),
text.scale = 2)
dev.off()
intersetup <- intersect(intersect(GSE75415up, GSE76260up), TCGA_PRADup)
intersectdown <- intersect(intersect(GSE75415down, GSE76260down), TCGA_PRADdown)
save(intersectdown, intersetup, file = "result/intersect_miRNA.RData")