mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-26 11:17:24 +01:00
Add options to configure default gene sets
This commit is contained in:
parent
22f5e86625
commit
74d7865389
9 changed files with 391 additions and 370 deletions
|
|
@ -1,22 +1,23 @@
|
|||
# Create a comparison editor.
|
||||
comparison_editor_ui <- function(id) {
|
||||
#' Create a comparison editor.
|
||||
#'
|
||||
#' @param options Global application options
|
||||
#' @noRd
|
||||
comparison_editor_ui <- function(id, options) {
|
||||
verticalLayout(
|
||||
h3("Comparison"),
|
||||
selectInput(
|
||||
NS(id, "comparison_genes"),
|
||||
"Comparison genes",
|
||||
choices = list(
|
||||
"None" = "none",
|
||||
"Random genes" = "random",
|
||||
"Verified or suggested TPE-OLD genes" = "tpeold",
|
||||
"Only verified TPE-OLD genes" = "verified",
|
||||
"Only suggested TPE-OLD genes" = "suggested",
|
||||
"Customize" = "custom"
|
||||
choices = c(
|
||||
"None",
|
||||
"Random genes",
|
||||
names(options$gene_sets),
|
||||
"Customize"
|
||||
)
|
||||
),
|
||||
conditionalPanel(
|
||||
condition = sprintf(
|
||||
"input['%s'] == 'custom'",
|
||||
"input['%s'] == 'Customize'",
|
||||
NS(id, "comparison_genes")
|
||||
),
|
||||
gene_selector_ui(NS(id, "custom_genes"))
|
||||
|
|
@ -24,33 +25,32 @@ comparison_editor_ui <- function(id) {
|
|||
)
|
||||
}
|
||||
|
||||
# Create a server for the comparison editor.
|
||||
#
|
||||
# @param id ID for namespacing the inputs and outputs.
|
||||
# @param preset A reactive containing the current preset.
|
||||
#
|
||||
# @return A reactive containing the comparison gene IDs.
|
||||
comparison_editor_server <- function(id, preset) {
|
||||
#' Create a server for the comparison editor.
|
||||
#'
|
||||
#' @param id ID for namespacing the inputs and outputs.
|
||||
#' @param preset A reactive containing the current preset.
|
||||
#' @param options Global application options
|
||||
#'
|
||||
#' @return A reactive containing the comparison gene IDs.
|
||||
#'
|
||||
#' @noRd
|
||||
comparison_editor_server <- function(id, preset, options) {
|
||||
moduleServer(id, function(input, output, session) {
|
||||
custom_gene_ids <- gene_selector_server("custom_genes")
|
||||
|
||||
reactive({
|
||||
if (input$comparison_genes == "none") {
|
||||
if (input$comparison_genes == "None") {
|
||||
NULL
|
||||
} else if (input$comparison_genes == "random") {
|
||||
} else if (input$comparison_genes == "Random genes") {
|
||||
preset <- preset()
|
||||
gene_pool <- preset$gene_ids
|
||||
reference_gene_ids <- preset$reference_gene_ids
|
||||
gene_pool <- gene_pool[!gene_pool %chin% reference_gene_ids]
|
||||
gene_pool[sample(length(gene_pool), length(reference_gene_ids))]
|
||||
} else if (input$comparison_genes == "tpeold") {
|
||||
genes[verified | suggested == TRUE, id]
|
||||
} else if (input$comparison_genes == "verified") {
|
||||
genes[verified == TRUE, id]
|
||||
} else if (input$comparison_genes == "suggested") {
|
||||
genes[suggested == TRUE, id]
|
||||
} else {
|
||||
} else if (input$comparison_genes == "Customize") {
|
||||
custom_gene_ids()
|
||||
} else {
|
||||
options$gene_sets[[input$comparison_genes]]
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue