Skip to contents

Draw a network on PPI result output from test_PPI

Usage

PPInetwork(
  PPIlinks,
  layoutway = "layout_components",
  nodecolor = "#2EA9DF",
  nodeshape = c("circle", "square"),
  linecolor = "#ADD8E6",
  nodesize = 20,
  changesize = FALSE,
  fontsize = 25,
  changewidth = FALSE,
  linewidth = 5,
  smoothline = FALSE,
  smoothtype = "continous",
  highlightkey = TRUE,
  returntype = c("visNetwork", "igraph")
)

Arguments

PPIlinks

The PPI result from test_ppi

layoutway

Character(1), the name of a layout function in igraph package,such as "layout_as_star", "layout_as_tree", "layout_in_circle". See layout.

nodecolor

Character(1), the color of node.

nodeshape

Character(1), the shape of node. One of "circle", "square", "raster", or other vertex.shapes in igraph.

linecolor

Character(1), the color of edge line.

nodesize

Numeric(1), the size of node.

changesize

Logical(1), whether change node size by link number.

fontsize

Numeric(1), the font size of label.

changewidth

Logical(1), whether change edge width by interaction score.

linewidth

Numeric(1), the width of edge.

smoothline

Logical(1), whether smooth the edge. Works only for visNetwork

smoothtype

Character(1), one of 'dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier'

highlightkey

logical(1), whether label the central nodes by red which have at least 6 interactions.

returntype

Character(1), "visNetwork" or "igraph".

Value

A visNetwork plot or a igraph obejct according returntype.

Examples

if (FALSE) {
# Load example
data(Silicosis_pg)
data <- Silicosis_pg
data_unique <- make_unique(data, "Gene.names", "Protein.IDs", delim = ";")

# Differential test
ecols <- grep("LFQ.", colnames(data_unique))
se <- make_se_parse(data_unique, ecols,mode = "delim")
filt <- filter_se(se, thr = 0, fraction = 0.4, filter_formula = ~ Reverse != "+" & Potential.contaminant!="+")
norm <- normalize_vsn(filt)
imputed <- impute(norm, fun = "MinProb", q = 0.05)
diff <- test_diff(imputed, type = "control", control  = c("PBS"), fdr.type = "Storey's qvalue")
dep <- add_rejections(diff, alpha = 0.01,lfc = 2)

# PPI construct
if(check_PPI_depends()){

  # Load STRING data. If local STRING is missing, PPI_res will download to system.file("PPIdata", "Mouse",package = "DEP2")
  load_PPIdata(speciesname = "Mouse")

  PPI_res <- test_PPI(dep, contrasts = "W4_vs_PBS", species = "Mouse",
                      STRING.version = "11.5",score_cutoff = 400)

  ## igraph network
  PPI_ig <- PPInetwork(PPI_res, returntype = "igraph")
  igraph::plot.igraph(PPI_ig)

  ## visNetwork network
  PPInetwork(PPI_res, returntype = "visNetwork")
  }
}