<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>

CC BY-SA 4.0
2020-05-16T21:53:31.933Z
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?
An Ignorant Wanderer
CC BY-SA 4.0
2020-05-17T22:08:31.967Z
Supply the names in the argument `nodeNames`.
Peter Langfelder
CC BY-SA 4.0
2020-05-18T03:36:30.780Z
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.
An Ignorant Wanderer
CC BY-SA 4.0
2020-05-19T04:31:58.373Z
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.
Peter Langfelder
CC BY-SA 4.0
2020-05-16T18:40:51.517Z
2020-05-16T18:40:51.517Z
Peter Langfelder
<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>

<wgcna>
Speeding up network creation in WGCNA
# 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.  

---

