From 0b623cd19038923a192813272ffef4345af666c2 Mon Sep 17 00:00:00 2001 From: lcolladotor Date: Fri, 13 Dec 2024 16:53:02 -0500 Subject: [PATCH] Tweak app_server() to support new features from gene_set_enrichment_plot() implemented by @lahuuki on #93. --- R/app_server.R | 13 +++++++++++-- R/gene_set_enrichment_plot.R | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/R/app_server.R b/R/app_server.R index 425e7e0b..880385c1 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -1443,7 +1443,15 @@ app_server <- function(input, output, session) { }) static_layer_gene_set_enrichment_plot <- reactive({ - gene_set_enrichment_plot(static_layer_gene_set_enrichment()) + enriched <- static_layer_gene_set_enrichment() + gene_set_enrichment_plot( + enriched, + plot_SetSize_bar = TRUE, + model_colors = get_colors( + spatialLIBD::libd_layer_colors, + clusters = unique(enriched$test) + ) + ) }) @@ -1632,7 +1640,8 @@ app_server <- function(input, output, session) { height = 8, width = 8 ) - gene_set_enrichment_plot(static_layer_gene_set_enrichment()) + p <- static_layer_gene_set_enrichment_plot() + print(p) dev.off() } ) diff --git a/R/gene_set_enrichment_plot.R b/R/gene_set_enrichment_plot.R index 2882ba10..fb0baccb 100644 --- a/R/gene_set_enrichment_plot.R +++ b/R/gene_set_enrichment_plot.R @@ -24,13 +24,13 @@ #' @param plot_SetSize_bar A `logical(1)` indicating whether to plot SetSize #' from `enrichment` as an `anno_barplot` at the top of the heatmap. #' @param gene_list_length Optional named `numeric` vector indicating the length -#' of the `gene_list` used to calculate `enrichment`, if inclided and +#' of the `gene_list` used to calculate `enrichment`, if included and #' `plot_setSize_bar = TRUE` then the top `anno_barplot` will show the `SetSize` #' and the difference from the length of the input gene_list. #' #' @param model_sig_length Optional named `numeric` vector indicating the #' number of significant genes in `modeling_results` used to calculate #' `enrichment`. If included `anno_barplot` will be added to rows. -#' #' @param model_colors named `character` vector of colors, Adds colors to +#' #' @param model_colors named `character` vector of colors. It adds colors to #' row annotations. #' #' @param ... Additional parameters passed to #' [ComplexHeatmap::Heatmap()][ComplexHeatmap::Heatmap()].