stefpeschel / NetCoMi

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

Increasing negative edge thickness #69

Closed SevanEsaian closed 1 year ago

SevanEsaian commented 1 year ago

Hello, I am using NetCoMi to analyze microbiome networks on juvenile and mature samples. I want to show which bacteria families are temporally negatively correlated. However, NetCoMi only increases edge thickness for positive correlations. Is there a way to increase edge thickness for negative correlations as well? Thank you for your help.

stefpeschel commented 1 year ago

Hey Sevan, The edge thickness is scaled according to the adjacencies (matrices adjaMat1 and adjaMat2). These are determined as follows: correlations are transformed into dissimilarities (using the "signed" transformation by default) and these, in turn, into similarities, which are used as edge weights.

When using the "signed" transformation, strong negative correlations lead to low edge weights close to zero. You could use "unsigned" instead to handle positive and negative correlations equally. Then, strong negative correlations will have the same edge weight as strong positive correlations.

For highlighting only negative correlations, you would have to manipulate the adjacency matrix.

Best, Stefanie

SevanEsaian commented 1 year ago

Hi Stefanie, Thanks so much for the clarification. I will use your advice to generate my desired figures. If I get stuck, I'll be sure to follow-up with you. Very much appreciated. Best, Sevan