diff --git a/R/maaslin3.R b/R/maaslin3.R index 6b2bb23..9055783 100755 --- a/R/maaslin3.R +++ b/R/maaslin3.R @@ -2326,6 +2326,7 @@ maaslin_plot_results <- function(output, plot_associations = TRUE, max_pngs = 30, balanced = FALSE) { + ret_plots <- list() # create an output folder and figures folder if it does not exist if (!file.exists(output)) { logging::loginfo("Creating output folder") @@ -2363,7 +2364,7 @@ maaslin_plot_results <- function(output, heatmap_vars <- trimws(unlist(strsplit(heatmap_vars, ','))) } - maaslin3_summary_plot( + sum_plot <- maaslin3_summary_plot( merged_results, summary_plot_file, figures_folder, @@ -2376,7 +2377,7 @@ maaslin_plot_results <- function(output, balanced = balanced ) } - + ret_plots[["Summary_plot"]] <- sum_plot # Individual association plots if (plot_associations) { logging::loginfo( @@ -2410,9 +2411,9 @@ maaslin_plot_results <- function(output, invokeRestart("muffleWarning") }) }) - - return(plots_out) + ret_plots[["Assocations"]] <- plots_out } + return(ret_plots) } maaslin_plot_results_from_output <- function(output, diff --git a/R/viz.R b/R/viz.R index 10232a5..dce6af9 100644 --- a/R/viz.R +++ b/R/viz.R @@ -473,6 +473,7 @@ maaslin3_summary_plot <- median_comparison_abundance = FALSE, median_comparison_prevalence = FALSE, balanced=FALSE) { + ret_plots <- list() if (first_n > 200) { logging::logerror( paste( @@ -686,6 +687,9 @@ maaslin3_summary_plot <- } else { final_plot <- NULL } + ret_plots[["coefficient"]] <- p1 + ret_plots[["heat"]] <- p2 + ret_plots[["final"]] <- final_plot # Save plot if (!is.null(final_plot)) { @@ -731,6 +735,7 @@ maaslin3_summary_plot <- }) }) } + return(ret_plots) } # Create a scatterplot for abundance vs. continuous associations