Usage
experimentSpecServer(
id,
data,
filter_panel_api,
mae_name,
name_annotation = "symbol",
sample_vars_as_factors = TRUE,
with_mae_col_data = TRUE
)
Arguments
- id
(
string
) the shiny module id.- data
(
reactive
)reactive(<teal_data>)
holding all the data sets provided during app initialization after going through the filters.- filter_panel_api
(
FilterPanelAPI
)
object describing the actual filter panel API.- mae_name
(
string
)
name of the MAE data used in the teal module.- name_annotation
(
string
orNULL
)
which annotation column to use as name to return in thegenes
data. IfNULL
, then thename
column will be set to empty strings.- sample_vars_as_factors
(
flag
)
whether to convert the sample variables (columns incolData()
of the experiment) from character to factor variables.- with_mae_col_data
(
flag
)
whether to include thecolData()
of the MAE into the experimentcolData()
.
Value
List with the following reactive objects:
data
: thehermes::AnyHermesData
experiment.name
: the name of the experiment as selected by the user.genes
: adata.frame
with the genes indata
, with columnsid
andname
.assays
: the names of the assays indata
.
See also
experimentSpecInput()
for the module UI.
Examples
ui <- function(id,
mae_name) {
ns <- NS(id)
teal.widgets::standard_layout(
encoding = uiOutput(ns("encoding_ui")),
output = tags$div(
verbatimTextOutput(ns("summary")),
verbatimTextOutput(ns("head"))
)
)
}
server <- function(id,
data,
filter_panel_api,
mae_name) {
moduleServer(id, function(input, output, session) {
output$encoding_ui <- renderUI({
tags$div(
experimentSpecInput(
session$ns("my_experiment"),
data,
mae_name,
label_experiments = "Please choose experiment"
),
selectInput(
session$ns("property"),
"Please choose property",
c("data", "name", "genes", "assays")
)
)
})
experiment <- experimentSpecServer(
"my_experiment",
data,
filter_panel_api,
mae_name
)
result <- reactive({
req(input$property)
switch(input$property,
data = experiment$data(),
name = experiment$name(),
genes = experiment$genes(),
assays = experiment$assays()
)
})
output$summary <- renderPrint({
result <- result()
hermes::summary(result)
})
output$head <- renderPrint({
result <- result()
utils::head(result)
})
})
}
my_app <- function() {
data <- teal_data(MAE = hermes::multi_assay_experiment)
app <- init(
data = data,
modules = modules(
module(
label = "experimentSpec example",
server = server,
server_args = list(mae_name = "MAE"),
ui = ui,
ui_args = list(mae_name = "MAE"),
datanames = "all"
)
)
)
shinyApp(app$ui, app$server)
}
if (interactive()) {
my_app()
}