فهرست منبع

Fix default error bar calculations

Bryan Roessler 6 ماه پیش
والد
کامیت
964d2ad9b2
1فایلهای تغییر یافته به همراه6 افزوده شده و 5 حذف شده
  1. 6 5
      qhtcp-workflow/apps/r/calculate_interaction_zscores.R

+ 6 - 5
qhtcp-workflow/apps/r/calculate_interaction_zscores.R

@@ -433,7 +433,7 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs) {
           aes_mapping <- aes(x = .data[[config$x_var]])
         }
       } else {
-        # For other plot types
+        # For scatter and other plot types
         if (!is.null(config$y_var) && !is.null(config$color_var)) {
           aes_mapping <- aes(x = .data[[config$x_var]], y = .data[[config$y_var]], color = .data[[config$color_var]])
         } else if (!is.null(config$y_var)) {
@@ -465,17 +465,18 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs) {
         } else {
           "red"
         }
-        
+
+        # Use error_bar_params if provided, otherwise calculate from mean and sd
         if (!is.null(config$error_bar_params$ymin) && !is.null(config$error_bar_params$ymax)) {
           ymin_value <- config$error_bar_params$ymin
           ymax_value <- config$error_bar_params$ymax
         } else {
           y_mean_col <- paste0("mean_", config$y_var)
           y_sd_col <- paste0("sd_", config$y_var)
-          ymin_value <- !!sym(y_mean_col) - !!sym(y_sd_col)
-          ymax_value <- !!sym(y_mean_col) + !!sym(y_sd_col)
+          ymin_value <- df[[y_mean_col]] - df[[y_sd_col]]
+          ymax_value <- df[[y_mean_col]] + df[[y_sd_col]]
         }
-        
+
         plot <- plot + geom_errorbar(aes(
           ymin = ymin_value,
           ymax = ymax_value,