knitr::opts_chunk$set( collapse=TRUE, comment="#>", message=FALSE, warning=FALSE, eval=FALSE )
In this vignette we describe the steps for creating and editing interactive
dashoboards from the output of the r Githubpkg("montilab/K2Taxonomer")
workflow [@reed_2020]. For a more detailed description for running
r Githubpkg("montilab/K2Taxonomer")
visit the vignettes describing bulk and
single-cell workflows
here
and
here,
respectively.
## K2Taxonomer package library(K2Taxonomer) ## For example expression data library(Biobase) ## For drawing dendrograms library(ggdendro)
ExpressionSet
objectThe main input of r Githubpkg("montilab/K2Taxonomer")
is an ExpressionSet
object with approximately normally distributed expression values. Here we read
in an example data set. See ?sample.ExpressionSet for more information about
these data.
data(sample.ExpressionSet)
levels(pData(sample.ExpressionSet)$type) <- c("Control", "Case")
r Githubpkg("montilab/K2Taxonomer")
dashboardr Githubpkg("montilab/K2Taxonomer")
# Use toy set of gene sets genes <- rownames(sample.ExpressionSet) genesetsMadeUp <- list( geneset1=genes[1:100], geneset2=genes[101:200], geneset3=genes[201:300]) # Run phenotypic variable tests infoClassVector <- c( sex="factor", type="factor1", score="numeric1") K2res <- runK2Taxonomer( eSet=sample.ExpressionSet, genesets=genesetsMadeUp, infoClass=infoClassVector, stabThresh=0.5)
We generate the interactive dashboards with the K2dashboard()
function. This
function will create a directory with two files. These two files include the
interactive RMarkdown (.Rmd) file created by the r CRANpkg("flexdashboard")
package and the R object (.rds) file containing the K2
object created by
r Githubpkg("montilab/K2Taxonomer")
functions.
Below we shown the K2dashboard()
function and each of its arguments.
The first argument, specifying the K2
object is the only requirement. The
remaining three arguments costumize the output, as follows:
analysis_name: Specifies the title to be printed on the top of the dashboard. Also, specifies the prefix of the name of the output files. For filenames, spaces are replaced by underscores.
about: Logical specifying whether to include an about page in the
dashboard. If TRUE (default), a third file is written to the dashboard
directory, "about.md". This is an editable markdown (.md) file, which the
user is free to edit, and includes some default information about where to
learn more about r Githubpkg("montilab/K2Taxonomer")
and how to navigate the
dashboard. Customizing this file is described in more detail below.
output_dir: This is simply the path to the directory to write the dashboard directory.
K2dashboard(K2res, analysis_name="K2Taxonomer Example", about=TRUE, output_dir=".")
To prevent the overwriting of dashboard files, in addition to the analysis_name, the name of dashboard directory includes the date and time, followed by a random seven digit integer. It is formatted as follows:
Note: Changing the name of this directory does not effect the dashboard.
r Githubpkg("montilab/K2Taxonomer")
allows users to include information about
their study in the interactive dashboards by editing" the "about.md"
markdown file. When the "about.md" is included in the dashboard
directory, it is read in and the markdown code is compiled along with the
code in the dashboard file.
This file uses markdown syntax specific to the CRANpkg("flexdashboard") "Multiple Pages" layout, which can be reviewed here. Mainly, the first two lines of the default "about.md" file.
about =====================================
Will result in a tab, named About, as the first tab in the dashboard. Furthermore, lines with headers should start at three hashes, "###".
Finally, when including links in the "about.md" file, make sure that clicking on these links opens a new window using the following:
[TEXT](URL){target="_blank"}
Otherwise, the dashboard will need to reload upon navigating back.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.