Add jittering to interaction plots

This commit is contained in:
2024-09-29 18:36:55 -04:00
parent c18f70a08a
commit 5d25b3c3ef

View File

@@ -151,12 +151,12 @@ load_and_filter_data <- function(easy_results_file, sd = 3) {
OrfRep = if_else(ORF == "YDL227C", "YDL227C", OrfRep), # should these be hardcoded?
conc_num = as.numeric(gsub("[^0-9\\.]", "", Conc)),
conc_num_factor_new = factor(conc_num),
conc_num_factor_zeroed = factor(as.numeric(conc_num_factor2) - 1),
conc_num_factor = as.numeric(conc_num_factor_zeroed) # for legacy purposes, neither conc_num nor a factor
conc_num_factor_zeroed = factor(as.numeric(conc_num_factor_new) - 1),
conc_num_factor = as.numeric(conc_num_factor_zeroed) # for legacy purposes
)
return(df)
}
}
# Update Gene names using the SGD gene list
update_gene_names <- function(df, sgd_gene_list) {
@@ -251,10 +251,10 @@ calculate_interaction_scores <- function(df, max_conc, bg_stats,
Zscore_AUC = Delta_AUC / WT_sd_AUC,
# Fit linear models and store in list-columns
gene_lm_L = list(lm(Delta_L ~ conc_num_factor_zeroed_num, data = pick(everything()))),
gene_lm_K = list(lm(Delta_K ~ conc_num_factor_zeroed_num, data = pick(everything()))),
gene_lm_r = list(lm(Delta_r ~ conc_num_factor_zeroed_num, data = pick(everything()))),
gene_lm_AUC = list(lm(Delta_AUC ~ conc_num_factor_zeroed_num, data = pick(everything()))),
gene_lm_L = list(lm(Delta_L ~ conc_num_factor, data = pick(everything()))),
gene_lm_K = list(lm(Delta_K ~ conc_num_factor, data = pick(everything()))),
gene_lm_r = list(lm(Delta_r ~ conc_num_factor, data = pick(everything()))),
gene_lm_AUC = list(lm(Delta_AUC ~ conc_num_factor, data = pick(everything()))),
# Extract coefficients using purrr::map_dbl
lm_intercept_L = map_dbl(gene_lm_L, ~ coef(.x)[1]),
@@ -763,7 +763,8 @@ generate_interaction_plot_configs <- function(df, limits_map = NULL, plot_type =
error_bar = TRUE,
x_breaks = unique(df_filtered$conc_num_factor_new),
x_labels = as.character(unique(df_filtered$conc_num)),
grid_layout = list(ncol = 2, nrow = 2)
grid_layout = list(ncol = 2, nrow = 2),
position = "jitter"
)
configs <- append(configs, list(config))
}