stefpeschel / NetCoMi

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

net$hub returning NULL #65

Closed Valentin-Bio-zz closed 2 years ago

Valentin-Bio-zz commented 2 years ago

Hello, developer! thanks for this tool! I'm trying to make a camparison between networks and later establish differentially associated nodes using NetCoMi. THe point is when I run netAnalyze() over the MIcronet object with two networks I cannot plot the networks due to NULL hubs. I used SpiecEAsi adjacent networks for the analysis:

oral_NO_AR_net <- netConstruct(data = as.matrix(symBeta(getOptBeta(oral_AR_net)), mode = "maxabs"),
                               data2 = as.matrix(symBeta(getOptBeta(oral_NO_net)), mode = "maxabs"),
                               dataType = "condDependence", normMethod = "none", 
                               sparsMethod = "none", zeroMethod = "none", 
                               verbose = 3, seed = 1234)

then, when I run the netAnalyze() I got the following:


oral_NO_AR_comp <- netAnalyze(oral_NO_AR_net, centrLCC = FALSE, avDissIgnoreInf = TRUE,
                              clustMethod = "cluster_fast_greedy", 
                              hubPar = c("between","degree"), hubQuant = 0.95,
                              normDeg = TRUE, normBetw = TRUE)

oral_NO_AR_comp$hubs

**$hubs1 NULL

$hubs2 NULL**

stefpeschel commented 2 years ago

Hi Valentin, Could you please check whether your input has row and column names? E.g.: rownames(as.matrix(symBeta(getOptBeta(oral_AR_net)), mode = "maxabs")) colnames(as.matrix(symBeta(getOptBeta(oral_AR_net)), mode = "maxabs"))

They are important because they define the taxa, which are the network's nodes. Note that row and column names must be equal if association matrices are used as input.

I'll add a stopping criterion to catch the case that dim names are missing.

Best, Stefanie

Valentin-Bio-zz commented 2 years ago

Thanks so much for your help! it worked.

Best,

Valentín.