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")
|
source("scatter_plot.R")
|
||||||
|
|
||||||
server <- function(input, output) {
|
server <- function(input, output) {
|
||||||
#' This expression applies all user defined filters to the available
|
#' This reactive expression applies all user defined filters as well as the
|
||||||
#' results.
|
#' desired ranking weights to the results.
|
||||||
results <- reactive({
|
results <- reactive({
|
||||||
|
# Select the species preset.
|
||||||
|
|
||||||
results <- if (input$species == "all") {
|
results <- if (input$species == "all") {
|
||||||
results_all
|
results_all
|
||||||
} else {
|
} else {
|
||||||
results_replicative
|
results_replicative
|
||||||
}
|
}
|
||||||
|
|
||||||
results[
|
# Apply user defined filters.
|
||||||
|
|
||||||
|
results <- results[
|
||||||
cluster_length >= input$length &
|
cluster_length >= input$length &
|
||||||
cluster_mean >= input$range[1] * 1000000 &
|
cluster_mean >= input$range[1] * 1000000 &
|
||||||
cluster_mean <= input$range[2] * 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({
|
output$genes <- renderDT({
|
||||||
|
|
|
||||||
26
ui.R
26
ui.R
|
|
@ -27,8 +27,30 @@ ui <- fluidPage(
|
||||||
"length",
|
"length",
|
||||||
"Minimum cluster size",
|
"Minimum cluster size",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 30,
|
max = 50,
|
||||||
value = 10
|
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(
|
wellPanel(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue