Add more optimization targets

This commit is contained in:
Elias Projahn 2021-10-21 11:43:34 +02:00
parent 2aed917478
commit 365cf13dcb
2 changed files with 22 additions and 8 deletions

View file

@ -4,11 +4,6 @@ methods_ui <- function(id) {
verticalLayout(
h3("Methods"),
actionButton(
NS(id, "optimize_button"),
"Find optimal weights",
icon = icon("check-double")
),
div(style = "margin-top: 16px"),
lapply(methods, function(method) {
verticalLayout(
@ -30,7 +25,21 @@ methods_ui <- function(id) {
value = initial_weight
)
)
})
}),
radioButtons(
NS(id, "target"),
"Optimization target",
choices = list(
"Mean rank of reference genes" = "mean",
"First rank of reference genes" = "min",
"Last rank of reference genes" = "max"
)
),
actionButton(
NS(id, "optimize_button"),
"Optimize weights",
class = "btn-primary"
)
)
}
@ -54,7 +63,8 @@ methods_server <- function(id, analysis) {
weights <- geposan::optimize_weights(
analysis(),
method_ids,
genes_tpe_old
genes_tpe_old,
target = input$target
)
for (method_id in method_ids) {

View file

@ -160,19 +160,23 @@ server <- function(input, output, session) {
digits = 1
))
min_rank <- as.character(reference_results[, min(rank)])
max_rank <- as.character(reference_results[, max(rank)])
} else {
mean_rank <- "Unknown"
min_rank <- "Unknown"
max_rank <- "Unknown"
}
sprintf(
"Included reference genes: %i/%i<br> \
Mean rank of reference genes: %s<br> \
Maximum rank of reference genes: %s",
First rank of reference genes: %s<br> \
Last rank of reference genes: %s",
included_reference_count,
total_reference_count,
mean_rank,
min_rank,
max_rank
)
})