Accessing interactive plots

Interactive plots in the bigPint package open as Shiny applications. These applications consist of a simple dashboard that includes an “About” tab that explains how to use the application. They also include an “Application” tab that offers several input fields that the user can tailor to their needs. Some of these input fields are generated dynamically based off the dataset that the user input. These tailorizations include aesthetics (such as point color) and metrics to determine the subset of data to be superimposed. In these applications, users can also easily save static images of the interactive graphics and lists of selected genes to their local computer.


Types of interactive plots

Currently, there are four interactive plots available in the bigPint package:

  • Scatterplot matrix
  • Litre plots
  • Parallel coordinate plots
  • Volcano plots

Below we provide examples on how to produce these types of plots.


Scatterplot matrix app

Interactive scatterplot matrices can be generated with the bigPint function plotSMApp(). The code below will generate an example interactive scatterplot matrix from the soybean cotyledon dataset (Brown and Hudson 2015).

library(bigPint)
data("soybean_cn_sub")
soybean_cn_sub <- soybean_cn_sub[,1:7]
app <- plotSMApp(data=soybean_cn_sub)
if (interactive()) {
    shiny::runApp(app)
}

Upon running the code above in your R session, an interactive application will open. You can access and interact with an instance of this application here. Embedded below is a video demonstration of the application.


Litre plot app

Interactive litre plots can be generated with the bigPint function plotLitreApp(). The code below will generate an example interactive litre plot using the soybean iron metabolism dataset after being logged (Lauter and Graham 2016).

data("soybean_ir_sub")
data("soybean_ir_sub_metrics")
soybean_ir_sub_log <- soybean_ir_sub
soybean_ir_sub_log[,-1] <- log(soybean_ir_sub[,-1]+1)
app <- plotLitreApp(data=soybean_ir_sub_log,
    dataMetrics = soybean_ir_sub_metrics)
if (interactive()) {
    shiny::runApp(app, port = 1234, launch.browser = TRUE)
}

Upon running the code above in your R session, an interactive application will open. You can access and interact with an instance of this application here. Embedded below is a video demonstration of the application.


Volcano plot app

Users can produce interactive parallel coordinate plots with the bigPint function plotVolcanoApp(). The code below will generate an example interactive volcano plot. We will input the logged soybean iron metabolism dataset (Lauter and Graham 2016) that we just created above.

app <- plotVolcanoApp(data = soybean_ir_sub_log,
    dataMetrics = soybean_ir_sub_metrics)
if (interactive()) {
    shiny::runApp(app)
}

Upon running the code above in your R session, an interactive application will open. You can access and interact with an instance of this application here. Embedded below is a video demonstration of the application.


Parallel coordinates app

Users can produce interactive parallel coordinate plots with the bigPint function plotPCPApp(). The code below will generate an example interactive parallel coordinate plot using the soybean iron metabolism dataset after being standardized (Lauter and Graham 2016).

soybean_ir_sub_st = as.data.frame(t(apply(as.matrix(soybean_ir_sub[,-1]), 1,
  scale)))
soybean_ir_sub_st$ID = as.character(soybean_ir_sub$ID)
soybean_ir_sub_st = soybean_ir_sub_st[,c(length(soybean_ir_sub_st),
  1:length(soybean_ir_sub_st)-1)]
colnames(soybean_ir_sub_st) = colnames(soybean_ir_sub)
nID = which(is.nan(soybean_ir_sub_st[,2]))
soybean_ir_sub_st[nID,2:length(soybean_ir_sub_st)] = 0

plotGenes = filter(soybean_ir_sub_metrics[["N_P"]], FDR < 0.01, logFC < -4) %>%
  select(ID)
pcpDat = filter(soybean_ir_sub_st, ID %in% plotGenes[,1])
app <- plotPCPApp(data = pcpDat)
if (interactive()) {
    shiny::runApp(app, display.mode = "normal")
}

Upon running the code above in your R session, an interactive application will open. You can access and interact with an instance of this application here. Embedded below is a video demonstration of the application.


SummarizedExperiment Version

Below are the corresponding code blocks from everything above that now use the SummarizedExperiment object (dataSE) instead of the data and dataMetrics objects.

Scatterplot matrix app

We use the convertSEPair() function to reduce the SummarizedExperiment object from having three treatment groups (se_soybean_cn_sub) to only having two treatment groups, S1 and S2 (se_soybean_cn_sub_S1S2).

data("se_soybean_cn_sub")
se_soybean_cn_sub_S1S2 <- convertSEPair(se_soybean_cn_sub, "S1", "S2")
app <- plotSMApp(dataSE=se_soybean_cn_sub_S1S2)
if (interactive()) {
  shiny::runApp(app)
}

Litre plot app

data("se_soybean_ir_sub")
se_soybean_ir_sub_log = se_soybean_ir_sub
assay(se_soybean_ir_sub_log) <- log(as.data.frame(assay(se_soybean_ir_sub))+1)
app <- plotLitreApp(dataSE = se_soybean_ir_sub_log)
if (interactive()) {
  shiny::runApp(app, port = 1234, launch.browser = TRUE)
}

Volcano plot app

app <- plotVolcanoApp(dataSE = se_soybean_ir_sub_log)
if (interactive()) {
  shiny::runApp(app)
}

Parallel coordinates app

se_soybean_ir_sub_st = se_soybean_ir_sub
assay(se_soybean_ir_sub_st) <- as.data.frame(t(apply(as.matrix(as.data.frame(
  assay(se_soybean_ir_sub))), 1, scale)))
nID <- which(is.nan(as.data.frame(assay(se_soybean_ir_sub_st))[,1]))
assay(se_soybean_ir_sub_st)[nID,] <- 0

We use the convertSESubsetGenes() method to reduce the number of genes in the original SummarizedExperiment object from 5604 genes (se_soybean_ir_sub_st) to the 14 genes (se_soybean_ir_sub_st_genes) that had FDR less than 0.01 and logFC less than -4.

dataMetrics <- as.data.frame(rowData(se_soybean_ir_sub_st))
plotGenes = filter(dataMetrics, N_P.FDR < 0.01, N_P.logFC < -4) %>% select(ID)
plotGenes = plotGenes[,1]
se_soybean_ir_sub_st_genes <- convertSESubsetGenes(se_soybean_ir_sub_st,
  plotGenes)
app <- plotPCPApp(dataSE = se_soybean_ir_sub_st_genes)
if (interactive()) {
  shiny::runApp(app, display.mode = "normal")
}

References

Brown, Anne V., and Karen A. Hudson. 2015. “Developmental Profiling of Gene Expression in Soybean Trifoliate Leaves and Cotyledons.” BMC Plant Biology 15 (1): 169.

Lauter, AN Moran, and MA Graham. 2016. “NCBI Sra Bioproject Accession: PRJNA318409.”