included_drugs <- c("Cisplatin", "CX-5461", "vehicle")
df <- expand.grid(drug = included_drugs, line = c("95.22","HTERTwt","112.109","83.86","HCT116 B18","HCT116wt" , "MDA-MB-231", "112.109 early"), `timepoint 1` = 0, `timepoint 2` = 0, `timepoint 3` = 0)
rownames(df) <- paste(df$line, df$drug, sep =" / ")
df[df$drug=="CX-5461", "timepoint 1"] = 1
df[df$drug=="vehicle", "timepoint 1"] = 1
col_fun = colorRamp2(c(0, 1), c("white", "red"))
dplyr::select(df, str_subset(colnames(df), "timepoint")) %>%
Heatmap(col = col_fun,
cluster_columns = F,
cluster_rows = T,
show_row_dend = F,
row_title_rot = 0,
row_split = df$line,
cell_fun = function(j, i, x, y, width, height, fill) {
if (j %% 2 == 1 ) {
grid.rect(x = x, y = y, width = width, height = height, gp = gpar(col = "black", fill = "NA"))
} else {
grid.rect(x = x, y = y, width = width, height = height, gp = gpar(col = "black", fill = "NA"))
}
})
## Warning: The input is a data frame-like object, convert it to a matrix.
3 × 10 concentrations/untreated for CX-5461 and Cisplatin.
filepath_raw <- "2024-05-19 HTERT HCT CX cis ctg.xlsx"
range_raw <- c("D5:M10", "D26:M31", "D47:M52", "D68:M73", "D89:M94", "D110:M115")
range_name <- c("B2", "B23", "B44", "B65", "B86", "B107")
n_conditions <- length(range_raw)
raw <- list()
for (i in 1:n_conditions) {
raw[[i]] <- tibble(raw_lum = c(unlist(read_excel(
here("spectramax", filepath_raw), sheet = 1,
range = range_raw[i], col_names = F))),
map = c(unlist(read_excel(
here("spectramax", filepath_raw), sheet = 2,
range = range_raw[i], col_names = F))),
line = as.character(read_excel(here("spectramax", filepath_raw), sheet = 1, range = range_name[i], col_names = F))
)
}
# raw <- bind_rows(raw)
# manual set raw
for (i in 1:length(raw)) {
raw[[i]] <- raw[[i]] %>%
separate(map, into = c("concentration", "drug"), sep = "_", extra = "merge") %>%
mutate(concentration = case_when(
concentration == "0uM" ~ 0,
concentration == "0.001uM" ~ 1e-9,
concentration == "0.01uM" ~ 1e-8,
concentration == "0.1uM" ~ 1e-7,
concentration == "1uM" ~ 1e-6,
concentration == "10uM" ~ 1e-5,
concentration == "100uM" ~ 1e-4,
concentration == "0.003uM" ~ 3e-9,
concentration == "0.03uM" ~ 3e-8,
concentration == "0.3uM" ~ 3e-7,
concentration == "3uM" ~ 3e-6,
concentration == "30uM" ~ 3e-5,
))
}
control <- vector(mode = "list", length = n_conditions)
for (i in 1:length(raw)) {
control[[i]] <- raw[[i]] %>%
filter(concentration == 1e-09) %>%
group_by(drug) %>%
summarize(control = mean(raw_lum))
raw[[i]] <- left_join(raw[[i]], control[[i]]) %>%
mutate(`% ctg` = raw_lum/control*100)
}
raw_all <- bind_rows(raw)
# raw[[1]] <- filter(raw_all, line != "HTERT wild-type")
rm(control)
# drm <- vector(mode = "list", length = n_conditions)
drm_all <- drm(`% ctg` ~ concentration, fct = LL.4(), curveid = interaction(drug, line), data = filter(raw_all, drug=="CX-5461"), control = drmc(constr = TRUE))
# names(X2911_drm) <- c("hypoxic", "normoxic")
# d is max, e is ED50
ED50 <- ED(drm_all, 50)
# included_drugs <- c("Cisplatin", "CX-5461")
included_drugs <- "CX-5461"
prediction_data <- expand.grid(drug = included_drugs, line = unique(raw_all$line), concentration = 10^(seq(log10(1e-9), log10(3e-5), length = 100)))
# crc <- vector(mode = "list", length = n_conditions)
crc_all <- prediction_data %>%
mutate(`% ctg` = predict(drm_all, newdata = prediction_data))
# get ED coordinates
plot_ED <- tibble(
drug = str_sub(str_extract(names(ED50[,1]), ":.+:"), 2, -2),
concentration = ED50[,1]
)
coef(drm[[1]])[str_detect(names(coef(drm[[1]])), "Cisplatin") & (str_detect(names(coef(drm[[1]])), "c")|str_detect(names(coef(drm[[1]])), "d"))]
output_plot <- FALSE
if (output_plot) {
raw_all %>%
filter(drug == "CX-5461") %>%
ggplot(aes(x = concentration, y = `% ctg`, color = line)) +
geom_point() +
geom_line(data = crc_all) +
# geom_vline(xintercept = ED50[,1], color = hue_pal()(length(unique(raw[[1]]$line)))[order(c(4,2,3,1))], linetype = "dashed", alpha = 0.6) +
# facet_grid(cols = vars(drug)) +
# geom_hline(yintercept = coef(drm[[1]])[3:4], color = hue_pal()(2)) +
# geom_point(aes(y= 67.42422, x = 5.648491e-06), color = "black") +
# geom_point(data = tibble(y = coef(drm[[1]])[3:4]/2, x = coef(drm[[1]])[5:6]), aes(y = y, x = x), color = "black") +
# geom_vline(xintercept = ED50[,1][2], color = hue_pal()(length(unique(raw[[1]]$line)))[2], linetype = "dotted") +
scale_x_log10() +
theme_bw()
}
Using the UpSetR
package. 20 most positively and
negatively fit guides for each cell line.
HTERT wild-type and MCF-7
HTERT wild-type and MDA-MB-231
MDA-MB-231 and MCF-7
raw:
Rank difference between treated and vehicle conditions. 20 most differential fit guides in both directions to get set for each cell line.