Introduction

In this vignette we describe the steps for creating and editing interactive dashoboards from the output of the K2Taxonomer workflow (Reed and Monti 2020). For a more detailed description for running K2Taxonomer visit the vignettes describing bulk and single-cell workflows here and here, respectively.

Requirements

Load packages

## K2Taxonomer package
library(K2Taxonomer)

## For example expression data
library(Biobase)

## For drawing dendrograms
library(ggdendro)

Read in sample ExpressionSet object

The main input of 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)

Generating K2Taxonomer dashboard

Run 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)

Creating the dashboard

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 flexdashboard package and the R object (.rds) file containing the K2 object created by 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 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=".")

Additional considerations

The output directory

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:

analysis_name_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND_INTEGER

Note: Changing the name of this directory does not effect the dashboard.

The “about.md” file

K2Taxonomer allows users to include information about their study in the interactive dashboards by editing" the “about.mdmarkdown 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.

References

Reed, Eric R., and Stefano Monti. 2020. “Multi-Resolution Characterization of Molecular Taxonomies in Bulk and Single-Cell Transcriptomics Data.” Preprint. Bioinformatics. https://doi.org/10.1101/2020.11.05.370197.