stefpeschel / NetCoMi

Network construction, analysis, and comparison for microbial compositional data
GNU General Public License v3.0
146 stars 26 forks source link

question about association matrix transformation #70

Closed Valentin-Bio-zz closed 1 year ago

Valentin-Bio-zz commented 1 year ago

Hello Stefanie,

By reading the documentation, there is a need to convert the association matrices into dissimilarity matrices using the dissFunargument under the netConstruct() function.

As I understand this step is not a must isn't it? is it necessary only for computing the clusters?

If I don't specify the dissFun parameter, the default behaviour is to use the "signed method to convert the SpiecEasi association matrix into a dissimilarity matrix. Given that, when computing the clusters/modules under netAnalyze(), the function will use the
Hierarchical clustering algorithm as the association matrix was transformed into a dissimilarity one?

Second,, how is computed the normalization of the centrality metrics? mainly I'm using the degree centrality metric.

Thanks for your time,

Valentín.

stefpeschel commented 1 year ago

Hey Valentín, Since correlations are in [-1,1] but values in [0,1] are needed for the edge weights, the correlation matrix needs to be transformed properly. In NetCoMi, this is done by transforming the correlations into dissimilarities (using the specified function) and these, in turn, into similarities (simply 1- dissimilarity by default).

Depending on the clustering algorithm, either the similarity or dissimilarity matrix is used for clustering. Hierarchical clustering actually needs dissimilarities as input but you could alternatively use the "cluster_fast_greedy" algorithm, which uses the similarity matrix/edge weights.

How the normalized centralities are computed is explained on the help page ?NetCoMi::netAnalyze. For degree, the graph function degree() and also its normalization option is used (see ?igraph::degree).

Best, Stefanie