From b4d758ff03f5be5bb8d26ad8751fe5b70d47da4a Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Thu, 12 May 2022 13:03:13 +0200 Subject: [PATCH] Include more features --- R/server.R | 8 ++++++-- R/ui.R | 60 ++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/R/server.R b/R/server.R index e5b152d..fa9a735 100644 --- a/R/server.R +++ b/R/server.R @@ -2,14 +2,18 @@ #' @noRd server <- function(input, output) { ranked_data <- reactive({ - total_weight <- abs(input$above_median) + + total_weight <- abs(input$above_zero) + + abs(input$above_median) + + abs(input$above_95) + abs(input$mean_expression) + abs(input$sd_expression) data <- data.table::copy(ubigen::genes) data[, score := - (input$above_median * above_median + + (input$above_zero * above_zero + + input$above_95 * above_95 + + input$above_median * above_median + input$mean_expression * mean_expression_normalized + input$sd_expression * sd_expression_normalized) / total_weight] diff --git a/R/ui.R b/R/ui.R index ab29e5c..f2852c5 100644 --- a/R/ui.R +++ b/R/ui.R @@ -13,18 +13,60 @@ ui <- function() { sidebarLayout( sidebarPanel( width = 3, - h3("Criteria"), + h3("Features"), sliderInput( - "above_median", - "Expressed above median", + "above_zero", + verticalLayout( + strong("Expressed"), + paste0( + "Percentage of samples in which the gene is ", + "expressed." + ) + ), min = -1.0, max = 1.0, step = 0.01, - value = 1.0 + value = 0.33 + ), + sliderInput( + "above_median", + verticalLayout( + strong("Expressed above median"), + paste0( + "Percentage of samples that express the gene ", + "more than the median of expression within ", + "that sample." + ) + ), + min = -1.0, + max = 1.0, + step = 0.01, + value = 0.33 + ), + sliderInput( + "above_95", + verticalLayout( + strong("Expressed above 95%"), + paste0( + "Percentage of samples that express the gene ", + "more than the 95. percentile of expression ", + "within that sample." + ) + ), + min = -1.0, + max = 1.0, + step = 0.01, + value = 0.33 ), sliderInput( "mean_expression", - "Mean expression", + verticalLayout( + strong("Mean expression"), + div(paste0( + "Average of the gene's expression across all ", + "samples." + )) + ), min = -1.0, max = 1.0, step = 0.01, @@ -32,7 +74,13 @@ ui <- function() { ), sliderInput( "sd_expression", - "Standard deviation", + verticalLayout( + strong("Standard deviation"), + paste0( + "Standard deviation of the gene's expression ", + "across all samples." + ) + ), min = -1.0, max = 1.0, step = 0.01,