stefpeschel / NetCoMi

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

diffnet errors #59

Closed eknorr1 closed 2 years ago

eknorr1 commented 2 years ago

Hi,

I got this error several times at the end of running the diffnet function:

" Error in unserialize(node$con) : error reading from connection Calls: local ... doTryCatch -> recvData -> recvData.SOCKnode -> unserialize Execution halted"

And this is the code I had running...

"diffnet_age <- diffnet(net_age, diffMethod = "permute", nPerm = 1000L, cores = 4L, adjust = "lfdr", seed = 123456)"

Net_age is the result of a netConstruct() network comparison. I do have the diffnet_age in my Environment with pvalsVec and pAdjustVec (all one's) and tried plotting but it says empty network. I'm not sure what the error means or if the code worked correctly and there actually are not any differentially associated taxa

Thank you! Liz

stefpeschel commented 2 years ago

Dear Liz,

I did a bit of reasearch and it seems that the errors occur due to running out of memory (see, e.g., this thread where the same error occurs with another package).

Have you tried running the code non-parallel? It would be interesting to see if you run into the same issue without parallelization.

Since memory problems are likely to occur for large data sets, NetCoMi provides a workaround. The function createAssoPerm() can be used to calculate the permutation association matrices in smaller blocks of, e.g., 100 permutations. The matrices of each block are calculated separately, stored on disk, and finally combined to one matrix, which can be sent to netCompare() and diffnet(). Please see the tutorial on how to use the createAssoPerm function. You'll need the section "Block-wise execution (executable in parallel)" only, but I would suggest going through the whole tutorial to understand how the function works. You can ignore the part on "matched samples" if this doesn't apply to your data.

Please let me know if you were able to solve the problem. Otherwise we'll have to dive deeper.

Best, Stefanie