From c42e13d09fe652e99337b71f24a606c3ab6ca536 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Wed, 25 Sep 2024 02:33:52 -0400 Subject: [PATCH] Simplify y-limits --- .../apps/r/calculate_interaction_zscores.R | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R index 7e919fe5..778c2634 100644 --- a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R +++ b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R @@ -664,18 +664,14 @@ generate_interaction_plot_configs <- function(df, variables) { configs <- list() - limits_map <- list( - L = c(-65, 65), - K = c(-65, 65), - r = c(-0.65, 0.65), - AUC = c(-6500, 6500) - ) - - # Filtering out NAs and outlying values + # Set the y-limits for each variable df_filtered <- df %>% - filter(across(names(limits_map), - ~ !is.na(.x) & - between(.x, limits_map[[.names]][1], limits_map[[.names]][2]))) + filter( + !is.na(L) & between(L, -65, 65), + !is.na(K) & between(K, -65, 65), + !is.na(r) & between(r, -0.65, 0.65), + !is.na(AUC) & between(AUC, -6500, 6500) + ) # Define annotation label functions generate_annotation_labels <- function(df, var, annotation_name) {