From 909e168e2db54680e83a610a9f11a59e7e87a817 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Wed, 18 Sep 2024 16:01:42 -0400 Subject: [PATCH] Skip Overlap coloring for unadjusted df --- .../apps/r/calculate_interaction_zscores.R | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R index f0226dfb..070d0382 100644 --- a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R +++ b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R @@ -768,7 +768,7 @@ generate_interaction_plot_configs <- function(df, variables) { return(configs) } -generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE) { +generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE, overlap_color = FALSE) { sd_bands <- c(1, 2, 3) @@ -907,7 +907,7 @@ generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE) { add_smooth = TRUE, lm_line = list(intercept = intercept, slope = slope), legend_position = "right", - color_var = "Overlap", + color_var = if (overlap_color) "Overlap" else NULL, x_label = x_var, y_label = y_var, rectangles = rectangles @@ -1019,7 +1019,7 @@ process_data <- function(df, variables, filter_nf = FALSE, filter_na = FALSE, ad # Calculate and add rank columns # TODO probably should be moved to separate function if (rank) { - message("Calculating ranks for Avg_Zscore_ and Z_lm_ columns") + message("Calculating ranks for Avg_Zscore and Z_lm columns") rank_col_mapping <- setNames(rank_avg_zscore_cols, avg_zscore_cols) df <- df %>% @@ -1462,7 +1462,8 @@ main <- function() { rank_plot_filtered_configs <- generate_rank_plot_configs( df = zscores_interactions_filtered_ranked, variables = interaction_vars, - is_lm = FALSE + is_lm = FALSE, + overlap_color = TRUE ) message("Generating filtered ranked plots") @@ -1476,7 +1477,8 @@ main <- function() { rank_plot_lm_filtered_configs <- generate_rank_plot_configs( df = zscores_interactions_filtered_ranked, variables = interaction_vars, - is_lm = TRUE + is_lm = TRUE, + overlap_color = TRUE ) generate_and_save_plots( out_dir = out_dir,