mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-25 20:07:23 +02:00
Add rankings correlation plot
This commit is contained in:
parent
c78802425c
commit
4e31d4ef79
2 changed files with 101 additions and 1 deletions
48
R/server.R
48
R/server.R
|
|
@ -116,6 +116,54 @@ server <- function(options) {
|
|||
geposan::plot_rankings(rankings, gene_sets)
|
||||
})
|
||||
|
||||
output$ranking_correlation_plot <- plotly::renderPlotly({
|
||||
preset <- preset()
|
||||
ranking <- ranking()
|
||||
|
||||
ranking_x <- if (input$ranking_x == "combined") {
|
||||
ranking
|
||||
} else {
|
||||
weights <- list()
|
||||
weights[[input$ranking_x]] <- 1.0
|
||||
geposan::ranking(ranking, weights)
|
||||
}
|
||||
|
||||
ranking_y <- if (input$ranking_y == "combined") {
|
||||
ranking
|
||||
} else {
|
||||
weights <- list()
|
||||
weights[[input$ranking_y]] <- 1.0
|
||||
geposan::ranking(ranking, weights)
|
||||
}
|
||||
|
||||
gene_sets <- list("Reference genes" = preset$reference_gene_ids)
|
||||
comparison_gene_ids <- comparison_gene_ids()
|
||||
|
||||
if (length(comparison_gene_ids) >= 1) {
|
||||
gene_sets <- c(
|
||||
gene_sets,
|
||||
list("Comparison genes" = comparison_gene_ids)
|
||||
)
|
||||
}
|
||||
|
||||
method_names <- geposan::all_methods() |> purrr::lmap(function(method) {
|
||||
l <- list()
|
||||
l[[method[[1]]$id]] <- method[[1]]$name
|
||||
l
|
||||
})
|
||||
|
||||
method_names[["combined"]] <- "Combined"
|
||||
|
||||
geposan::plot_rankings_correlation(
|
||||
ranking_x,
|
||||
ranking_y,
|
||||
method_names[[input$ranking_x]],
|
||||
method_names[[input$ranking_y]],
|
||||
gene_sets = gene_sets,
|
||||
use_ranks = input$use_ranks
|
||||
)
|
||||
})
|
||||
|
||||
output$comparison_text <- renderUI({
|
||||
reference <- geposan::compare(
|
||||
ranking(),
|
||||
|
|
|
|||
54
R/ui.R
54
R/ui.R
|
|
@ -4,6 +4,14 @@
|
|||
#'
|
||||
#' @noRd
|
||||
ui <- function(options) {
|
||||
ranking_choices <- purrr::lmap(geposan::all_methods(), function(method) {
|
||||
l <- list()
|
||||
l[[method[[1]]$name]] <- method[[1]]$id
|
||||
l
|
||||
})
|
||||
|
||||
ranking_choices <- c(ranking_choices, "Combined" = "combined")
|
||||
|
||||
div(
|
||||
custom_css(),
|
||||
shinyjs::useShinyjs(),
|
||||
|
|
@ -46,7 +54,7 @@ ui <- function(options) {
|
|||
)
|
||||
),
|
||||
tabPanel(
|
||||
title = "Methods & Distribution",
|
||||
title = "Method comparison",
|
||||
div(
|
||||
style = "margin-top: 16px",
|
||||
plotly::plotlyOutput(
|
||||
|
|
@ -56,6 +64,50 @@ ui <- function(options) {
|
|||
)
|
||||
)
|
||||
),
|
||||
tabPanel(
|
||||
title = "Method correlation",
|
||||
div(
|
||||
style = "margin-top: 16px",
|
||||
div(
|
||||
class = "flow-layout",
|
||||
selectInput(
|
||||
"ranking_y",
|
||||
label = NULL,
|
||||
choices = ranking_choices
|
||||
),
|
||||
span(
|
||||
style = paste0(
|
||||
"display: inline-block;",
|
||||
"margin-right: 12px;",
|
||||
"padding: 0.375rem 0.75rem;"
|
||||
),
|
||||
"~"
|
||||
),
|
||||
selectInput(
|
||||
"ranking_x",
|
||||
label = NULL,
|
||||
choices = ranking_choices,
|
||||
selected = "combined"
|
||||
),
|
||||
div(
|
||||
style = paste0(
|
||||
"display: inline-block;",
|
||||
"padding: 0.375rem 0.75rem;"
|
||||
),
|
||||
checkboxInput(
|
||||
"use_ranks",
|
||||
"Use ranks instead of scores",
|
||||
value = TRUE
|
||||
)
|
||||
)
|
||||
),
|
||||
plotly::plotlyOutput(
|
||||
"ranking_correlation_plot",
|
||||
width = "100%",
|
||||
height = "600px"
|
||||
)
|
||||
)
|
||||
),
|
||||
tabPanel(
|
||||
title = "Comparison",
|
||||
div(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue