View source: R/geneSetSelect-module.R
geneSetSelect | R Documentation |
Take a look at the [reactiveGeneSetSelect()] module to select gene sets but also enable the user to first filter the genesets to choose from based on some global criteria.
geneSetSelect(
input,
output,
session,
src,
server = TRUE,
maxOptions = Inf,
sep = "_::_"
)
geneSetSelectUI(id, label = "Select Gene Set")
updateGeneSetSelect(
session,
id,
label = NULL,
choices = NULL,
selected = NULL,
options = list(),
server = FALSE
)
gs.render.select.ui(
ns,
choices,
server = TRUE,
maxOptions = 1000,
sep = "_::_"
)
gs.select.choices(mg, sep = "_::_")
input, output, session |
the shiny-required bits for the module |
src |
A [SparrowResultContainer()] object |
server |
logical indicating wether the options should be generated in the server module, default: 'TRUE' |
maxOptions |
a paremeter used to customize the 'GeneSetSelect::selectizeInput' UI element to configure the maximum number of elements to include in the select dropdown, the remainder of the genesets will be loaded from the server side. Default: 'Inf' for all. |
sep |
the string used to concatenate geneset 'collection' and 'name' to generate a uniqe string for a geneset |
id |
the 'naked' module id |
label |
the label for the [shiny::selectizeInput()] |
choices |
the output of 'gs.select.choices(SparrowResult)' |
selected |
The initially selected value (or multiple values if |
options |
A list of options. See the documentation of selectize.js
for possible options (character option values inside |
ns |
the namespace function for this module |
mg |
'SparrowResult' to build options for |
This code was inspired from the dynamicSelectShinyModule.R gist.
a reactive list of information about the selected geneset.
the collection its from
the name within the collection
a data.frame of "contrast statistics" for the features in the geneset
the shiny id for this module
the separator used to key the collection,name string for this geneset
a properly wired '[shiny::selectizeInput()]' UI element.
'data.table' to populate 'choices' of 'selectizeInput'
geneSetSelectUI
: the ui for the module
updateGeneSetSelect
: update geneSetSelect externally.
with new choices
gs.render.select.ui
: Internal function to build a 'selectizeInput'
widget that is specific to a SparrowResult.
gs.select.choices
: Internal function to build a 'data.frame'
used to populate geneset choices for a select input.
Note that when returning a data.frame for the choices from 'gs.select.choice()', we need a column called '"value"' and a column called '"label"'.
* 'value': the value that is sent back when an item is selected * 'label': athe text that appears in the selection after its triggered
Returns information about the 'geneSetSelect' object
sres <- sparrow::exampleSparrowResult()
app <- shiny::shinyApp(
ui = shiny::shinyUI(shiny::fluidPage(
exampleUISetup(),
title = "Gene Set Select",
geneSetSelectUI("mod"))),
server = function(input, output, session) {
src <- shiny::reactive(SparrowResultContainer(sres))
shiny::callModule(geneSetSelect, "mod", src)
})
if (interactive()) {
shiny::runApp(app)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.