mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-25 20:07:23 +02:00
Make custom genes default in comparison editor
This commit is contained in:
parent
e7cbb4ea33
commit
4378e87b2a
4 changed files with 23 additions and 11 deletions
|
|
@ -9,15 +9,14 @@ comparison_editor_ui <- function(id, options) {
|
|||
NS(id, "comparison_genes"),
|
||||
"Comparison genes",
|
||||
choices = c(
|
||||
"None",
|
||||
"Your genes",
|
||||
"Random genes",
|
||||
names(options$gene_sets),
|
||||
"Customize"
|
||||
names(options$gene_sets)
|
||||
)
|
||||
),
|
||||
conditionalPanel(
|
||||
condition = sprintf(
|
||||
"input['%s'] == 'Customize'",
|
||||
"input['%s'] == 'Your genes'",
|
||||
NS(id, "comparison_genes")
|
||||
),
|
||||
gene_selector_ui(NS(id, "custom_genes"))
|
||||
|
|
@ -39,15 +38,13 @@ comparison_editor_server <- function(id, preset, options) {
|
|||
custom_gene_ids <- gene_selector_server("custom_genes")
|
||||
|
||||
reactive({
|
||||
if (input$comparison_genes == "None") {
|
||||
NULL
|
||||
} else if (input$comparison_genes == "Random genes") {
|
||||
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 == "Customize") {
|
||||
} else if (input$comparison_genes == "Your genes") {
|
||||
custom_gene_ids()
|
||||
} else {
|
||||
options$gene_sets[[input$comparison_genes]]
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ gene_selector_ui <- function(id, default_gene_ids = NULL) {
|
|||
"list",
|
||||
shinyWidgets::virtualSelectInput(
|
||||
NS(id, "selected_genes"),
|
||||
label = "Select genes",
|
||||
label = NULL,
|
||||
choices = gene_choices,
|
||||
multiple = TRUE,
|
||||
search = TRUE,
|
||||
|
|
@ -40,7 +40,7 @@ gene_selector_ui <- function(id, default_gene_ids = NULL) {
|
|||
"hgnc",
|
||||
textAreaInput(
|
||||
NS(id, "hgnc_names_raw"),
|
||||
"Enter HGNC symbols",
|
||||
label = NULL,
|
||||
value = paste(
|
||||
geposan::genes[
|
||||
id %chin% default_gene_ids & name != "",
|
||||
|
|
@ -55,7 +55,7 @@ gene_selector_ui <- function(id, default_gene_ids = NULL) {
|
|||
"ensembl",
|
||||
textAreaInput(
|
||||
NS(id, "gene_ids_raw"),
|
||||
"Enter Ensembl gene IDs",
|
||||
label = NULL,
|
||||
value = paste(default_gene_ids, collapse = "\n"),
|
||||
height = "250px"
|
||||
)
|
||||
|
|
|
|||
14
R/style.R
Normal file
14
R/style.R
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#' Custom CSS to tweak the rendering.
|
||||
#' @noRd
|
||||
custom_css <- function() {
|
||||
tags$head(
|
||||
tags$style(HTML(
|
||||
".nav-hidden { height: 0 }",
|
||||
".flow-layout > div {",
|
||||
"display: inline-block;",
|
||||
"vertical-align: top;",
|
||||
"margin-right: 12px;",
|
||||
"}"
|
||||
))
|
||||
)
|
||||
}
|
||||
1
R/ui.R
1
R/ui.R
|
|
@ -5,6 +5,7 @@
|
|||
#' @noRd
|
||||
ui <- function(options) {
|
||||
div(
|
||||
custom_css(),
|
||||
shinyjs::useShinyjs(),
|
||||
rclipboard::rclipboardSetup(),
|
||||
navbarPage(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue