I'm facing a challenge regarding the extraction of co-expressing genes from each module. After identifying modules, I've been using exportNetworkToCytoscape to visualize genes that co-express together. However, I solely seek the p-values of the co-expressed genes in each module, similar to the format below:

fromNode        toNode      corr-value      p-value
ENSG234        ENSG567       0.90           0.001
ENSG987        ENSG456       0.55           0.03

While the exported data provides useful information such as "fromNode," "toNode," "weight", it lacks the p-values (more important) and corr-value I require for my analysis.

I attempted to use tomSimilarityFromExpr with 'corType = "pearson"' to calculate pairwise correlations between genes, but I'm uncertain about the subsequent steps to obtain the desired p-values. My goal is to export the co-expression genes of each module, as facilitated by exportNetworkToCytoscape, while also having the corresponding p-values for these co-expressed genes within each module. I'm not interested in linking the modules to external variables; rather, I solely seek the p-values of the co-expressed genes in each module.

Even if there is another way to obtain what I want without going through tomSimilarityFromExpr and exportNetworkToCytoscape, this suggestion would be welcome!

Could you kindly offer guidance on how to proceed in obtaining this information? Thanks in advance!


1 Answer 1


The simplest way is to calculate the correlation matrix of genes in the module you want and use that as input to exportNetworkToCytoscape. Something like this:

inMod = moduleColors=="blue"  ## replace 'blue' with the color or module label you want
modExpr = datExpr[, inMod];
modCor = cor(modExpr)
cytoData = exportNetworkToCytoscape(modCor, threshold = 0, ...)
## Replace ... above with appropriate arguments

Then add the p-values to the edge data frame returned within cytoData using function corPvalueStudent, for example as

edgeDF = cytoData$edgeData
nSamples = nrow(datExpr);
edgeDF$pValue = corPvalueStudent(edgeDF$weight, nSamples)

You can then manipulate the correlations and p-values further as necessary, e.g. export them into a csv file.

  • $\begingroup$ Thank you, @Peter. I will try your method, and if it works well, I'll come back to let you know. Thank you in advance. $\endgroup$
    – Mozart
    Feb 18 at 14:21
  • $\begingroup$ @Mozart simply mark as "accepted" if this post has been helpful. This looks like good network theory BTW. $\endgroup$
    – M__
    Feb 18 at 16:13
  • $\begingroup$ Thanks Peter, everything seems to work fine! $\endgroup$
    – Mozart
    Feb 18 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.