Quellcode durchsuchen

Skip Overlap coloring for unadjusted df

Bryan Roessler vor 7 Monaten
Ursprung
Commit
909e168e2d
1 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
  1. 7 5
      qhtcp-workflow/apps/r/calculate_interaction_zscores.R

+ 7 - 5
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,