Usage
experimentSpecServer(
id,
datasets,
mae_name,
name_annotation = "symbol",
sample_vars_as_factors = TRUE,
with_mae_col_data = TRUE
)
Arguments
- id
(
string
) the shiny module id.- datasets
(
Datasets
)
teal specific argument which is automatically passed to the UI and server functions, holding all the data sets provided in the app initialization.- 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,
datasets,
mae_name) {
ns <- NS(id)
teal.widgets::standard_layout(
encoding = div(
experimentSpecInput(
ns("my_experiment"),
datasets,
mae_name,
label_experiments = "Please choose experiment"
),
selectInput(
ns("property"),
"Please choose property",
c("data", "name", "genes", "assays")
)
),
output = div(
verbatimTextOutput(ns("summary")),
verbatimTextOutput(ns("head"))
)
)
}
server <- function(id,
datasets,
mae_name) {
moduleServer(id, function(input, output, session) {
experiment <- experimentSpecServer(
"my_experiment",
datasets,
mae_name
)
result <- reactive({
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() {
mae <- hermes::multi_assay_experiment
mae_name <- "MAE"
mae_data <- dataset(mae_name, mae)
data <- teal_data(mae_data)
app <- init(
data = data,
modules = modules(
module(
label = "experimentSpec example",
server = server,
server_args = list(mae_name = mae_name),
ui = ui,
ui_args = list(mae_name = mae_name),
filters = "all"
)
)
)
shinyApp(app$ui, app$server)
}
if (interactive()) {
my_app()
}