diff --git a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R index 96c638e8..b1d0ff85 100644 --- a/qhtcp-workflow/apps/r/calculate_interaction_zscores.R +++ b/qhtcp-workflow/apps/r/calculate_interaction_zscores.R @@ -7,6 +7,7 @@ suppressMessages({ library("rlang") library("ggthemes") library("data.table") + library("grid") library("gridExtra") library("future") library("furrr") @@ -662,11 +663,11 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width } # Convert ggplot to plotly for interactive version - # plotly_plot <- suppressWarnings(plotly::ggplotly(plot)) + plotly_plot <- suppressWarnings(plotly::ggplotly(plot)) # Store both static and interactive versions static_plots[[i]] <- plot - # plotly_plots[[i]] <- plotly_plot + plotly_plots[[i]] <- plotly_plot } # Print the plots in the current group to the PDF @@ -682,6 +683,7 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, page_width ncol = grid_layout$ncol, nrow = grid_layout$nrow ) + grid.newpage() } } @@ -1039,7 +1041,7 @@ generate_interaction_plot_configs <- function(df, type) { return(list( list(grid_layout = list(ncol = 2), plots = stats_plot_configs), list(grid_layout = list(ncol = 2), plots = stats_boxplot_configs), - list(grid_layout = list(ncol = 4), plots = delta_plot_configs[1:12]) # nrow calculated dynamically + list(grid_layout = list(ncol = 4), plots = delta_plot_configs[1:24]) # nrow calculated dynamically )) } @@ -1429,10 +1431,10 @@ main <- function() { ) # Parallelize background and quality control plot generation - furrr::future_map(plot_configs, function(config) { - generate_and_save_plots(config$out_dir, config$filename, config$plot_configs, - page_width = config$page_width, page_height = config$page_height) - }, .options = furrr_options(seed = TRUE)) + # furrr::future_map(plot_configs, function(config) { + # generate_and_save_plots(config$out_dir, config$filename, config$plot_configs, + # page_width = config$page_width, page_height = config$page_height) + # }, .options = furrr_options(seed = TRUE)) # Loop over background strains # TODO currently only tested against one strain, if we want to do multiple strains we'll @@ -1492,7 +1494,7 @@ main <- function() { message("Generating reference interaction plots") reference_plot_configs <- generate_interaction_plot_configs(df_interactions_reference_joined, "reference") - generate_and_save_plots(out_dir, "interaction_plots_reference", reference_plot_configs, page_width = 16, page_height = 16) + generate_and_save_plots(out_dir, "interaction_plots_reference", reference_plot_configs, page_width = 18, page_height = 16) message("Setting missing deletion values to the highest theoretical value at each drug conc for L") df_deletion <- df_na_stats %>% # formerly X2