Add more context help

This commit is contained in:
Elias Projahn 2024-02-18 14:29:23 +01:00
parent a2f3ea4448
commit d23646e0a9
4 changed files with 84 additions and 15 deletions

View file

@ -5,9 +5,21 @@
comparison_editor_ui <- function(id, options) {
verticalLayout(
h5("Comparison"),
popover(
title = "Comparison genes",
help = paste0(
"Select your genes of interest to compare their scores with the ",
"reference genes. This will not influence the computation of scores, ",
"but it will update the visualizations and summary statistics. Select ",
"\"Your genes\" and use the other controls below for selecting or ",
"pasting the genes. You can also use predefined gene sets for ",
"comparison."
),
div(class = "label", "Comparison genes")
),
selectInput(
NS(id, "comparison_genes"),
"Comparison genes",
label = NULL,
choices = c(
"Your genes",
"Random genes",

View file

@ -2,17 +2,38 @@
methods_ui <- function(id, options) {
verticalLayout(
h5("Methods"),
popover(
title = "Optimization target",
help = paste0(
"These genes will be used as the target for optimization. This means ",
"that the method weights will be automatically adjusted to maximize ",
"the scores of this gene set. Select \"Reference genes\", if you want ",
"to compare your genes of interest with the reference gene set."
),
div(class = "label", "Genes to optimize for")
),
selectInput(
NS(id, "optimization_genes"),
"Genes to optimize for",
label = NULL,
choices = list(
"Reference genes" = "reference",
"Comparison genes" = "comparison"
)
),
popover(
title = "Optimization target",
help = paste0(
"This determines how the genes, that were selected for optimization, ",
"are combined. For example, \"Mean rank\" optimizes the method ",
"weights based on the highest possible mean score across all selected ",
"genes and \"First rank\" would always focus on the best performing ",
"gene."
),
div(class = "label", "Optimization target")
),
selectInput(
NS(id, "optimization_target"),
"Optimization target",
label = NULL,
choices = list(
"Mean rank" = "mean",
"Median rank" = "median",
@ -23,8 +44,9 @@ methods_ui <- function(id, options) {
),
lapply(options$methods, function(method) {
verticalLayout(
div(
style = "display: flex;",
popover(
title = method$name,
help = method$help,
checkboxInput(
NS(id, method$id),
span(
@ -32,14 +54,6 @@ methods_ui <- function(id, options) {
class = "control-label"
),
value = TRUE
),
div(
style = "margin-left: 5px;",
bslib::popover(
bsicons::bs_icon("question-circle"),
title = method$name,
method$help
)
)
),
sliderInput(

View file

@ -17,9 +17,20 @@ preset_editor_ui <- function(id, options) {
verticalLayout(
h5("Inputs"),
popover(
title = "Species to include",
help = paste0(
"This can be used to limit the input dataset to a predefined set of ",
"species. Normally, it is reasonable to use all species. So, do not ",
"change this unless you have specific reasons to do so. The ",
"algorithms will automatically optimize the input dataset by ",
"excluding species that do not share enough genes."
),
div(class = "label", "Species to include")
),
selectInput(
NS(id, "species"),
"Species to include",
label = NULL,
choices = species_choices
),
if (!options$locked) {
@ -36,9 +47,18 @@ preset_editor_ui <- function(id, options) {
),
)
},
popover(
title = "Reference genes",
help = paste0(
"The reference genes are the main input to the computation. They are ",
"used for computing some of the scores and for optimizing the weights ",
"of the different methods."
),
div(class = "label", "Reference genes")
),
selectInput(
NS(id, "reference_genes"),
"Reference genes",
label = NULL,
choices = gene_choices
),
if (!options$locked) {

View file

@ -3,3 +3,26 @@
#' @import data.table
#' @import shiny
NULL
#' Add a help popover to a control.
#'
#' @param title Title of the help popover.
#' @param help Content of the help popover.
#' @param child The control to add the popover to.
#'
#' @noRd
popover <- function(title, help, child) {
div(
style = "display: flex;",
child,
div(
style = "margin-left: 5px;",
bslib::popover(
bsicons::bs_icon("question-circle"),
title = title,
help,
options = list(offset = c(0, 10))
)
)
)
}