diff --git a/R/comparison_editor.R b/R/comparison_editor.R index 8f12d95..b576847 100644 --- a/R/comparison_editor.R +++ b/R/comparison_editor.R @@ -9,15 +9,14 @@ comparison_editor_ui <- function(id, options) { NS(id, "comparison_genes"), "Comparison genes", choices = c( - "None", + "Your genes", "Random genes", - names(options$gene_sets), - "Customize" + names(options$gene_sets) ) ), conditionalPanel( condition = sprintf( - "input['%s'] == 'Customize'", + "input['%s'] == 'Your genes'", NS(id, "comparison_genes") ), gene_selector_ui(NS(id, "custom_genes")) @@ -39,15 +38,13 @@ comparison_editor_server <- function(id, preset, options) { custom_gene_ids <- gene_selector_server("custom_genes") reactive({ - if (input$comparison_genes == "None") { - NULL - } else if (input$comparison_genes == "Random genes") { + if (input$comparison_genes == "Random genes") { preset <- preset() gene_pool <- preset$gene_ids reference_gene_ids <- preset$reference_gene_ids gene_pool <- gene_pool[!gene_pool %chin% reference_gene_ids] gene_pool[sample(length(gene_pool), length(reference_gene_ids))] - } else if (input$comparison_genes == "Customize") { + } else if (input$comparison_genes == "Your genes") { custom_gene_ids() } else { options$gene_sets[[input$comparison_genes]] diff --git a/R/gene_selector.R b/R/gene_selector.R index def6078..b9ffe94 100644 --- a/R/gene_selector.R +++ b/R/gene_selector.R @@ -29,7 +29,7 @@ gene_selector_ui <- function(id, default_gene_ids = NULL) { "list", shinyWidgets::virtualSelectInput( NS(id, "selected_genes"), - label = "Select genes", + label = NULL, choices = gene_choices, multiple = TRUE, search = TRUE, @@ -40,7 +40,7 @@ gene_selector_ui <- function(id, default_gene_ids = NULL) { "hgnc", textAreaInput( NS(id, "hgnc_names_raw"), - "Enter HGNC symbols", + label = NULL, value = paste( geposan::genes[ id %chin% default_gene_ids & name != "", @@ -55,7 +55,7 @@ gene_selector_ui <- function(id, default_gene_ids = NULL) { "ensembl", textAreaInput( NS(id, "gene_ids_raw"), - "Enter Ensembl gene IDs", + label = NULL, value = paste(default_gene_ids, collapse = "\n"), height = "250px" ) diff --git a/R/style.R b/R/style.R new file mode 100644 index 0000000..5eabdeb --- /dev/null +++ b/R/style.R @@ -0,0 +1,14 @@ +#' Custom CSS to tweak the rendering. +#' @noRd +custom_css <- function() { + tags$head( + tags$style(HTML( + ".nav-hidden { height: 0 }", + ".flow-layout > div {", + "display: inline-block;", + "vertical-align: top;", + "margin-right: 12px;", + "}" + )) + ) +} diff --git a/R/ui.R b/R/ui.R index 49e903e..becbe67 100644 --- a/R/ui.R +++ b/R/ui.R @@ -5,6 +5,7 @@ #' @noRd ui <- function(options) { div( + custom_css(), shinyjs::useShinyjs(), rclipboard::rclipboardSetup(), navbarPage(