diff --git a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R index 5ea492a7..4d93541a 100644 --- a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R +++ b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R @@ -675,7 +675,7 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width color = config$error_bar_params$color, linewidth = 0.1 ) - + } else { # If no custom error bar formula, use the default or dynamic ones if (!is.null(config$color_var) && is.null(config$error_bar_params$color)) { @@ -703,14 +703,25 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width # Add the center point if the option is provided if (!is.null(config$error_bar_params$mean_point) && config$error_bar_params$mean_point) { - plot <- plot + geom_point( - aes( - x = .data[[config$x_var]], - y = .data[[y_mean_col]] - ), - color = config$error_bar_params$color, - shape = 16 - ) + if (!is.null(config$color_var) && is.null(config$error_bar_params$color)) { + plot <- plot + geom_point( + aes( + x = .data[[config$x_var]], + y = .data[[y_mean_col]], + color = .data[[config$color_var]] + ), + shape = 16 + ) + } else { + plot <- plot + geom_point( + aes( + x = .data[[config$x_var]], + y = .data[[y_mean_col]] + ), + color = config$error_bar_params$color, + shape = 16 + ) + } } } @@ -1067,8 +1078,8 @@ generate_interaction_plot_configs <- function(df_summary, df_interaction, type) coord_cartesian = y_limits, annotations = list( list(x = 1, y = y_limits[2] - 0.1 * y_span, label = paste(" ZShift =", round(Z_Shift_value, 2))), - list(x = 1, y = y_limits[2] - 0.2 * y_span, label = paste(" lm ZScore =", round(Z_lm_value, 2))), - list(x = 1, y = y_limits[2] - 0.3 * y_span, label = paste(" R-squared =", round(R_squared_value, 2))), + list(x = 1, y = y_limits[2] - 0.2 * y_span, label = paste(" lm ZScore =", round(Z_lm_value, 2))), + # list(x = 1, y = y_limits[2] - 0.3 * y_span, label = paste(" R-squared =", round(R_squared_value, 2))), list(x = 1, y = y_limits[1] + 0.1 * y_span, label = paste("NG =", NG_value)), list(x = 1, y = y_limits[1] + 0.05 * y_span, label = paste("DB =", DB_value)), list(x = 1, y = y_limits[1], label = paste("SM =", SM_value))