plotPCPApp: Plot interactive parallel coordinate plots

Description Usage Arguments Value Examples

View source: R/plotPCPApp.R

Description

Plot interactive parallel coordinate plots.

Usage

1
plotPCPApp(data = data, dataSE = NULL, pointColor = "orange")

Arguments

data

DATA FRAME | Read counts for parallel coordinate lines

dataSE

SUMMARIZEDEXPERIMENT | Summarized experiment format that can be used in lieu of data; default NULL

pointColor

CHARACTER STRING | Color of overlaid points on scatterplot matrix; default "orange"

Value

A Shiny application that shows a parallel coordinate plot and allows users to draw rectangular areas across samples and remove genes that are not inside these areas. The user can download a file that contains the gene IDs that remain.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# The first example uses data and dataMetrics objects as
# input. The last example creates the same plot now using the
# SummarizedExperiment (i.e. dataSE) object input.

# Example: Create interactive parallel coordinate plot for genes that have
# FDR < 0.01 and logFC < -4. Standardize genes to have an average of zero
# and a standard deviation of one.

data(soybean_ir_sub)
data(soybean_ir_sub_metrics)

# Create standardized version of data
library(matrixStats)
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

library(dplyr, warn.conflicts = FALSE)
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, pointColor = "purple")
if (interactive()) {
    shiny::runApp(app, display.mode = "normal")
}

# Below is the same example, only now using the
# SummarizedExperiment (i.e. dataSE) object as input.

# Example: Create interactive parallel coordinate plot for genes that have
# FDR < 0.01 and logFC < -4. Standardize genes to have an average of zero
# and a standard deviation of one.

## Not run: 
data(se_soybean_ir_sub)

# Create standardized version of data
library(matrixStats)
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

# To subset our SummarizedExperiment data by a list of genes, we can
# invoke the convertSESubsetGenes() method.

library(dplyr, warn.conflicts = FALSE)
geneList <- as.data.frame(rowData(se_soybean_ir_sub_st)) %>%
    filter(N_P.FDR <= 0.01) %>% filter(N_P.logFC < -4)
geneList <- geneList[,1]
pcpDat <- convertSESubsetGenes(se_soybean_ir_sub_st, geneList)

app <- plotPCPApp(dataSE = pcpDat, pointColor = "purple")
if (interactive()) {
    shiny::runApp(app, display.mode = "normal")
}

## End(Not run)

bigPint documentation built on Nov. 8, 2020, 5:07 p.m.