Skip to content

Commit 6be37cc

Browse files
committed
[chore] Condition the heatmap output in the shiny app based on the status of the ComplexHeatmap package
1 parent 3af9b53 commit 6be37cc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

R/shiny-comparisons.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,12 @@ ui_comparison_jsi_panel <- function(id) {
367367

368368
ui_comparison_gene_heatmap <- function(id) {
369369
ns <- shiny::NS(id)
370+
plot_options <- c("Bubbleplot")
371+
if (is_package_installed("ComplexHeatmap")) {
372+
plot_options <- c("Heatmap", "Bubbleplot")
373+
} else {
374+
message("ComplexHeatmap is not installed. The Bubbleplot will be used instead.\nIf you want to generate heatmaps, please run the following command: `BiocManager::install('ComplexHeatmap')`")
375+
}
370376

371377
shiny::tagList(
372378
shiny::splitLayout(
@@ -500,8 +506,8 @@ ui_comparison_gene_heatmap <- function(id) {
500506
shinyWidgets::radioGroupButtons(
501507
inputId = ns("plot_type"),
502508
label = "Plot type",
503-
choices = c("Heatmap", "Bubbleplot"),
504-
selected = "Heatmap"
509+
choices = plot_options,
510+
selected = plot_options[1]
505511
)
506512
),
507513
shiny::plotOutput(ns("gene_heatmap"), height = "auto"),

0 commit comments

Comments
 (0)