stefpeschel / NetCoMi

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

edges dont color correctly with negative correlations #119

Closed gastronaut82 closed 3 months ago

gastronaut82 commented 4 months ago

Hi there - thanks so much for NetCoMi.

I have a question: everytime I try to build a network based on Pearson correlations, the network builds fine, but the edges are not correctly colored. Everything shows up "positive" - in other words, I don't see the color for negative correlations. What am I doing wrong?

code below - thanks!

net_pears <- netConstruct(ps.subsetrem, measure = "pearson", normMethod = "none", zeroMethod = "multRepl", sparsMethod = "threshold", thresh = 0.3, verbose = 3)

props_pears <- netAnalyze(net_pears, clustMethod = "cluster_fast_greedy")

plot(props_pears, edgeInvisFilter = "threshold", edgeInvisPar = 0.4, nodeColor = "cluster", nodeSize = "eigenvector", repulsion = 0.8, rmSingles = TRUE, posCol = "darkturquoise", negCol = "orange", labelScale = FALSE, cexLabels = 0.6, nodeSizeSpread = 3, cexNodes = 2, hubBorderCol = "darkgray", title1 = "Network on OTU level with Pearson correlations", showTitle = TRUE, cexTitle = 2.3)

stefpeschel commented 4 months ago

Hi! I see no reason in your code why negative edges shouldn't be visible. What happens if you do just plot(props_pears) without all the arguments? Do the negative edges show up then?

gastronaut82 commented 4 months ago

I think its actually working fine - thank you! The correlations were positive.