Skip Overlap coloring for unadjusted df

This commit is contained in:
2024-09-18 16:01:42 -04:00
parent b4875430f8
commit 909e168e2d

View File

@@ -768,7 +768,7 @@ generate_interaction_plot_configs <- function(df, variables) {
return(configs) 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) sd_bands <- c(1, 2, 3)
@@ -907,7 +907,7 @@ generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE) {
add_smooth = TRUE, add_smooth = TRUE,
lm_line = list(intercept = intercept, slope = slope), lm_line = list(intercept = intercept, slope = slope),
legend_position = "right", legend_position = "right",
color_var = "Overlap", color_var = if (overlap_color) "Overlap" else NULL,
x_label = x_var, x_label = x_var,
y_label = y_var, y_label = y_var,
rectangles = rectangles rectangles = rectangles
@@ -1019,7 +1019,7 @@ process_data <- function(df, variables, filter_nf = FALSE, filter_na = FALSE, ad
# Calculate and add rank columns # Calculate and add rank columns
# TODO probably should be moved to separate function # TODO probably should be moved to separate function
if (rank) { 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) rank_col_mapping <- setNames(rank_avg_zscore_cols, avg_zscore_cols)
df <- df %>% df <- df %>%
@@ -1462,7 +1462,8 @@ main <- function() {
rank_plot_filtered_configs <- generate_rank_plot_configs( rank_plot_filtered_configs <- generate_rank_plot_configs(
df = zscores_interactions_filtered_ranked, df = zscores_interactions_filtered_ranked,
variables = interaction_vars, variables = interaction_vars,
is_lm = FALSE is_lm = FALSE,
overlap_color = TRUE
) )
message("Generating filtered ranked plots") message("Generating filtered ranked plots")
@@ -1476,7 +1477,8 @@ main <- function() {
rank_plot_lm_filtered_configs <- generate_rank_plot_configs( rank_plot_lm_filtered_configs <- generate_rank_plot_configs(
df = zscores_interactions_filtered_ranked, df = zscores_interactions_filtered_ranked,
variables = interaction_vars, variables = interaction_vars,
is_lm = TRUE is_lm = TRUE,
overlap_color = TRUE
) )
generate_and_save_plots( generate_and_save_plots(
out_dir = out_dir, out_dir = out_dir,