From e7cbb4ea339f07aeba19c60a3266c932d9530b68 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Wed, 22 Jun 2022 13:48:37 +0200 Subject: [PATCH] Move comparison editor to results page --- R/input_page.R | 29 ++++------------------------- R/server.R | 10 +++++++--- R/ui.R | 1 + 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/R/input_page.R b/R/input_page.R index 20104b2..079fb25 100644 --- a/R/input_page.R +++ b/R/input_page.R @@ -21,8 +21,7 @@ input_page_ui <- function(id, options) { style = "margin-top: 16px; margin-bottom: 16px" ) ) - ), - comparison_editor_ui(NS(id, "comparison_editor"), options) + ) ), mainPanel( width = 9, @@ -40,8 +39,7 @@ input_page_ui <- function(id, options) { #' @param id ID for namespacing the inputs and outputs. #' @param options Global options for the application. #' -#' @return A list containing two reactives: the `preset` for the analysis and -#' the `comparison_gene_ids`. +#' @return A reactive containing the `preset` for the analysis. #' #' @noRd input_page_server <- function(id, options) { @@ -49,31 +47,15 @@ input_page_server <- function(id, options) { current_preset <- reactiveVal(geposan::preset(options$gene_sets[[1]])) potential_preset <- preset_editor_server("preset_editor", options) - comparison_gene_ids <- comparison_editor_server( - "comparison_editor", - current_preset, - options - ) - output$positions_plot <- plotly::renderPlotly({ preset <- potential_preset() if (is.null(preset)) { NULL } else { - gene_sets <- list("Reference genes" = preset$reference_gene_ids) - comparison_gene_ids <- comparison_gene_ids() - - if (length(comparison_gene_ids) >= 1) { - gene_sets <- c( - gene_sets, - list("Comparison genes" = comparison_gene_ids) - ) - } - geposan::plot_positions( preset$species_ids, - gene_sets, + list("Reference genes" = preset$reference_gene_ids), reference_gene_ids = preset$reference_gene_ids ) } @@ -101,9 +83,6 @@ input_page_server <- function(id, options) { current_preset(potential_preset()) }) |> bindEvent(input$apply_button) - list( - preset = current_preset, - comparison_gene_ids = comparison_gene_ids - ) + current_preset }) } diff --git a/R/server.R b/R/server.R index 0104767..bfe29e8 100644 --- a/R/server.R +++ b/R/server.R @@ -13,9 +13,13 @@ js_link <- DT::JS("function(row, data) { #' @noRd server <- function(options) { function(input, output, session) { - input_reactives <- input_page_server("input_page", options) - preset <- input_reactives$preset - comparison_gene_ids <- input_reactives$comparison_gene_ids + preset <- input_page_server("input_page", options) + + comparison_gene_ids <- comparison_editor_server( + "comparison_editor", + preset, + options + ) observe({ updateNavbarPage( diff --git a/R/ui.R b/R/ui.R index ae2f4e4..49e903e 100644 --- a/R/ui.R +++ b/R/ui.R @@ -25,6 +25,7 @@ ui <- function(options) { sidebarLayout( sidebarPanel( width = 3, + comparison_editor_ui("comparison_editor", options), methods_ui("methods"), filters_ui("filters") ),