Skip to content

Commit

Permalink
Update maaslin3.R
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNickols authored Dec 2, 2024
1 parent a9fdd36 commit 4141c85
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions R/maaslin3.R
Original file line number Diff line number Diff line change
Expand Up @@ -2364,7 +2364,7 @@ maaslin_plot_results <- function(output,
heatmap_vars <- trimws(unlist(strsplit(heatmap_vars, ',')))
}

sum_plot <- maaslin3_summary_plot(
summary_plot <- maaslin3_summary_plot(
merged_results,
summary_plot_file,
figures_folder,
Expand All @@ -2376,8 +2376,9 @@ maaslin_plot_results <- function(output,
median_comparison_prevalence = median_comparison_prevalence,
balanced = balanced
)
ret_plots[["summary_plot"]] <- summary_plot
}
ret_plots[["Summary_plot"]] <- sum_plot

# Individual association plots
if (plot_associations) {
logging::loginfo(
Expand Down Expand Up @@ -2411,7 +2412,7 @@ maaslin_plot_results <- function(output,
invokeRestart("muffleWarning")
})
})
ret_plots[["Assocations"]] <- plots_out
ret_plots[["assocation_plots"]] <- plots_out
}
return(ret_plots)
}
Expand All @@ -2438,6 +2439,7 @@ maaslin_plot_results_from_output <- 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)) {
Expand Down Expand Up @@ -2481,7 +2483,7 @@ maaslin_plot_results_from_output <- function(output,
heatmap_vars <- trimws(unlist(strsplit(heatmap_vars, ',')))
}

maaslin3_summary_plot(
summary_plot <- maaslin3_summary_plot(
merged_results,
summary_plot_file,
figures_folder,
Expand All @@ -2493,6 +2495,7 @@ maaslin_plot_results_from_output <- function(output,
median_comparison_prevalence = median_comparison_prevalence,
balanced = balanced
)
ret_plots[["summary_plot"]] <- summary_plot
}

# Individual associations
Expand Down Expand Up @@ -2568,17 +2571,14 @@ maaslin_plot_results_from_output <- function(output,
invokeRestart("muffleWarning")
})
})


} else {
plots_out <- NULL
ret_plots[["assocation_plots"]] <- plots_out
}

if ('logging::writeToFile' %in% names(logging::getLogger()[['handlers']])) {
logging::removeHandler('logging::writeToFile')
}

return(plots_out)
return(ret_plots)
}

##########################################################
Expand Down

0 comments on commit 4141c85

Please sign in to comment.