tmodBrowserTableUI | R Documentation |
Shiny Module – tmod results browser table selection
tmodBrowserTableUI(id, cntr_titles, upset_pane = FALSE)
tmodBrowserTableServer(
id,
tmod_res,
gs_id = NULL,
multilevel = FALSE,
tmod_dbs = NULL
)
id |
identifier for the namespace of the module |
cntr_titles |
possibly named character vector with contrast names |
upset_pane |
if TRUE, UI for the upset plot will be created |
tmod_res |
results of tmod analysis. It is a list of lists of lists of data frames. See Details. |
gs_id |
a list of reactive values (returned by |
multilevel |
if TRUE, the results are grouped in data sets |
tmod_dbs |
(optional) list of tmod database objects (or lists of list of tmod database object in multi data set mode). If NULL, upset plots cannot be generated. See Details. |
Regarding required data, this is probably the most complex module. That is due to the complexity of gene set enrichment analysis – we can test gene set enrichment using different parameters (e.g. gene list sorting order), for different gene set collections (such as KEGG or Hallmark from MSigDB) and, of course, for different contrast.
This module is adapted to gene set enrichment testing using the tmod package (described in Zyla et al. 2019).
For gene set enrichments, collections (databases) of gene sets must be defined. Such gene set collections include KEGG and REACTOME pathways, Gene Ontologies, transcriptional modules as well as meta-collections such as MSigDB.
There are many ways of storing such gene set collections. One way that I
find convenient (since I programmed it myself) is included in the
gene set enrichment testing package tmod
. Tmod database objects are
lists with at least three elements: gs
, gv
and gv2gs
(see
details in the tmod package). They can be conveniently created using
the tmod package.
In 'bioshmods', these objects are included in a structure which provides
gene set information to the 'bioshmods' functions. Each such structure
is a named list with one element per gene set collection (i.e., if you
have gene set enrichment results for KEGG and REACTOME, you will have
two such elements). Each of these element is a tmod database object
(returned, for example, by the tmod::makeTmod()
function from the 'tmod'
package). See the example dataset C19_gs.
This object needs to be a hierarchical lists of lists of lists. Top list
is a named list, with each element corresponding to one contrast. On the
next level, there is a named element for each gene set collection (see
'Use of tmod objects'). Finally, there may be different sorting options
(if in doubt, use pval
as the only element). The lowest level are data
frames containing column 'ID', 'Title', 'AUC', 'P.Value' and 'adj.P.Val'
as returned by e.g. tmod::tmodCERNOtest()
.
## Building an example from scratch
data(C19)
data(C19_gs)
db <- C19_gs$tmod_dbs$tmod
ds_res <- C19$contrasts$COVID19_ID0
ds_res <- ds_res[ order(ds_res$pvalue), ]
library(tmod)
tmod_res <- tmodCERNOtest(ds_res$symbol, mset=db)
# sorting by p-value
tmod_res <- list(pval=tmod_res)
# for datbase tmod
tmod_res <- list(tmod=tmod_res)
# for contrast Covid
tmod_res <- list(Covid=tmod_res)
if(interactive()) {
ui <- fluidPage(tmodBrowserTableUI("tt", names(tmod_res)))
server <- function(input, output) {
tmodBrowserTableServer("tt", tmod_res)
}
shinyApp(ui, server)
}
## the data sets in `bioshmods` are preformatted, so we can use them
## directly.
if(interactive()) {
ui <- fluidPage(tmodBrowserTableUI("tt", names(C19_gs$tmod_res), upset=TRUE))
server <- function(input, output) {
tmodBrowserTableServer("tt", C19_gs$tmod_res, gs_id = NULL,
tmod_dbs = C19_gs$tmod_dbs)
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.