|
@@ -390,11 +390,19 @@ generate_and_save_plots <- function(output_dir, file_name, plot_configs, grid_la
|
|
|
# print(df %>% select(any_of(c("OrfRep", "Plate", "scan", "Col", "Row", "num", "OrfRep", "conc_num", "conc_num_factor",
|
|
|
# "delta_bg_tolerance", "delta_bg", "Gene", "L", "K", "r", "AUC", "NG", "DB"))), n = 5)
|
|
|
|
|
|
- # Define aes mapping based on the presence of y_var
|
|
|
- aes_mapping <- if (is.null(config$y_var)) {
|
|
|
- aes(x = !!sym(config$x_var), color = as.factor(!!sym(config$color_var)))
|
|
|
+ # Plots are testy about missing aesthetics, so handle them here
|
|
|
+ aes_mapping <- if (is.null(config$color_var)) {
|
|
|
+ if (is.null(config$y_var)) {
|
|
|
+ aes(x = !!sym(config$x_var))
|
|
|
+ } else {
|
|
|
+ aes(x = !!sym(config$x_var), y = !!sym(config$y_var))
|
|
|
+ }
|
|
|
} else {
|
|
|
- aes(x = !!sym(config$x_var), y = !!sym(config$y_var), color = as.factor(!!sym(config$color_var)))
|
|
|
+ if (is.null(config$y_var)) {
|
|
|
+ aes(x = !!sym(config$x_var), color = as.factor(!!sym(config$color_var)))
|
|
|
+ } else {
|
|
|
+ aes(x = !!sym(config$x_var), y = !!sym(config$y_var), color = as.factor(!!sym(config$color_var)))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
plot <- ggplot(df, aes_mapping)
|
|
@@ -929,7 +937,8 @@ main <- function() {
|
|
|
y_var = var,
|
|
|
plot_type = "box",
|
|
|
title = paste("Plate analysis by Drug Conc for", var, stage, "quality control"),
|
|
|
- error_bar = FALSE, color_var = "conc_num")
|
|
|
+ error_bar = FALSE,
|
|
|
+ color_var = "conc_num")
|
|
|
|
|
|
plate_analysis_boxplots <- append(plate_analysis_boxplots, list(config))
|
|
|
}
|
|
@@ -1193,7 +1202,6 @@ main <- function() {
|
|
|
) %>%
|
|
|
ungroup()
|
|
|
|
|
|
-
|
|
|
rank_plot_configs <- c(
|
|
|
generate_rank_plot_configs(zscores_interactions_filtered, "Rank_L", "Avg_Zscore_L", "L"),
|
|
|
generate_rank_plot_configs(zscores_interactions_filtered, "Rank_K", "Avg_Zscore_K", "K")
|