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)),
|
max = ~ifelse(all(is.na(.)), NA, max(., na.rm = TRUE)),
|
||||||
min = ~ifelse(all(is.na(.)), NA, min(., na.rm = TRUE)),
|
min = ~ifelse(all(is.na(.)), NA, min(., na.rm = TRUE)),
|
||||||
sd = ~sd(., 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}"
|
.names = "{.fn}_{.col}"
|
||||||
),
|
),
|
||||||
@@ -581,13 +581,13 @@ generate_scatter_plot <- function(plot, config) {
|
|||||||
# Add Error Bars if specified
|
# Add Error Bars if specified
|
||||||
if (!is.null(config$error_bar) && config$error_bar && !is.null(config$y_var)) {
|
if (!is.null(config$error_bar) && config$error_bar && !is.null(config$y_var)) {
|
||||||
y_mean_col <- paste0("mean_", 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 +
|
plot <- plot +
|
||||||
geom_errorbar(
|
geom_errorbar(
|
||||||
aes(
|
aes(
|
||||||
ymin = !!sym(y_mean_col) - !!sym(y_sd_col),
|
ymin = !!sym(y_mean_col) - !!sym(y_se_col),
|
||||||
ymax = !!sym(y_mean_col) + !!sym(y_sd_col)
|
ymax = !!sym(y_mean_col) + !!sym(y_se_col)
|
||||||
),
|
),
|
||||||
alpha = 0.3
|
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"),
|
title = paste("Plate analysis by Drug Conc for", var, stage, "quality control"),
|
||||||
error_bar = error_bar,
|
error_bar = error_bar,
|
||||||
color_var = "conc_num",
|
color_var = "conc_num",
|
||||||
position = position
|
position = position,
|
||||||
|
size = 0.2
|
||||||
)
|
)
|
||||||
plots <- append(plots, list(config))
|
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_breaks = levels(df_filtered$conc_num_factor),
|
||||||
x_labels = levels(df_filtered$conc_num_factor),
|
x_labels = levels(df_filtered$conc_num_factor),
|
||||||
x_label = unique(df_filtered$Drug[1]),
|
x_label = unique(df_filtered$Drug[1]),
|
||||||
coord_cartesian = y_range
|
coord_cartesian = y_range,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Scatter plot config
|
# Scatter plot config
|
||||||
@@ -768,7 +769,8 @@ generate_interaction_plot_configs <- function(df, limits_map = NULL) {
|
|||||||
plot_type = "scatter",
|
plot_type = "scatter",
|
||||||
title = sprintf("%s %s", df_filtered$OrfRep[1], df_filtered$Gene[1]),
|
title = sprintf("%s %s", df_filtered$OrfRep[1], df_filtered$Gene[1]),
|
||||||
error_bar = TRUE,
|
error_bar = TRUE,
|
||||||
position = "jitter"
|
position = "jitter",
|
||||||
|
size = 1
|
||||||
))
|
))
|
||||||
|
|
||||||
# Box plot config
|
# Box plot config
|
||||||
@@ -937,7 +939,7 @@ generate_rank_plot_configs <- function(df, variables, is_lm = FALSE, adjust = FA
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
shape = 3,
|
shape = 3,
|
||||||
size = 0.1,
|
size = 0.25,
|
||||||
smooth = TRUE,
|
smooth = TRUE,
|
||||||
smooth_color = "black",
|
smooth_color = "black",
|
||||||
lm_line = list(intercept = intercept, slope = slope),
|
lm_line = list(intercept = intercept, slope = slope),
|
||||||
|
|||||||
@@ -1438,6 +1438,10 @@ wrapper calculate_interaction_zscores
|
|||||||
# * Add gene names, other threshold values, etc.
|
# * Add gene names, other threshold values, etc.
|
||||||
# * Dataframe columns and output file columns should be standardized in calculate_interactions()
|
# * Dataframe columns and output file columns should be standardized in calculate_interactions()
|
||||||
# * Need to decide if conc_num_factor is numeric or factor
|
# * Need to decide if conc_num_factor is numeric or factor
|
||||||
|
# * Do pdfs really need to be all different sizes?
|
||||||
|
# * We are using standard error bars using the same se values as the data now (includes Bessel's correction)
|
||||||
|
# * Plate analysis error bars and some others will be slightly different
|
||||||
|
# * Can be changed back but better to have plots reflect data, no?
|
||||||
#
|
#
|
||||||
# INPUT
|
# INPUT
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user