Use precomputed se values with Bessel's correction
This commit is contained in:
@@ -189,7 +189,7 @@ calculate_summary_stats <- function(df, variables, group_vars) {
|
||||
max = ~ifelse(all(is.na(.)), NA, max(., na.rm = TRUE)),
|
||||
min = ~ifelse(all(is.na(.)), NA, min(., na.rm = TRUE)),
|
||||
sd = ~sd(., na.rm = TRUE),
|
||||
se = ~sd(., na.rm = TRUE) / sqrt(N - 1) # TODO non-standard SE, needs explanation
|
||||
se = ~sd(., na.rm = TRUE) / sqrt(N - 1) # Bessel's correction
|
||||
),
|
||||
.names = "{.fn}_{.col}"
|
||||
),
|
||||
@@ -581,13 +581,13 @@ generate_scatter_plot <- function(plot, config) {
|
||||
# Add Error Bars if specified
|
||||
if (!is.null(config$error_bar) && config$error_bar && !is.null(config$y_var)) {
|
||||
y_mean_col <- paste0("mean_", config$y_var)
|
||||
y_sd_col <- paste0("sd_", config$y_var)
|
||||
y_se_col <- paste0("se_", config$y_var)
|
||||
|
||||
plot <- plot +
|
||||
geom_errorbar(
|
||||
aes(
|
||||
ymin = !!sym(y_mean_col) - !!sym(y_sd_col),
|
||||
ymax = !!sym(y_mean_col) + !!sym(y_sd_col)
|
||||
ymin = !!sym(y_mean_col) - !!sym(y_se_col),
|
||||
ymax = !!sym(y_mean_col) + !!sym(y_se_col)
|
||||
),
|
||||
alpha = 0.3
|
||||
)
|
||||
@@ -676,7 +676,8 @@ generate_plate_analysis_plot_configs <- function(variables, stages = c("before",
|
||||
title = paste("Plate analysis by Drug Conc for", var, stage, "quality control"),
|
||||
error_bar = error_bar,
|
||||
color_var = "conc_num",
|
||||
position = position
|
||||
position = position,
|
||||
size = 0.2
|
||||
)
|
||||
plots <- append(plots, list(config))
|
||||
}
|
||||
@@ -760,7 +761,7 @@ generate_interaction_plot_configs <- function(df, limits_map = NULL) {
|
||||
x_breaks = levels(df_filtered$conc_num_factor),
|
||||
x_labels = levels(df_filtered$conc_num_factor),
|
||||
x_label = unique(df_filtered$Drug[1]),
|
||||
coord_cartesian = y_range
|
||||
coord_cartesian = y_range,
|
||||
)
|
||||
|
||||
# Scatter plot config
|
||||
@@ -768,7 +769,8 @@ generate_interaction_plot_configs <- function(df, limits_map = NULL) {
|
||||
plot_type = "scatter",
|
||||
title = sprintf("%s %s", df_filtered$OrfRep[1], df_filtered$Gene[1]),
|
||||
error_bar = TRUE,
|
||||
position = "jitter"
|
||||
position = "jitter",
|
||||
size = 1
|
||||
))
|
||||
|
||||
# Box plot config
|
||||
@@ -937,7 +939,7 @@ generate_rank_plot_configs <- function(df, variables, is_lm = FALSE, adjust = FA
|
||||
)
|
||||
),
|
||||
shape = 3,
|
||||
size = 0.1,
|
||||
size = 0.25,
|
||||
smooth = TRUE,
|
||||
smooth_color = "black",
|
||||
lm_line = list(intercept = intercept, slope = slope),
|
||||
|
||||
Reference in New Issue
Block a user