ggClusterNet 2.0

repository·master·Indexed 41 days ago

https://github.com/taowenmicro/ggclusternet

An R package for microbial co-occurrence network analysis and visualization in microbiome research. It features a comprehensive pipeline via network.pip() for correlation computation (Pearson, Spearman, SparCC), topological characterization, and multi-omics integration. The toolkit includes advanced network mining for spatiotemporal analysis, robustness testing, and specialized layouts such as model_maptree2 and cir.squ.

Tokens
1K
Snippets
2
Records
3
Agent score
50%

What's inside ggClusterNet

  1. Core features of ggClusterNet 2.0

    master

    ggClusterNet 2.0 provides four main functional areas for microbiome research:

    1. Comprehensive Pipeline: Includes network computation (Pearson/Spearman/SparCC), topological characterization, multi-network comparison, robustness testing, and module analysis.
    2. Advanced Network Mining: Functions for multi-factor, multi-treatment, and spatiotemporal analysis (e.g., Facet.Network(), module.compare.m.ts(), Robustness.Random.removal.ts()).
    3. Interaction Analysis & Visualization: Tools for microbial and multi-factor interaction analysis with versatile layouts (e.g., MatCorPlot2(), Miccorplot3(), cor_link3(), matcorplotj(), two.cor()).
    4. Cross-domain & Multi-omics Integration: Specialized functions and layouts for complex multi-omics networks (e.g., corBionetwork.st(), model_maptree2(), model_Gephi.3(), cir.squ(), cir.maptree2()).
  2. Install ggClusterNet 2.0

    master

    To install ggClusterNet, you must first install several dependencies via BiocManager and standard R installation methods, including tidyverse, igraph, phyloseq, and ggraph. Finally, use remotes::install_github to install EasyStat and ggClusterNet directly from GitHub.

    install.packages("BiocManager")
    library(BiocManager)
    install("remotes")
    install("tidyverse")
    install("tidyfst")
    install("igraph")
    install("sna")
    install("phyloseq")
    install("ggalluvial")
    install("ggraph")
    install("WGCNA")
    install("ggnewscale")
    install("pulsar")
    install("patchwork")
    remotes::install_github("taowenmicro/EasyStat")
    remotes::install_github("taowenmicro/ggClusterNet")
  3. Run the microbial co-occurrence network pipeline with network.pip()

    master

    The network.pip() function is the core pipeline for computing and visualizing microbial co-occurrence networks. It accepts a phyloseq object and performs correlation computation (e.g., Pearson, Spearman, or SparCC), topological characterization, and visualization.

    Key parameters include:

    • ps: A phyloseq object containing microbiome data.
    • N: Number of taxa to include.
    • method: Correlation method (e.g., "sparcc").
    • r.threshold: Correlation coefficient threshold.
    • p.threshold: P-value threshold.
    • layout_net: Visualization layout algorithm (e.g., "model_maptree2").
    • group, fill, size: Parameters for mapping metadata to network properties (e.g., group = "Group", fill = "Phylum").
    • ncpus: Number of CPUs for parallel processing.

    The function returns a list where the first element is a list of plots and the second element is a data object containing the network results.

    library(tidyverse)
    library(ggClusterNet)
    library(phyloseq)
    library(igraph)
    
    tab.r = network.pip(
      ps = ps,
      N = 200,
      big = FALSE,
      select_layout = FALSE,
      layout_net = "model_maptree2",
      r.threshold = 0.6,
      p.threshold = 0.05,
      maxnode = 2,
      method = "sparcc",
      label = FALSE,
      lab = "elements",
      group = "Group",
      fill = "Phylum",
      size = "igraph.degree",
      zipi = TRUE,
      ram.net = TRUE,
      clu_method = "cluster_fast_greedy",
      step = 100,
      R = 10,
      ncpus = 6
    )
    
    # Accessing results
    plot_list = tab.r[[1]]
    network_data = tab.r[[2]]
    cortab = network_data$net.cor.matrix$cortab