From 6fb91e0effdc0eaca554825cf458e0707f9cfa78 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Thu, 2 Jun 2022 09:14:34 +0200 Subject: [PATCH] Structure results using tabs --- R/server.R | 6 +++--- R/ui.R | 43 ++++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/R/server.R b/R/server.R index 90f9be1..2bddabf 100644 --- a/R/server.R +++ b/R/server.R @@ -30,9 +30,9 @@ server <- function(input, output, session) { observeEvent(custom_genes(), { # nolint if (length(custom_genes()) > 0) { - updateTabsetPanel(session, "custom_genes_panel", selected = "show") - } else { - updateTabsetPanel(session, "custom_genes_panel", selected = "hide") + updateTabsetPanel(session, "results_panel", selected = "custom_genes") + } else if (input$results_panel == "custom_genes") { + updateTabsetPanel(session, "results_panel", selected = "top_genes") } }, ignoreNULL = FALSE diff --git a/R/ui.R b/R/ui.R index f0d1147..9537f80 100644 --- a/R/ui.R +++ b/R/ui.R @@ -55,32 +55,33 @@ ui <- function() { ), mainPanel( width = 9, - h3("Overview"), plotly::plotlyOutput("overview_plot", height = "200px"), tabsetPanel( - id = "custom_genes_panel", - type = "hidden", - tabPanelBody("hide"), - tabPanelBody( - "show", - h3("Your genes"), + id = "results_panel", + selected = "top_genes", + header = div(class = "p-2"), + tabPanel( + "Your genes", + value = "custom_genes", htmlOutput("custom_genes_synopsis"), plotly::plotlyOutput("custom_genes_boxplot") + ), + tabPanel( + "Top genes", + value = "top_genes", + div(paste0( + "Hover over the markers to see details on each gene. Click or ", + "drag within the figure to select genes of interest." + )), + plotly::plotlyOutput("scores_plot"), + div(paste0( + "Click on gene names to view them using the Ensembl genome ", + "browser." + )), + div(class = "p-1"), + DT::dataTableOutput("selected_genes") ) - ), - h3("Focus on top genes"), - div(paste0( - "Click or drag within the figure to select genes of ", - "interest." - )), - plotly::plotlyOutput("scores_plot"), - h3("Detailed ranking"), - div(paste0( - "Click on gene names to view them using the Ensembl ", - "genome browser." - )), - div(class = "p-1"), - DT::dataTableOutput("selected_genes") + ) ) ) ),