Microbial dIversity and Network Analysis with mina

Rui Guan

2022-04-26

Abstract

With the help of rapidly developing sequencing technologies, an increasing number of microbiome datasets are generated and analysed. At present, diversity analysis of taxonomic profiling data is mainly conducted using composition-based methods, which ignores the interactions between community members and limits the study of community dynamics.The goal of mina is to provide a framework for microbial community analysis based on higher order community structures to better understand the principles that govern the establishment of those communities. In addition, a bootstrap-permutation based network comparison method was developed to compare global and local ecological networks and to statistically assess their dissimilarity. mina package version: 1.4.0

Overview

The package is used for microbial profiling data analysis, including community similarity / dissimilarity / distance calculation and network comparison.

Input data

mina package expects count data (e.g. OTU table or ASV table) to represent community profiling results and a descriptive table which indicates the information of each sample. In the quantitative table, each row contains one composition in the community and each column represents one profiled sample. In the descriptive table, same samples as rows in quantitative table should be included in the column “Sample_ID”.

Import data

Using new() to create a new object and then import data into the object. The new object could be generated and slots could be imported simultaneously:

Please be aware that the descriptive table have to contain a column called “Sample_ID” which includes the same samples indicated in the quantitative tables. See an example here:

For the quantitative table, each column correspond to one sample indicated in the descriptive table and each row represent one composition in the community.

Check data format and tidy up

For the format of data, one could take a look at the data included in the package as indicated as before. After checking, if there is mismatch between quantitative and descriptive tables, fit_tabs() could be implied.

Diversity analysis of the community

Typically the analysis of microbial community data includes estimating within and between sample diversities (alpha- and beta-diversity) based on compositions. By counting the number of observed compositions and evaluating the evenness of their distribution, alpha diversity of each community is quantified. Distance or dissimilarity between samples calculated from counts differentiation of compositions is used to indicate the beta diversity of community.

Data normalization

Due to the varied sequencing depth, it is essential to normalize the data before the analysis of the diversity. Rarefaction and normalization by total sum are available here. For rarefaction, to reduce the random effect, multiple times bootstrap is recommended. The normalized table will be stored in the same mina object automatically when it were given as input.

When given a matrix for normalization, the normalized matrix will be returned.

Community diversity

Based on the normalized quantitative table, distance / dissimilarity could be calculated between pairwise samples and used for beta-diversity analysis.

For TINA dissimilarity described in Schmidt et al. 2017, in com_dis() function, Spearman correlation and weighted Jaccard was used by default, to calculate TINA with other options, use function tina().

Unexplained variance of community diversity

To evaluate the biological meaningful variance to noise ratio, the percentage of variance that could not be explained by any factors was calculated.

Community beta-diversity visualization

PCoA (Principle Coordinate Analysis) is usually used for the visualization of beta-diversity of microbial community data. By using different color and shape, samples from different conditions are compared.

When using dissimilarity matrix as input, the dmr() function is used to reduce the dimension of data and pcoa_plot() is used for plotting.

Network inference and clustering

For the microbial community research, diversity analysis capture only static features and co-occurrence networks are typically inferred to indicate dynamics of the system.

Correlation coefficient adjacency matrix

Correlation will be calculated according to the covariance of compositions across samples. When significance test is applied, rcorr() from Hmisc.

Also the function could be applied to matrix directly, the correlation between pairwise rows will be calculated.

Network clustering

By removing the non-significant(waiting for update) and weak correlations, the network of each adjacency matrix is generated and closely related nodes will be inferred by clustering methods. In the package, Markov Cluster Algorithm (MCL, Dongen, 2000) and Affinity Propagation (AP, Frey et al, 2007) are implemented for network clustering.

Also it is possible to give a adjacency matrix directly and got the generated cluster data frame.

Higher-order feature based diversity analysis

By accumulating the relative abundance of compositions belong to the same network clusters, the higher-order feature quantitative table is obtained and could be used for further diversity analysis. Besides, compositions belong to the same phylogenetic group could also be grouped together as new quantitative table.

Higher-order quantitative table

According to the network cluster assignments, compositions belong to the same higher order level group are accumulated by summing up their relative abundances.

Community diversity analysis and comparison

Same diversity analysis could be applied to cluster table and compared with composition based table.

Network comparison and statistical test

To compare the network of communities, pairwise distance between adjacency matrix, which present all connection information, are calculated. By substrate adjacency matrix (A) by the degree matrix (D), Laplacian matrix is obtained and the corresponding eigenvector and eigenvalues are calculated. Spectral distance then defined as the Euclidean distance between first k eigenvalues. Alternatively, Jaccard distance between matrix is implemented as dividing the sum of matrix contrast by the sum of larger absolute value between two adjacency matrices.

Bootstrap-permutation based network construction

To be able to test the significance of distances between matrices, a bootstrap-permutation based method is developed. By subsampling and bootstrap, true correlation adjacency matrices were constructed from subset of original data. Then the metadata of samples is randomly swapped as permutated datasets, from which the pseudo correlation coefficient is calculated. By comparing the true adjacency matrices with the pseudo ones, the significance of distance is obtained.

When the composition number is big, the bootstrap-permutation could take very long time, thus pre-filtering is needed. g_size is the minimum number of samples for groups defined by group. Conditions with less than g_size would be removed for later analysis and this is set as 88 by default. s_size is the sub-sampling size for bootstrap and permutation, 30 by default. s_size should definitely smaller than g_size and preferably smaller than half of it. Also compositions appear in less than specific percentage of samples could be filtered by setting the occupancy threshold per and rm. By default, the compositions which present in less than 10% samples would be filtered. When the quantitative matrix is too big, one could choose to output the bootstrap and permutation results separately for each comparison.

Network distance calculation and significance test

After getting the true and pseudo adjacency matrices, Spectral and Jaccard distance defined before is then calculated and p value is obtained by comparing the F (the real distance) and Fp (the pseudo distance) following the formula: p = \(\frac { C_{F_p > F} + 1 }{ N_{dis} + 1 }\) For the individual generated network comparison results, the distance calculation is implemented by the function net_dis_indi(). Same methods are available.