nodeEdge: Construct igraph and tidygraph object

View source: R/nodeEdge.R

nodeEdgeR Documentation

Construct igraph and tidygraph object

Description

Construct igraph and tidygraph object

Usage

nodeEdge(corr = cor, zero = TRUE)

Arguments

zero

TRUE or FALSE. If the edge-to-edge correlation is 0, FALSE preserves the output.

cor

Correlation matrix

Value

list Documents required for drawing

Author(s)

Contact: Tao Wen 2018203048@njau.edu.cn Jun Yuan junyuan@njau.edu.cn Penghao Xie 2019103106@njau.edu.cn

References

Yuan J, Zhao J, Wen T, Zhao M, Li R, Goossens P, Huang Q, Bai Y, Vivanco JM, Kowalchuk GA, Berendsen RL, Shen Q Root exudates drive the soil-borne legacy of aboveground pathogen infection Microbiome 2018,DOI: doi: 10.1186/s40168-018-0537-x

Examples

data(ps)
result = corMicro (ps = ps,N = 100,r.threshold=0.8,p.threshold=0.05,method = "pearson")
#Extract correlation matrix
cor = result[[1]]
# nodeEdge function generates nodes and edge files
result4 = nodeEdge(cor = cor)
# Extract edge file
edge = result4[[1]]
dim(edge)
edge$weight
# Extract node file
node = result4[[2]]
dim(node)
# Input to the igraph for plot
igraph  = igraph::graph_from_data_frame(edge, directed = FALSE, vertices = node)
# Input to the tidygraph for plot
library(tidygraph)
library(ggraph)
tbl_graph = tidygraph::tbl_graph(nodes = node, edges = edge, directed = FALSE)
tbl_graph

taowenmicro/ggClusterNet documentation built on March 29, 2024, 1:32 a.m.