Construct a microbiome correlation network using QIIME2 and visualise with Cytoscape

Sharis Wong
4 min readJul 10, 2023

--

Why correlation network?

Network analysis offers a powerful way to understand the microbiome’s complexity, predict its functions, and find connections to health and disease. It gives us a glimpse into the microbial social world and helps us make informed decisions about interventions that could improve our well-being.

Revealing microbial relationships and structure

Microbes don’t work alone. They interact with each other in complex ways. Network analysis helps us uncover these interactions and understand how microbes influence one another. It’s like uncovering a hidden social network within the microbial world. This also helps us identify important members of the community and groups of microbes that tend to collide.

Predicting functions

Microbial interactions and community structure give us hints about what the microbiome can do. Network analysis lets us combine metagenomic data with other omics data to predict the functions of the microbiome. By looking at the network’s patterns and identifying important nodes, we can make educated guesses about what the microbes are up to. For instance, to identify specific interactions or community patterns associated with the disease, could lead to new ways of diagnosing or treating diseases

Steps to construct a correlation network

Before you start...

1. Install SCNIC

In Linux operating terminal, activate QIIME2–2020.11

export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8
conda activate qiime2-2020.11
conda install -q scnic
#or
pip install scnic

Install package and plugin

pip install git+https://github.com/lozuponelab/q2-SCNIC.git
qiime dev refresh-cache

2. Prepare input data

Arrange OTUs from your sample data as the format shown below with Microsoft Excel

  • Shared name: Unique display characters on the nodes in the network (could be OTU ID, name of species ... )

Export table as (.tsv) or (.txt)

In Linux operating terminal, convert file format

  • From (.tsv) or (.txt) to (.biom)
biom convert -i table.txt -o feature_table.biom --table-type="OTU table" --to-hdf5
  • From (.biom) to (.qza)
qiime tools import \
--input-path feature_table.biom \
--type 'FeatureTable[Frequency]' \
--input-format BIOMV210Format \
--output-path feature_table.qza

3. Run SCNIC

Filter feature with abundance total below 500 and all features with an average abundance less than 2 across all samples

qiime SCNIC sparcc-filter \
--i-table feature_table.qza \
--o-table-filtered feature_table-filtered.qza

Calculate correlations between features and create network using Pearson's method

qiime SCNIC calculate-correlations \
--i-table feature_table-filtered.qza \
--p-method pearson \
--o-correlation-table feature_table_correls.qza

Detect and summarise modules of features

qiime SCNIC make-modules-on-correlations \
--i-correlation-table feature_table_correls.qza \
--i-feature-table feature_table.qza \
--p-min-r .35 \
--o-collapsed-table feature_table.collapsed.qza \
--o-correlation-network feature_table_net.modules.qza \
--o-module-membership feature_table_membership.qza

Export "feature_table_net.modules.qza" and download output

qiime tools export \
--input-path feature_table_net.modules.qza \
--output-path /

Visualising network with Cytoscape

Install Cytoscape: https://cytoscape.org

1. Import network into Cytoscape

Drag network(.gml) into the marked panel

  • Alter network appearance with "Style" tool bar on the left side
  • Adjust scale of the network with "Layout Tools" at the bottom left

(Optional) Alter network appearance based on input data

  1. Arrange data as the format shown below with Microsoft Excel
  • Shared name must be the same with input feature table
  • Each column represents a target grouping (eg. Classifications-phylum)

2. Save as (.tsv) or (.txt)

3. Import to Cytoscape as table

4. Change appearance by selecting the representing column

i.e. Change node fill colour based on the label

5. Save and export network after touching up

References

  1. Shaffer, M., Thurimella, K., Sterrett, J. D., & Lozupone, C. A. (2023). SCNIC: Sparse correlation network investigation for compositional data. Molecular Ecology Resources, 23, 312– 325. https://doi.org/10.1111/1755-0998.13704 https://forum.qiime2.org/t/q2-scnic-a-tool-for-making-correlation-networks-finding-modules-of-observations-and-summarizing-them/6116

--

--

Sharis Wong
Sharis Wong

Written by Sharis Wong

NTU Master's student specifies in microbiome metagenomic analysis, sharing and hopefully exchanging thoughts along the way :)

No responses yet