geneSetSelect.Rd
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 = "_::_")
the shiny-required bits for the module
A [SparrowResultContainer()] object
logical indicating wether the options should be generated in the server module, default: `TRUE`
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.
the string used to concatenate geneset `collection` and `name` to generate a uniqe string for a geneset
the 'naked' module id
the label for the [shiny::selectizeInput()]
the output of `gs.select.choices(SparrowResult)`
The initially selected value (or multiple values if multiple = TRUE
). If not specified then defaults to the first value for
single-select lists and no values for multiple select lists.
A list of options. See the documentation of selectize.js
for possible options (character option values inside base::I()
will
be treated as literal JavaScript code; see renderDataTable()
for details).
the namespace function for this module
`SparrowResult` to build options for
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`
This code was inspired from the dynamicSelectShinyModule.R gist.
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)
}