mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-26 19:27:24 +01:00
preset_editor: Don't produce invalid presets
This commit is contained in:
parent
8a9ae63350
commit
aa4c655c53
1 changed files with 28 additions and 14 deletions
|
|
@ -86,6 +86,33 @@ preset_editor_server <- function(id) {
|
||||||
genes[suggested | verified == TRUE, id]
|
genes[suggested | verified == TRUE, id]
|
||||||
))
|
))
|
||||||
|
|
||||||
|
# Reactive containing the latest valid set of reference genes.
|
||||||
|
reference_gene_ids <- reactiveVal(
|
||||||
|
genes[verified | suggested == TRUE, id]
|
||||||
|
)
|
||||||
|
|
||||||
|
observeEvent(c(input$reference_genes, input$custom_reference_genes), {
|
||||||
|
if (input$reference_genes == "custom") {
|
||||||
|
inputs <- strsplit(input$custom_reference_genes, "\\s+")[[1]]
|
||||||
|
|
||||||
|
gene_ids <- if (input$identifier_type == "hgnc") {
|
||||||
|
geposan::genes[name %chin% inputs, id]
|
||||||
|
} else {
|
||||||
|
geposan::genes[id %chin% inputs, id]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length(gene_ids) >= 5) {
|
||||||
|
reference_gene_ids(gene_ids)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reference_gene_ids(if (input$reference_genes == "tpeold") {
|
||||||
|
genes[verified | suggested == TRUE, id]
|
||||||
|
} else if (input$reference_genes == "verified") {
|
||||||
|
genes[verified == TRUE, id]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
new_preset <- reactive({
|
new_preset <- reactive({
|
||||||
species_ids <- if (input$species == "replicative") {
|
species_ids <- if (input$species == "replicative") {
|
||||||
species_ids_replicative
|
species_ids_replicative
|
||||||
|
|
@ -95,21 +122,8 @@ preset_editor_server <- function(id) {
|
||||||
input$custom_species
|
input$custom_species
|
||||||
}
|
}
|
||||||
|
|
||||||
reference_gene_ids <- if (input$reference_genes == "tpeold") {
|
|
||||||
genes[verified | suggested == TRUE, id]
|
|
||||||
} else if (input$reference_genes == "verified") {
|
|
||||||
genes[verified == TRUE, id]
|
|
||||||
} else {
|
|
||||||
inputs <- strsplit(input$custom_reference_genes, "\\s+")[[1]]
|
|
||||||
if (input$identifier_type == "hgnc") {
|
|
||||||
geposan::genes[name %chin% inputs, id]
|
|
||||||
} else {
|
|
||||||
geposan::genes[id %chin% inputs, id]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
geposan::preset(
|
geposan::preset(
|
||||||
reference_gene_ids,
|
reference_gene_ids(),
|
||||||
methods = methods,
|
methods = methods,
|
||||||
species_ids = species_ids,
|
species_ids = species_ids,
|
||||||
gene_ids = genes$id
|
gene_ids = genes$id
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue