knitr::opts_chunk$set(
    collapse=TRUE,
    comment="#>",
    message=FALSE,
    warning=FALSE,
    eval=FALSE
)

Introduction

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.

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

Generating r Githubpkg("montilab/K2Taxonomer") dashboard

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

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 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:

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

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.

References



montilab/K2Taxonomer documentation built on Jan. 25, 2024, 4:29 p.m.