View source: R/createLandingPage.R
createLandingPage | R Documentation |
Define a function to create a landing page in which users can specify or upload SummarizedExperiment objects.
createLandingPage(
seUI = NULL,
seLoad = NULL,
initUI = NULL,
initLoad = NULL,
requireButton = TRUE
)
seUI |
Function that accepts a single |
seLoad |
Function that accepts the input value of the UI element from |
initUI |
Function that accepts a single |
initLoad |
Function that accepts the input value of the UI element from |
requireButton |
Logical scalar indicating whether the app should require an explicit button press to initialize,
or if it should initialize upon any modification to the UI element in |
By default, this function creates a landing page in which users can upload an RDS file containing a SummarizedExperiment,
which is subsequently read by readRDS
to launch an instance of iSEE
.
However, any source of SummarizedExperiment objects can be used;
for example, we can retrieve them from databases by modifying seUI
and seLoad
appropriately.
The default landing page also allows users to upload a RDS file containing a list of Panels
that specifies the initial state of the iSEE
instance
(to be used as the initial
argument in iSEE
).
Again, any source can be used to create this list if initUI
and initLoad
are modified appropriately.
The UI elements for the SummarizedExperiment and the initial state are named "se"
and "initial"
respectively.
This can be used in Shiny bookmarking to initialize an iSEE
in a desired state by simply clicking a link,
provided that requireButton=FALSE
so that reactive expressions are immediately triggered upon setting se=
and initial=
in the URL.
We do not use bookmarking to set all individual iSEE
parameters as we will run afoul of URL character limits.
A function that generates a landing page upon being passed to iSEE
as the landingPage
argument.
We note that createLandingPage
is just a limited wrapper around the landing page API.
In iSEE
, landingPage
can be any function that accepts the following arguments:
FUN
, a function to initialize the iSEE
observer architecture.
This function expects to be passed:
SE
, a SummarizedExperiment object.
INITIAL
, a list of Panel objects describing the initial application state.
If NULL
, the initial state from initial
in the top-level iSEE
call is used instead.
TOUR
, a data.frame containing a tour to be attached to the app - see defaultTour
for an example.
If NULL
(the default), no tour is added.
COLORMAP
, an ExperimentColorMap object that defines the colormaps to use in the application.
input
, the Shiny input list.
output
, the Shiny output list.
session
, the Shiny session object.
The landingPage
function should define a renderUI
expression that is assigned to output$allPanels
.
This should define a UI that contains all widgets necessary for a user to set up an iSEE
session interactively.
We suggest that all UI elements have IDs prefixed with "initialize_INTERNAL"
to avoid conflicts.
The function should also define observers to respond to user interactions with the UI elements.
These are typically used to define a SummarizedExperiment object and an input state as a list of Panels;
any one of these observers may then call FUN
on those arguments to launch the main iSEE
instance.
Note that, once the main app is launched, the UI elements constructed here are lost and observers will never be called again. There is no explicit “unload” mechanism to return to the landing page from the main app, though a browser refresh is usually sufficient.
Aaron Lun
createLandingPage()
# Alternative approach, to create a landing page
# that opens one of the datasets from the scRNAseq package.
library(scRNAseq)
all.data <- ls("package:scRNAseq")
all.data <- all.data[grep("Data$", all.data)]
lpfun <- createLandingPage(
seUI=function(id) selectInput(id, "Dataset:", choices=all.data),
seLoad=function(x) get(x, as.environment("package:scRNAseq"))()
)
app <- iSEE(landingPage=lpfun)
if (interactive()) {
shiny::runApp(app, port=1234)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.