Skip to content

Commit 8783ec7

Browse files
committed
added scripts for generating plots found in paper
+ minor bug fix in plot.synergyscreen
1 parent be0bfca commit 8783ec7

5 files changed

Lines changed: 131 additions & 2 deletions

File tree

R/plot.synergyscreen.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ plot.synergyscreen <- function(x, groupbyExperimentID = T, save_plots = FALSE, p
111111
lower_breaks[1] = -l
112112
upper_breaks[4] = l
113113
breaks = as.numeric(c(lower_breaks,upper_breaks))
114+
breaks = sort(jitter(breaks))
114115
Delta_col_palette <- inlmisc::GetColors(scheme = "BuRd")
115116

116117

@@ -216,7 +217,7 @@ plot.synergyscreen <- function(x, groupbyExperimentID = T, save_plots = FALSE, p
216217
breaks = round(breaks,2),
217218
values = scales::rescale(breaks),
218219
limits = round(max(abs(synscores3$mean_int))*c(-1,1),2),
219-
guide = guide_coloursteps(even.steps = F,
220+
guide = guide_coloursteps(even.steps = T,
220221
show.limits = T,
221222
title = "Interaction",
222223
barheight = unit(3.3, "in"))) +
@@ -312,6 +313,7 @@ plot.synergyscreen <- function(x, groupbyExperimentID = T, save_plots = FALSE, p
312313
lower_breaks[1] = -l
313314
upper_breaks[4] = l
314315
breaks = as.numeric(c(lower_breaks,upper_breaks))
316+
breaks = sort(jitter(breaks))
315317

316318

317319
# Center
@@ -368,7 +370,7 @@ plot.synergyscreen <- function(x, groupbyExperimentID = T, save_plots = FALSE, p
368370
breaks = round(breaks,2),
369371
values = scales::rescale(breaks),
370372
limits = round(max(abs(synscores3$mean_int))*c(-1,1),2),
371-
guide = guide_coloursteps(even.steps = F,
373+
guide = guide_coloursteps(even.steps = T,
372374
show.limits = T,
373375
title = "Interaction",
374376
barheight = unit(3.3, "in"))) +

doc/paperFigures/generate.R

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###### Script for generating plots for the bayesynergy paper
2+
3+
# The dataset is from [1] and has been preprocessed according to the function preprocess.R
4+
5+
# For Figure 4, we include a subset of this dataset, consisting of 3498 experiments
6+
# on six breast cancer cell lines. This dataset has been run through the synergyscreen
7+
# function on default settings, and the file "screen.RData" contains the resulting object.
8+
9+
# For Figure 5 and Table 1, the data must be generated according to the instructions in
10+
# preprocess.R
11+
12+
########################################################################################
13+
############################ FIG 4 ################################################
14+
###### Drug combination screen on breast cancer cell line ##########################
15+
########################################################################################
16+
library(bayesynergy)
17+
18+
# Data for figure 4 is included in the folder
19+
load("screen.RData")
20+
21+
plot(fit_screen,save_plots=T,plotdevice="png", width=7,height=7,units="in",res=600,
22+
groupbyExperimentID=F)
23+
24+
25+
########################################################################################
26+
############################ FIG 5 ################################################
27+
###### Gemcitabine + MK-8776 on the OCUBM cell line ################################
28+
########################################################################################
29+
# The file "OCUBM : Gemcitabine + MK-8776.csv" can be generated by following instructions
30+
# in preprocess.R
31+
32+
data = read.table("OCUBM : Gemcitabine + MK-8776.csv",sep=",",header=T)
33+
34+
x = as.matrix(data[,c(4,6)])
35+
y = data$viability
36+
drug_names = c(data$drugA_name[1],data$drugB_name[1])
37+
experiment_ID = data$cell_line[1]
38+
units = c("μM","μM")
39+
40+
fit = bayesynergy(y=y, x=x, drug_names=drug_names, experiment_ID = experiment_ID, units=units)
41+
42+
plot(fit,save_plots=T, plotdevice="png", width=7,height=7,units="in",res=600, plot3D=F)
43+
44+
45+
46+
########################################################################################
47+
############################ Table 1 ##############################################
48+
###### Gemcitabine + MK-8776 on the OCUBM cell line ################################
49+
########################################################################################
50+
summary(fit)
51+
52+
53+
54+
55+
56+
# References:
57+
# [1]
58+
# Jennifer O'Neil, Yair Benita, Igor Feldman, Melissa Chenard, Brian Roberts, Yaping Liu, Jing Li, Astrid Kral, Serguei Lejnine, Andrey Loboda, William Arthur, Razvan Cristescu, Brian B. Haines, Christopher Winter, Theresa Zhang, Andrew Bloecher and Stuart D. Shumway
59+
# Mol Cancer Ther June 1 2016 (15) (6) 1155-1162; DOI: 10.1158/1535-7163.MCT-15-0843
60+
61+
62+
63+

doc/paperFigures/preprocess.R

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
##### Script for pre-processing the dataset from [1]
2+
# Used for generating data for Figure 5 and Table 1
3+
4+
# Input:
5+
# 156849_1_supp_0_w2lh45.xlsx (single agent viabilities)
6+
# 156849_1_supp_1_w2lrww.xls (combination viabilities)
7+
# N.B. This file needs to be opened and resaved as xlsx
8+
# Both of these available as supplementary material for [1]
9+
10+
# Output:
11+
# OCUBM : Gemcitabine + MK-8776.csv
12+
# .csv file containing the single example experiment used for Figure 5 and Table 1
13+
14+
# set path to the location of these files
15+
16+
#path = "path to raw input files"
17+
18+
# Use dplyr and tidyr for preprocessing, readxl for input
19+
library(tidyr)
20+
library(dplyr)
21+
library(readxl)
22+
23+
# Read in files
24+
mono = read_excel(paste0(path,"/156849_1_supp_0_w2lh45.xlsx"))
25+
combo = read_excel(paste0(path,"/156849_1_supp_1_w2lrww.xlsx"))
26+
27+
# Select only OCUBM cell line and the drugs c("Gemcitabine","MK-8776")
28+
drugs = c("Gemcitabine","MK-8776")
29+
cellLine = "OCUBM"
30+
31+
mono = mono %>% filter(`cell_line` == cellLine) %>% filter(`drug_name` %in% drugs)
32+
combo = combo %>% filter(`cell_line` == cellLine) %>% filter(`drugA_name` == drugs[1] & `drugB_name` == drugs[2] |
33+
`drugA_name` == drugs[2] & `drugB_name` == drugs[1])
34+
35+
# Now work everything into the correct format, viabilities are numeric
36+
mono = mono %>% mutate(across(.cols=starts_with("viability"),as.numeric))
37+
combo = combo %>% mutate(across(.cols=starts_with("viability"),as.numeric))
38+
39+
# Convert to long format and remove some columns
40+
mono = pivot_longer(mono,cols=starts_with("viability"),values_to = "viability") %>%
41+
select(cell_line, drug_name, `Drug_concentration (µM)`,viability)
42+
combo = pivot_longer(combo, cols=starts_with("viability"),values_to="viability") %>%
43+
select("cell_line", "drugA_name", "drugA Conc (µM)", "drugB_name","drugB Conc (µM)","viability")
44+
45+
# Now get mono into the same format as the combo
46+
mono = mono %>% mutate("drugA_name" = combo$drugA_name[1],
47+
"drugB_name" = combo$drugB_name[1]) %>%
48+
mutate(`drugA Conc (µM)` = ifelse(drug_name == drugA_name,`Drug_concentration (µM)`,0)) %>%
49+
mutate(`drugB Conc (µM)` = ifelse(drug_name == drugB_name,`Drug_concentration (µM)`,0)) %>%
50+
select("cell_line", "drugA_name", "drugA Conc (µM)", "drugB_name","drugB Conc (µM)","viability")
51+
# Combine the two sets
52+
final = bind_rows(mono,combo)
53+
54+
55+
# Write csv
56+
final %>% write.csv(paste0(path,"/OCUBM : Gemcitabine + MK-8776.csv"))
57+
58+
59+
# References:
60+
# [1]
61+
# Jennifer O'Neil, Yair Benita, Igor Feldman, Melissa Chenard, Brian Roberts, Yaping Liu, Jing Li, Astrid Kral, Serguei Lejnine, Andrey Loboda, William Arthur, Razvan Cristescu, Brian B. Haines, Christopher Winter, Theresa Zhang, Andrew Bloecher and Stuart D. Shumway
62+
# Mol Cancer Ther June 1 2016 (15) (6) 1155-1162; DOI: 10.1158/1535-7163.MCT-15-0843

doc/paperFigures/screen.RData

454 KB
Binary file not shown.

man/BayeSyneRgy.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)