Skip to contents

Build a correlation-based network from a matrix

Usage

build_graph_from_mat(
  mat,
  transfrom.method = c("none", "scale", "center", "log2", "log10", "ln", "rrarefy",
    "rrarefy_relative"),
  r.threshold = 0.7,
  p.threshold = 0.05,
  method = c("WGCNA", "SpiecEasi", "SPARCC", "cor"),
  cor.method = c("pearson", "kendall", "spearman"),
  proc = c("Bonferroni", "Holm", "Hochberg", "SidakSS", "SidakSD", "BH", "BY", "ABH",
    "TSBH"),
  module.method = c("Fast_greedy", "Walktrap", "Edge_betweenness", "Spinglass"),
  SpiecEasi.method = c("mb", "glasso"),
  node_annotation = NULL,
  top_modules = 15,
  seed = 1115
)

Arguments

mat

Numeric matrix. A numeric matrix with samples in rows and variables in columns.

transfrom.method

Character. Data transformation methods applied before correlation analysis. Options include: "none" (raw data), "scale" (z-score standardization), "center" (mean centering only), "log2" (log2 transfrom), "log10" (log10 transfrom), "ln" (natural transfrom ), "rrarefy" (random rarefaction using vegan::rrarefy), "rrarefy_relative" (rarefy then convert to relative abundance).

r.threshold

Numeric. Correlation coefficient threshold; edges are kept only if |r| >= r.threshold.

p.threshold

Numeric. Significance threshold for correlations; edges are kept only if p < p.threshold.

method

Character. Relationship analysis methods. Options include: "WGCNA", "SpiecEasi", "SPARCC" and "cor".

cor.method

Character. Correlation analysis method. Options include "pearson", "kendall", and "spearman".

proc

Character. Correlation p-value adjustment methods. Options include: "Bonferroni", "Holm", "Hochberg", " SidakSS", "SidakSD","BH", "BY", "ABH", and "TSBH".

module.method

Character. Network community detection (module identification) method. Options include "Fast_greedy", "Walktrap", "Edge_betweenness", and "Spinglass".

SpiecEasi.method

Character. Method used in SpiecEasi network inference; options include "mb" and "glasso".

node_annotation

Data frame. Optional node annotation table, containing metadata such as taxonomy or functional categories.

top_modules

Integer. Number of top-ranked modules to retain for downstream visualization or analysis.

seed

Integer (default = 1115). Random seed for reproducibility..

Value

A graph object representing the correlation-based microbial network. Node/edge attributes include correlation statistics and (optionally) module labels.

Examples

NULL
#> NULL