Answers.Body: <p>You can use the "manual network construction" approach. Calculate TOM, then use <code>exportNetworkToCytoscape</code> or <code>exportNetworkToVisANT</code> to export the network (or simply save the TOM matrix as a table and load it in Python). </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-16T21:53:31.933Z
Answers.Text: I tried doing `exportNetworkToCytoscape(TOM)`, but I get `Error in exportNetworkToCytoscape(TOM) : 
    Cannot determine node names: nodeNames is NULL and adjMat has no dimnames.` How can you let it just use the names that were used when creating the graph?
Answers.UserDisplayName: An Ignorant Wanderer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-17T22:08:31.967Z
Answers.Text: Supply the names in the argument `nodeNames`.
Answers.UserDisplayName: Peter Langfelder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-18T03:36:30.780Z
Answers.Text: So I did as suggested, I ran the command `exportNetworkToCytoscape(TOM, nodeNames = names(datExpr), edgeFile = "edges.csv", nodeFile = "nodes.csv")` but I'm curious about the result. edges.csv seems to have been populated correctly (though I'm not 100% sure, there are 5237 edges, which sounds reasonable), but nodes.csv not so much. In particular, the nodes.csv file has only 151 node entries, but I'm not sure why, since in the tutorial there are 3600 genes and so I expected 3600 entries.
Answers.UserDisplayName: An Ignorant Wanderer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-19T04:31:58.373Z
Answers.Text: If you want the entire network, you also need to set argument threshold to zero. otherwise you will only get edges whose weight are above the (default) value of threshold which is 0.5. Just be prepared to see large edge file.
Answers.UserDisplayName: Peter Langfelder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-16T18:40:51.517Z
Answers.LastActivityDate: 2020-05-16T18:40:51.517Z
Answers.UserDisplayName: Peter Langfelder
Body: <p>I am following the <a href="https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/Consensus-NetworkConstruction-auto.pdf" rel="nofollow noreferrer">tutorials</a> on the WGCNA website for creating a coexpression network. It is taking way too long. Is there a way to speed up execution? All I need is to create the co-expression graph. I will then export to Python and do my analysis there. 
  In particular, the step "calculating module eigengenes" is taking a lot of time. I do not really care about the modules. All I want is the graph with the genes and the weighted edges. </p>
  
Tags: <wgcna>
Title: Speeding up network creation in WGCNA
ThreadText: # Speeding up network creation in WGCNA
  
  (Asked by: username_0 on 2020-05-16)
  
  I am following the [tutorials](https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/Consensus-NetworkConstruction-auto.pdf) on the WGCNA website for creating a coexpression network. It is taking way too long. Is there a way to speed up execution? All I need is to create the co-expression graph. I will then export to Python and do my analysis there.
  In particular, the step "calculating module eigengenes" is taking a lot of time. I do not really care about the modules. All I want is the graph with the genes and the weighted edges.
  
  **Tags:** wgcna
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-05-16. Score: 1 | Accepted answer
  
  You can use the "manual network construction" approach. Calculate TOM, then use `exportNetworkToCytoscape` or `exportNetworkToVisANT` to export the network (or simply save the TOM matrix as a table and load it in Python).
  
  > **Comments:**
  > **username_0**: I tried doing `exportNetworkToCytoscape(TOM)`, but I get `Error in exportNetworkToCytoscape(TOM) :    Cannot determine node names: nodeNames is NULL and adjMat has no dimnames.` How can you let it just use the names that were used when creating the graph?  
  > **username_1**: Supply the names in the argument `nodeNames`.  
  > **username_0**: So I did as suggested, I ran the command `exportNetworkToCytoscape(TOM, nodeNames = names(datExpr), edgeFile = "edges.csv", nodeFile = "nodes.csv")` but I'm curious about the result. edges.csv seems to have been populated correctly (though I'm not 100% sure, there are 5237 edges, which sounds reasonable), but nodes.csv not so much. In particular, the nodes.csv file has only 151 node entries, but I'm not sure why, since in the tutorial there are 3600 genes and so I expected 3600 entries.  
  > **username_1**: If you want the entire network, you also need to set argument threshold to zero. otherwise you will only get edges whose weight are above the (default) value of threshold which is 0.5. Just be prepared to see large edge file.  
  
  ---
  
  