Tento commit je obsažen v:
2024-09-18 04:27:49 -04:00
rodič eb3ed1470c
revize 977561b200

Zobrazit soubor

@@ -508,28 +508,26 @@ generate_scatter_plot <- function(plot, config) {
}
# Add SD Bands if specified
if (!is.null(config$sd_band_values)) {
for (sd_band in config$sd_band_values) {
plot <- plot +
annotate(
"rect",
xmin = -Inf, xmax = Inf,
ymin = sd_band, ymax = Inf,
fill = "#542788",
alpha = 0.3
) +
annotate(
"rect",
xmin = -Inf, xmax = Inf,
ymin = -sd_band, ymax = -Inf,
fill = "orange",
alpha = 0.3
) +
geom_hline(
yintercept = c(-sd_band, sd_band),
color = "gray"
)
}
if (!is.null(config$sd_band)) {
plot <- plot +
annotate(
"rect",
xmin = -Inf, xmax = Inf,
ymin = config$sd_band, ymax = Inf,
fill = "#542788",
alpha = 0.3
) +
annotate(
"rect",
xmin = -Inf, xmax = Inf,
ymin = -config$sd_band, ymax = -Inf,
fill = "orange",
alpha = 0.3
) +
geom_hline(
yintercept = c(-config$sd_band, config$sd_band),
color = "gray"
)
}
# Add Rectangles if specified
@@ -770,18 +768,19 @@ generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE) {
# SD-based plots for L and K
for (variable in c("L", "K")) {
if (is_lm) {
rank_var <- paste0("Rank_lm_", variable)
zscore_var <- paste0("Z_lm_", variable)
y_label <- paste("Int Z score", variable)
} else {
rank_var <- paste0("Rank_", variable)
zscore_var <- paste0("Avg_Zscore_", variable)
y_label <- paste("Avg Z score", variable)
}
for (sd_band in sd_bands) {
# Determine columns based on whether it's lm or not
if (is_lm) {
rank_var <- paste0("Rank_lm_", variable)
zscore_var <- paste0("Z_lm_", variable)
y_label <- paste("Int Z score", variable)
} else {
rank_var <- paste0("Rank_", variable)
zscore_var <- paste0("Avg_Zscore_", variable)
y_label <- paste("Avg Z score", variable)
}
num_enhancers <- sum(df_filtered[[zscore_var]] >= sd_band, na.rm = TRUE)
num_suppressors <- sum(df_filtered[[zscore_var]] <= -sd_band, na.rm = TRUE)
@@ -805,7 +804,6 @@ generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE) {
label = paste("Deletion Suppressors =", num_suppressors)
)
),
sd_band_values = sd_band,
shape = 3,
size = 0.1,
y_label = y_label,
@@ -822,7 +820,6 @@ generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE) {
title = paste(y_label, "vs. Rank for", variable, "above", sd_band, "SD No Annotations"),
sd_band = sd_band,
annotations = NULL,
sd_band_values = sd_band,
shape = 3,
size = 0.1,
y_label = y_label,
@@ -873,7 +870,6 @@ generate_rank_plot_configs <- function(df_filtered, variables, is_lm = FALSE) {
label = paste("R-squared =", round(lm_summary$r.squared, 2))
)
),
sd_band_values = NULL, # Not applicable
shape = 3,
size = 0.1,
add_smooth = TRUE,
@@ -997,7 +993,6 @@ filter_data <- function(df, variables, nf = FALSE, missing = FALSE, adjust = FAL
return(df)
}
main <- function() {
lapply(names(args$experiments), function(exp_name) {
exp <- args$experiments[[exp_name]]