-
Notifications
You must be signed in to change notification settings - Fork 3
/
check_synergy_AZ.Rmd
243 lines (191 loc) · 14.7 KB
/
check_synergy_AZ.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
---
title: "check synergy"
author: "MI YANG"
date: "`r doc_date()`"
package: "`r pkg_ver('BiocStyle')`"
vignette: >
%\VignetteIndexEntry{Bioconductor style for HTML documents}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
output:
BiocStyle::html_document
---
```{r include=FALSE, cache=FALSE}
library(ggrepel)
path <- "~/Documents/RWTH_Aachen"
load(paste0(path,"/SANGER_DATA/MASTER_LIST_22112013.ro"))
source(paste0(path,"/FUNCTIONS/PLOT.R", sep=""))
source(paste0(path,"/MACAU_PROJECT/check_synergy_functions.R"))
source(paste0(path,"/MACAU_PROJECT/interaction_matrix_Functions.R"))
source(paste0(path,"/FUNCTIONS/general_functions.R"))
target <- read.csv(paste0(path,"/macau_work_dir/macau_test_sanger/DATA/target"), check.names = F) ; drug_names <- target[ ,1] ; target <- target[ ,-1]
DRUG_ANALYSIS_SET_update$Drug.Name <- DRUG_ANALYSIS_SET$DRUG_NAME
target_to_remove <- c()
for (i in 1:length(colnames(target))) {
protein_target <- print_target_GDSC (protein_target= colnames(target)[i], target_matrix=target, drug_names=drug_names )
if ( length(protein_target[,1]) == 1 ) { target_to_remove <- c(target_to_remove, i) }
}
target_to_remove <- c(target_to_remove , which(colnames(target) %in% c("others","not defined" )) )
SYN_MATRIX <- read.csv(paste0(path,"/DREAM_AZ/DATA/SYN_MATRIX"), row.names=1, check.names = F) ; SYN_MATRIX <- data.matrix(SYN_MATRIX)
progeny <- read.csv(paste0(path,"/DREAM_AZ/DATA/progeny11"), row.names=1, check.names = F)
target_combo <- read.csv(paste0(path,"/DREAM_AZ/DATA/target_combo"), row.names=1, check.names = F)
tissue <- c("aero_dig_tract","bone","brain","breast","colon","kidney","leukemia","liver","lung_NSCLC","lung_SCLC","lymphoma","ovary","pancreas","skin","soft_tissue","stomach")
```
# BREAST result
```{r include=FALSE, cache=FALSE}
########################## BREAST: choose tissue and target combo ########################
tissue_name <- "breast" ; ## we consider only cases with at least 10 cell lines ; tissue_name <- "lung_NSCLC" ## colon lung_NSCLC
SNP_CNV <- read.csv(paste0(path,"/SANGER_DATA/TISSUE/",tissue_name,"/SNP_CNV"), row.names=1,check.names=F) ;SNP_CNV<-ID_to_celllines(SNP_CNV) #
SNP_CNV <- SNP_CNV[order(rownames(SNP_CNV)), ]
Additional_Parameter <- cbind(SNP_CNV)
cell_names <- read.csv(paste0(path,"/SANGER_DATA/TISSUE/",tissue_name,"/progeny11"), row.names=1) ; cell_names <- ID_to_celllines(cell_names) ; cell_names <- rownames(cell_names)
######## EXCLUDE DRUG COMBO WITH TOO MANY DESCRIBED OFF TARGET EFFECT !!! ##########
# t<-c("AKT","ALK") ; high<-c("TNFa","MAPK"); low<-c("NFkB","EGFR"); genomics<-c(); exclude <- c() # no way to separate AKT1/2 from AKT3, we chose the anticorrelation with AKT1/2 instead
# t<-c("FGFR","PARP") ;high<-c("MAPK"); low<-c("EGFR","JAK.STAT") ; genomics<-c(); exclude <- c() ## way too many off target effects
#################################### PLOT result #########################################
library(cowplot)
result_folder <- paste0(path,"/MACAU_PROJECT/PLOTS/DRUG_COMBO_PREDICTION/AZ/")
dir.create(result_folder,recursive = TRUE)
pdf(file=paste0(result_folder,tissue_name,"_",paste("ALL_RESULT", sep="_"),".pdf"), width = 40, height = 40, compress=TRUE, onefile = F)
par(mfrow=c(3,3))
t<-c("AKT","EGFR"); high<-c("EGFR","NFkB","PI3K"); low<-c("MAPK"); genomics<-c("gain:cnaPANCAN124 (EGFR)"); exclude<-c("AKT.BRAF_VEGFR2","AKT_PIK3C.EGFR_2") #
df<-check_SYNERGY_AZ()[[1]]; fig1 <- scatter_plot_AZ(title=paste0(t[1],"/",t[2]," for ",length(rownames(df))," ",tissue_name," cell lines"),df=df,text_size=52,title_size=3.2,coeff_x = 0.55)
t<-c("AKT","MTOR"); high<-c("EGFR","VEGF","PI3K"); low<-c("MAPK","TNFa"); genomics<-c(); exclude <- c("AKT_SGK.MTOR_1","AKT_PIK3C.MTOR_1","AKT.PIK3C_MTOR","AKT.PIK3C_MTOR_2","AKT_1.MTOR_1") #
df<-check_SYNERGY_AZ()[[1]]; fig2 <- scatter_plot_AZ(title=paste0(t[1],"/",t[2]," for ",length(rownames(df))," ",tissue_name," cell lines"),df=df,text_size=52,title_size=3.2,coeff_x = 0.6)
t<-c("BCL2","MTOR") ; high<-c("VEGF","NFkB","Trail"); low<-c("MAPK","TNFa"); genomics<-c(); exclude <- c("BCL2_BCL2L1_BCL2L2.MTOR_1","BCL2L1.MTOR_1")
df<-check_SYNERGY_AZ()[[1]]; fig3 <- scatter_plot_AZ(title=paste0(t[1],"/",t[2]," for ",length(rownames(df))," ",tissue_name," cell lines"),df=df,text_size=52,title_size=3.2,coeff_x = 0.55)
t<-c("EGFR","MTOR"); high<-c("EGFR","NFkB","VEGF"); low<-c("MAPK","TNFa"); genomics<-c("gain:cnaPANCAN124 (EGFR)"); exclude <- c("BRAF_VEGFR2.MTOR_1","EGFR_2.PIK3C_MTOR","EGFR_2.PIK3C_MTOR_2") # ,"Hypoxia"
df<-check_SYNERGY_AZ()[[1]]; fig4 <- scatter_plot_AZ(title=paste0(t[1],"/",t[2]," for ",length(rownames(df))," ",tissue_name," cell lines"),df=df,text_size=52,title_size=3.2,coeff_x=0.35)
t<-c("AKT","BCL2") ; high<-c("EGFR","VEGF","PI3K"); low<-c("MAPK"); genomics<-c(); exclude <- c("AKT_1.BCL2_2","AKT_1.BCL2_BCL2L1","AKT_1.BCL2L1","AKT_SGK.BCL2_BCL2L1","AKT.BCL2_BCL2L1_BCL2L2")
df<-check_SYNERGY_AZ()[[1]]; fig5 <- scatter_plot_AZ(title=paste0(t[1],"/",t[2]," for ",length(rownames(df))," ",tissue_name," cell lines"),df=df,text_size=52,title_size=3.2)
# PI3K added required by AKT
t<-c("AKT","ALK") ; high<-c("EGFR","VEGF","PI3K"); low<-c("MAPK","TNFa"); genomics<-c(); exclude <- c()
df<-check_SYNERGY_AZ(inverse=-1)[[1]]; fig6 <- scatter_plot_AZ(title=paste0(t[1],"/",t[2]," for ",length(rownames(df))," ",tissue_name," cell lines"),df=df,text_size=52,title_size=3.2)
t<-c("AKT","PARP") ; high <- c("EGFR","VEGF","PI3K"); low <- c("MAPK","TNFa"); genomics<-c(); exclude <- c("AKT_1.TNKS_PARP6","AKT.TNKS_PARP6")
df<-check_SYNERGY_AZ(inverse=-1)[[1]]; fig7 <- scatter_plot_AZ(title=paste0(t[1],"/",t[2]," for ",length(rownames(df))," ",tissue_name," cell lines"),df=df,text_size=52,title_size=3.2)
plot_grid(fig1,fig2,fig3,fig4,fig5,fig6,fig7, nrow = 3, ncol = 3 , scale = 0.85)
dev.off()
```
# Does target functional footprint correlation affect TOP synergy in breast tissue?
```{r include=FALSE, cache=FALSE}
tissue_name <- "breast" ## we consider only cases with at least 10 cell lines ; breast colon lung_NSCLC
cell_names <- read.csv(paste0(path,"/SANGER_DATA/TISSUE/",tissue_name,"/progeny11"), row.names=1) ; cell_names <- ID_to_celllines(cell_names) ; cell_names <- rownames(cell_names)
result_folder <- paste0(path,"/MACAU_PROJECT/PLOTS/DRUG_COMBO_PREDICTION/AZ/")
dir.create(result_folder,recursive = TRUE)
target_common_AZ_SANGER <- read.csv(paste0(path,"/DREAM_AZ/DATA/target_common_AZ_SANGER_",tissue_name), row.names=1)
SYN_MATRIX_tissue <- as.data.frame(SYN_MATRIX[ ,colnames(SYN_MATRIX) %in% cell_names])
# ## normalizing by cell line ? it doesn't change the result
# SYN_MATRIX_tissue <- scale(SYN_MATRIX_tissue, scale = F,center = T)
# colMeans(SYN_MATRIX_tissue, na.rm=T)
temp <- target_common_AZ_SANGER
SYNERGY_store <- c()
for(i in 1:length(temp[,1])) {
t<-c(as.character(temp$target1[i]),as.character(temp$target2)[i])
## see which drug combo act on those targets simultaneously
target_combo_pair <- target_combo[ ,t]
target_combo_pair <- target_combo_pair[-which(rowSums(target_combo_pair)<2), ] # sometimes, no drug combo targets the 2 targets at the same time !! therefore many NAs
SYN_MATRIX_pair <- SYN_MATRIX_tissue[rownames(target_combo_pair), ]
v <- as.numeric(data.matrix(SYN_MATRIX_pair)); v<-v[order(-v)] ; v<-v[1:3]
SYNERGY_store <- c(SYNERGY_store, mean(v,na.rm=T) )
}
target_common_AZ_SANGER <- cbind(target_common_AZ_SANGER,SYNERGY_store)
target_common_AZ_SANGER <- target_common_AZ_SANGER[complete.cases(target_common_AZ_SANGER), ]
target_common_AZ_SANGER_total <- target_common_AZ_SANGER
## remove targets from the same drug:
target_A <- read.csv(paste0(path,"/DREAM_AZ/DATA/target_A"), row.names=1)
target_B <- read.csv(paste0(path,"/DREAM_AZ/DATA/target_B"), row.names=1)
target_AB <- rbind(target_A,target_B)
target_common_AZ_SANGER$target1 <- as.character(target_common_AZ_SANGER$target1)
target_common_AZ_SANGER$target2 <- as.character(target_common_AZ_SANGER$target2)
count <- c()
for(i in 1:length(target_common_AZ_SANGER[ ,1])) {
t <- c(target_common_AZ_SANGER[i,1],target_common_AZ_SANGER[i,2])
if( length(which(colnames(target_AB) %in% t)) == 2 ) {
subset <- target_AB[ , t ] ; subset_AB <- subset[ which(rowSums(subset)==1) , ]
count <- c(count, length(unique(rownames(subset_AB))) )
} else { count <- c(count, 0 ) }
}
target_common_AZ_SANGER <- target_common_AZ_SANGER[ -which(count==0) , ]
target_common_AZ_SANGER <- target_common_AZ_SANGER[ -which(target_common_AZ_SANGER$target1 == "AKT3") , ] # lung
target_common_AZ_SANGER <- target_common_AZ_SANGER[ -which(target_common_AZ_SANGER$target2 == "AKT3") , ]
target_common_AZ_SANGER <- target_common_AZ_SANGER[ -which(target_common_AZ_SANGER$target1 == "AKT2") , ] # lung
target_common_AZ_SANGER <- target_common_AZ_SANGER[ -which(target_common_AZ_SANGER$target2 == "AKT2") , ]
# Target pairs from the same drug: internal functional similarity
# target_common_AZ_SANGER <- target_common_AZ_SANGER_total [ which(rownames(target_common_AZ_SANGER_total) %not in% rownames(target_common_AZ_SANGER)) , ]
target_common_AZ_SANGER$corr <- as.numeric(as.character(target_common_AZ_SANGER$corr))
df <- data.frame(cbind(target_common_AZ_SANGER$corr,target_common_AZ_SANGER$SYNERGY_store)) ; colnames(df) <- c("a","b")
rownames(df) <- rownames(target_common_AZ_SANGER)
df_abs <- df ; df_abs$a <- abs(df_abs$a)
scatter_plot_normal <- function(df,title,x_lab,y_lab,switch_anchor=F,text_size=33,title_size=2.5 ,coeff_x=0.5,coeff_y=0) {
# equation, correlation and p value
out <- cor.test(df$a,df$b) ; r <- out$estimate ; p <- out$p.value
lm_eqn <- function(df){
m <- lm(b ~ a, df);
eq <- substitute(~~italic("r")~"="~r*","~~italic("p")~"="~p,
list(a = format(coef(m)[1], digits = 2),
b = format(coef(m)[2], digits = 2),
r = format(unname(r), digits = 2),
p = format(p, digits=2)))
as.character(as.expression(eq));
}
g <- ggplot(df, aes(a, b, color = b)) +
geom_point(shape = 16, size = 8, show.legend = FALSE, alpha = .8 ) + geom_smooth(method=lm,se=F,show.legend=F) +
labs(x =x_lab, y=y_lab) + ggtitle(title) +
theme(legend.position="bottom",axis.text=element_text(size= text_size) , axis.title= element_text(size=text_size), plot.title = element_text(size=rel(title_size), hjust=0.5),
panel.background = element_rect(fill='white'),panel.grid.major = element_line(colour = "grey90") ) +
geom_text(x = min(df$a) + coeff_x*(max(df$a)-min(df$a)), y = min(df$b) + coeff_y*(max(df$b)-min(df$b)), label = lm_eqn(df), parse = TRUE,show.legend=F,color="black",size = 15) +
scale_color_gradient(low = "#8B3A3A" , high = "#8B3A3A" ) #
g
}
scatter_plot <- function(title,df,text_size=33,title_size=2.5,method="loess") {
top_hits <- df[ which(df$b>20) , ] ; label_top_hits <- rownames(top_hits)
rest <- df[ which(rownames(df) %not in% label_top_hits) , ] ; label_rest <- rownames(rest)
g <- ggplot(df, aes(a, b, color=b)) +
geom_point(shape = 16, size = 7, show.legend = FALSE, alpha = 0.9 ) + geom_smooth(method=method,se=F,show.legend=F) +
labs(x = "Target functional similarity", y="Average Synergy of Top drug combinations" ) + ggtitle(title) +
theme(legend.position="none",axis.text=element_text(size= text_size) , axis.title= element_text(size=text_size), plot.title = element_text(size =rel(title_size), hjust = 0.5 ),
panel.background = element_rect(fill='white'),panel.grid.major = element_line(colour = "grey90") ) +
geom_text_repel(data=top_hits ,aes(label=label_top_hits), size=9, color="black", force = 1.5) +
scale_color_gradient(low = "#8B3A3A" , high = "#8B3A3A") # #0091ff #990000
g
}
scatter_plot_small <- function(title,df,text_size=33,title_size=2.5,method="loess") {
g <- ggplot(df, aes(a, b, color=b)) +
geom_point(shape = 16, size = 7, show.legend = FALSE, alpha = 0.9 ) + geom_smooth(method=method,se=F,show.legend=F) +
labs(x = "Target functional similarity", y="Average Synergy of Top drug combinations" ) + ggtitle(title) +
theme(legend.position="none",axis.text=element_text(size= text_size) , axis.title= element_text(size=text_size), plot.title = element_text(size =rel(title_size), hjust = 0.5 ),
panel.background = element_rect(fill='white'),panel.grid.major = element_line(colour = "grey90") ) +
scale_color_gradient(low = "#8B3A3A" , high = "#8B3A3A") # #0091ff #990000
g
}
## BREAST
pdf(file=paste0(result_folder,tissue_name,"_","AZ_SANGER_common_target_synergy_STATISTICS.pdf"), width = 10, height = 10, compress=TRUE, onefile = F)
scatter_plot_normal(df=df_abs,title=paste0("Target combinations (",tissue_name,")"),x_lab="Absolute Target functional similarity",y_lab="Average Synergy of top drug combinations",coeff_x=0.45)
dev.off()
pdf(file=paste0(result_folder,tissue_name,"_","AZ_SANGER_common_target_synergy.pdf"), width = 16, height = 16, compress=TRUE, onefile = F)
scatter_plot(title=paste0("Target combinations (",tissue_name,")"),df=df)
dev.off()
pdf(file=paste0(result_folder,tissue_name,"_","AZ_SANGER_common_target_synergy_Small.pdf"), width = 10, height = 10, compress=TRUE, onefile = F)
scatter_plot_small(title=paste0("Target combinations (",tissue_name,")"),df=df)
dev.off()
## COLON
pdf(file=paste0(result_folder,tissue_name,"_","AZ_SANGER_common_target_synergy_STATISTICS.pdf"), width = 10, height = 10, compress=TRUE, onefile = F)
scatter_plot_normal(df=df_abs,title=paste0("Target combinations (",tissue_name,")"),x_lab="Absolute Target functional similarity",y_lab="Average Synergy of top drug combinations",coeff_x=0.6)
dev.off()
pdf(file=paste0(result_folder,tissue_name,"_","AZ_SANGER_common_target_synergy.pdf"), width = 16, height = 16, compress=TRUE, onefile = F)
scatter_plot(title=paste0("Target combinations (",tissue_name,")"),df=df)
dev.off()
pdf(file=paste0(result_folder,tissue_name,"_","AZ_SANGER_common_target_synergy_Small.pdf"), width = 10, height = 10, compress=TRUE, onefile = F)
scatter_plot_small(title=paste0("Target combinations (",tissue_name,")"),df=df)
dev.off()
## LUNG
pdf(file=paste0(result_folder,tissue_name,"_","AZ_SANGER_common_target_synergy_STATISTICS.pdf"), width = 10, height = 10, compress=TRUE, onefile = F)
scatter_plot_normal(df=df_abs,title=paste0("Target combinations (",tissue_name,")"),x_lab="Absolute Target functional similarity",y_lab="Average Synergy of top drug combinations",coeff_x = 0.55,coeff_y = 0.1)
dev.off()
pdf(file=paste0(result_folder,tissue_name,"_","AZ_SANGER_common_target_synergy.pdf"), width = 16, height = 16, compress=TRUE, onefile = F)
scatter_plot(title=paste0("Target combinations (",tissue_name,")"),df=df)
dev.off()
pdf(file=paste0(result_folder,tissue_name,"_","AZ_SANGER_common_target_synergy_Small.pdf"), width = 10, height = 10, compress=TRUE, onefile = F)
scatter_plot_small(title=paste0("Target combinations (",tissue_name,")"),df=df)
dev.off()
```