I am trying to export my results from WGCNA for network visualisation with visANT or Cytoscape. This step requires the topological overlap matrix (TOM) to be subset. Tutorial 6 on the WGCNA page deals with this: https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-06-ExportNetwork.pdf. I should note here that I used the blockwiseModules function to create the TOM because of the size of my RNAseq data set.
The steps in R are as follows:
# choose module module = "green" # get list of genes probes = names(datExpr) inModule = (moduleColors==module) modProbes = probes[inModule] # Select the corresponding Topological Overlap modTOM = TOM[inModule, inModule]
I get the following error:
Error in TOM[inModule, inModule] : incorrect number of dimensions
Previously it was suggested that this error might be related to loading the TOM from file, in which case it is not saved as a proper similarity matrix (https://support.bioconductor.org/p/69715/). However, following the advice in that bioconductor thread leads to another error:
TOM.mat = as.matrix(TOM) modTOM = TOM.mat[inModule, inModule] Error in TOM.mat[inModule, inModule] : (subscript) logical subscript too long
I've also run the analysis from scratch to avoid loading the TOM, and I get the same error.
length(inModule)  41047 dim(TOM.mat)  12664 12664
Any thoughts on how to get around this error?