geposanui/R/ui.R

208 lines
5.8 KiB
R
Raw Normal View History

2022-05-17 21:58:40 +02:00
#' Generate the main UI for the application.
#'
#' @param options Global options for the application.
#'
2022-05-17 21:58:40 +02:00
#' @noRd
ui <- function(options) {
2022-08-14 18:04:40 +02:00
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")
2022-05-26 12:44:09 +02:00
div(
custom_css(),
2022-05-26 12:44:09 +02:00
shinyjs::useShinyjs(),
rclipboard::rclipboardSetup(),
navbarPage(
id = "main_page",
theme = bslib::bs_theme(
version = 5,
bootswatch = "united",
primary = "#1964bf"
),
title = options$title,
selected = "Results",
tabPanel(
"Input data",
input_page_ui("input_page", options)
),
tabPanel(
"Results",
sidebarLayout(
sidebarPanel(
width = 3,
2022-06-22 13:48:37 +02:00
comparison_editor_ui("comparison_editor", options),
2022-05-26 12:44:09 +02:00
methods_ui("methods"),
filters_ui("filters")
),
mainPanel(
width = 9,
tabsetPanel(
type = "pills",
tabPanel(
title = "Overview",
div(
style = "margin-top: 16px",
plotly::plotlyOutput(
"rank_plot",
width = "100%",
height = "600px"
)
)
),
tabPanel(
2022-08-14 18:04:40 +02:00
title = "Method comparison",
2022-05-26 12:44:09 +02:00
div(
style = "margin-top: 16px",
plotly::plotlyOutput(
"rankings_plot",
width = "100%",
height = "600px"
)
)
),
2022-08-14 18:04:40 +02:00
tabPanel(
title = "Method correlation",
div(
class = "flow-layout",
2022-08-14 18:04:40 +02:00
style = "margin-top: 16px",
selectInput(
"ranking_y",
label = NULL,
choices = ranking_choices
),
span(
style = paste0(
"display: inline-block;",
"margin-right: 12px;",
"padding: 0.375rem 0.75rem;"
2022-08-14 18:04:40 +02:00
),
"~"
),
selectInput(
"ranking_x",
label = NULL,
choices = ranking_choices,
selected = "combined"
),
div(
style = paste0(
"display: inline-block;",
"padding: 0.375rem 0.75rem;"
2022-08-14 18:04:40 +02:00
),
checkboxInput(
"use_ranks",
"Use ranks instead of scores",
value = TRUE
2022-08-14 18:04:40 +02:00
)
),
div(
style = paste0(
"display: inline-block;",
"padding: 0.375rem 0.75rem;"
),
checkboxInput(
"use_sample",
"Take random sample of genes",
value = TRUE
)
2022-08-14 18:04:40 +02:00
)
),
plotly::plotlyOutput(
"ranking_correlation_plot",
width = "100%",
height = "600px"
2022-08-14 18:04:40 +02:00
)
),
2022-05-26 12:44:09 +02:00
tabPanel(
title = "Comparison",
div(
style = "margin-top: 16px",
htmlOutput("comparison_text"),
plotly::plotlyOutput(
"boxplot",
width = "100%",
height = "600px"
)
)
),
2022-08-04 11:54:52 +02:00
tabPanel(
title = "Ortholog locations",
div(
style = "margin-top: 16px",
plotly::plotlyOutput(
"gene_locations_plot",
width = "100%",
height = "1200px"
)
)
),
2022-05-26 12:44:09 +02:00
tabPanel(
title = "Scores by position",
div(
class = "flow-layout",
2022-05-26 12:44:09 +02:00
style = "margin-top: 16px",
selectInput(
"positions_plot_chromosome_name",
label = NULL,
choices = c(
list("All chromosomes" = "all"),
chromosome_choices()
2021-12-08 14:11:39 +01:00
)
2022-05-26 12:44:09 +02:00
),
plotly::plotlyOutput(
"positions_plot",
width = "100%",
height = "600px"
)
)
),
tabPanel(
title = "Detailed results",
results_ui("results")
),
tabPanel(
title = "g:Profiler",
div(
style = "margin-top: 16px",
plotly::plotlyOutput("gost_plot"),
),
div(
style = "margin-top: 16px",
DT::DTOutput("gost_details")
2021-12-08 13:46:59 +01:00
)
2022-05-26 12:44:09 +02:00
)
2021-12-08 13:46:59 +01:00
)
2022-05-26 12:44:09 +02:00
)
2021-06-24 22:38:16 +02:00
)
2022-05-26 12:44:09 +02:00
),
tabPanel(
title = "Publication"
)
2021-06-24 22:38:16 +02:00
)
2022-05-26 12:44:09 +02:00
)
2022-05-17 21:58:40 +02:00
}
#' Generate a named list for choosing chromosomes.
#' @noRd
chromosome_choices <- function() {
2022-05-26 12:44:09 +02:00
choices <- purrr::lmap(
unique(geposan::genes$chromosome),
function(name) {
choice <- list(name)
2022-05-17 21:58:40 +02:00
2022-05-26 12:44:09 +02:00
names(choice) <- paste0(
"Chromosome ",
name
)
2022-05-17 21:58:40 +02:00
2022-05-26 12:44:09 +02:00
choice
}
)
2022-05-17 21:58:40 +02:00
2022-05-26 12:44:09 +02:00
choices[order(suppressWarnings(sapply(choices, as.integer)))]
2022-05-17 21:58:40 +02:00
}