mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-26 11:17:24 +01:00
Add weighted ranking
This commit is contained in:
parent
9d6b2e4d50
commit
03be4bfe5d
2 changed files with 44 additions and 5 deletions
23
server.R
23
server.R
|
|
@ -6,20 +6,37 @@ source("init.R")
|
|||
source("scatter_plot.R")
|
||||
|
||||
server <- function(input, output) {
|
||||
#' This expression applies all user defined filters to the available
|
||||
#' results.
|
||||
#' This reactive expression applies all user defined filters as well as the
|
||||
#' desired ranking weights to the results.
|
||||
results <- reactive({
|
||||
# Select the species preset.
|
||||
|
||||
results <- if (input$species == "all") {
|
||||
results_all
|
||||
} else {
|
||||
results_replicative
|
||||
}
|
||||
|
||||
results[
|
||||
# Apply user defined filters.
|
||||
|
||||
results <- results[
|
||||
cluster_length >= input$length &
|
||||
cluster_mean >= input$range[1] * 1000000 &
|
||||
cluster_mean <= input$range[2] * 1000000
|
||||
]
|
||||
|
||||
# Compute scoring factors and the weighted score.
|
||||
|
||||
cluster_max <- results[, max(cluster_length)]
|
||||
results[, cluster_score := cluster_length / cluster_max]
|
||||
|
||||
results[, score := input$clustering / 100 * cluster_score +
|
||||
input$correlation / 100 * r_mean]
|
||||
|
||||
# Order the results based on their score. The resulting index will be
|
||||
# used as the "rank".
|
||||
|
||||
setorder(results, -score)
|
||||
})
|
||||
|
||||
output$genes <- renderDT({
|
||||
|
|
|
|||
26
ui.R
26
ui.R
|
|
@ -27,8 +27,30 @@ ui <- fluidPage(
|
|||
"length",
|
||||
"Minimum cluster size",
|
||||
min = 0,
|
||||
max = 30,
|
||||
value = 10
|
||||
max = 50,
|
||||
value = c(0, 15),
|
||||
step = 0.1
|
||||
)
|
||||
),
|
||||
wellPanel(
|
||||
h3("Ranking"),
|
||||
sliderInput(
|
||||
"clustering",
|
||||
"Size of largest cluster",
|
||||
post = "%",
|
||||
min = 0,
|
||||
max = 100,
|
||||
step = 1,
|
||||
value = 100
|
||||
),
|
||||
sliderInput(
|
||||
"correlation",
|
||||
"Correlation with known genes",
|
||||
post = "%",
|
||||
min = 0,
|
||||
max = 100,
|
||||
step = 1,
|
||||
value = 100
|
||||
)
|
||||
),
|
||||
wellPanel(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue