Use only one cross sample metric

This commit is contained in:
Elias Projahn 2022-05-30 20:22:42 +02:00
parent 20faaea93d
commit d495af011a
2 changed files with 18 additions and 42 deletions

View file

@ -2,18 +2,14 @@
#' @noRd #' @noRd
server <- function(input, output) { server <- function(input, output) {
ranked_data <- reactive({ ranked_data <- reactive({
total_weight <- abs(input$above_zero) + total_weight <- abs(input$cross_sample_weight) +
abs(input$above_median) +
abs(input$above_95) +
abs(input$mean_expression) + abs(input$mean_expression) +
abs(input$sd_expression) abs(input$sd_expression)
data <- data.table::copy(ubigen::genes) data <- data.table::copy(ubigen::genes)
data[, score := data[, score :=
(input$above_zero * above_zero + (input$cross_sample_weight * get(input$cross_sample_metric) +
input$above_95 * above_95 +
input$above_median * above_median +
input$mean_expression * mean_expression_normalized + input$mean_expression * mean_expression_normalized +
input$sd_expression * sd_expression_normalized) / input$sd_expression * sd_expression_normalized) /
total_weight] total_weight]

52
R/ui.R
View file

@ -14,49 +14,29 @@ ui <- function() {
sidebarPanel( sidebarPanel(
width = 3, width = 3,
h3("Features"), h3("Features"),
sliderInput( selectInput(
"above_zero", "cross_sample_metric",
verticalLayout( verticalLayout(
strong("Expressed"), strong("Expression across samples"),
paste0( paste0(
"Percentage of samples in which the gene is ", "Proportion samples in which the gene is expressed above the ",
"expressed." "selected threshold. Select a method and a weight for the ",
"final score."
) )
), ),
list(
"Above 95th percentile" = "above_95",
"Above median" = "above_median",
"Above zero" = "above_zero"
)
),
sliderInput(
"cross_sample_weight",
label = NULL,
min = -1.0, min = -1.0,
max = 1.0, max = 1.0,
step = 0.01, step = 0.01,
value = 0.33 value = 1.0
),
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( sliderInput(
"mean_expression", "mean_expression",