smorabit / hdWGCNA

High dimensional weighted gene co-expression network analysis
https://smorabit.github.io/hdWGCNA/
Other
346 stars 34 forks source link

ConstructNetwork() and ModuleEigengenes() functions use different methods to calculate the ME (module eigengene), leading to the discrepancy in the kME result #266

Open erlun1 opened 4 months ago

erlun1 commented 4 months ago

Thank you very much for developing the hdWGCNA package. However, I have encountered an issue with the conflicting ME (module eigengene) and kME (module membership) values during the module identification process.

Firstly, in the ConstructNetwork function, you use the default WGCNA::blockwiseConsensusModules function. I have set the minCoreKME and minKMEtoStay parameters to 0.5 and 0.2, respectively. However, when I ran the ModuleConnectivity function to calculate the gene kME values, the minimum kME value was 0.02, which does not meet my set threshold.

After reviewing the source code, I found that the blockwiseConsensusModules function calls the WGCNA::multiSetMEs function, which in turn calls the WGCNA::moduleEigengenes function to calculate the module eigengenes (ME). This is where the discrepancy arises, as I noticed that the hdWGCNA::ModuleEigengenes function uses the Seurat RunPCA method instead.

Since the kME calculation is a simple correlation (cor function + Pearson correlation), the difference in the results is due to the ME value calculation. The inconsistency in the ME calculation methods between the WGCNA and hdWGCNA packages is causing the issue, and I am unable to apply the results from the ModuleEigengenes and ModuleConnectivity functions.

I hope you can provide a solution to this problem as soon as possible. Thank you for your time and attention.

smorabit commented 4 months ago

Hi,

I think I understand your confusion. If you were following the tutorial, the network is constructed on a metacell representation of your dataset, which gives us a different gene expression matrix than your original single-cell dataset. After we construct the network, the functions ModuleEigengenes and ModuleConnectivity are used to compute the expression level of each module and the module membership of each gene in the single-cell dataset. This is not an issue, this is simply the design of the package.

erlun1 commented 4 months ago

Hi,

I am pleasantly surprised to receive your reply so quickly. I understand your point, so in order to maintain the consistency of my data, would it be possible to use the ME values calculated and stored by the ConstructNetwork function,which is constructed on the metacell representation, and the metacell gene expression matrix computed by the MetacellsByGroups function, to calculate the kME? I look forward to your response, thank you very much.

smorabit commented 3 months ago

Currently there is not a way to do this directly with hdWGCNA but you might be able to write some custom code to do this if you want to.