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
server <- function(input, output) {
ranked_data <- reactive({
total_weight <- abs(input$above_zero) +
abs(input$above_median) +
abs(input$above_95) +
total_weight <- abs(input$cross_sample_weight) +
abs(input$mean_expression) +
abs(input$sd_expression)
data <- data.table::copy(ubigen::genes)
data[, score :=
(input$above_zero * above_zero +
input$above_95 * above_95 +
input$above_median * above_median +
(input$cross_sample_weight * get(input$cross_sample_metric) +
input$mean_expression * mean_expression_normalized +
input$sd_expression * sd_expression_normalized) /
total_weight]

52
R/ui.R
View file

@ -14,49 +14,29 @@ ui <- function() {
sidebarPanel(
width = 3,
h3("Features"),
sliderInput(
"above_zero",
selectInput(
"cross_sample_metric",
verticalLayout(
strong("Expressed"),
strong("Expression across samples"),
paste0(
"Percentage of samples in which the gene is ",
"expressed."
"Proportion samples in which the gene is expressed above the ",
"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,
max = 1.0,
step = 0.01,
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
value = 1.0
),
sliderInput(
"mean_expression",