<p>For the first part, do you mean that the file is too large to be run on your computer?</p>

<p>For the second, if I understood correctly, you can use <code>igraph</code> or <code>ggnet2</code> to color code the nodes based on the conditions you have and see if communities are formed based on condition. This would be a simple way to do this kind of thing. </p>

<p>I personally prefer using <code>ggnet2</code> as I found it more user friendly. What you can do if you have an adjacency matrix, say <code>adj_mat</code> is to create a color vector based on the conditions for each node in the network, where <code>length(color_vec)</code> = <code>ncol(adj_mat)</code> = <code>nrow(adj_mat)</code> - since it is a square matrix. Following that, you could do something like this:</p>

<pre><code>library(ggplot2)
library(network)

neto &lt;- network(adj_mat, directed = FALSE, loops = FALSE, hyper = FALSE)
#assuming that it is undirected here and a simple network diagram. 
#run ?network for more details in case your analysis is to be more complex

color_vec &lt;- as.factor(color_vec)

col_pal &lt;- c("blue", "red", "green") #assuming you only have 3 colors..

names(col_pal) &lt;- levels(color_vec)
neto %v% "color" &lt;- as.character(col_vec) 

ggnet2(neto, node.size = .9, color = "color", palette = col_pal,
       edge.size = .05, edge.color = "white", mode = "adj")
</code></pre>

CC BY-SA 4.0
2019-04-04T08:14:53.410Z
I think that Cytoscape has problems with dealing with such big networks even if OP had the computational resources  needed.
llrs
CC BY-SA 4.0
2019-04-04T15:07:57.293Z
I don't have much experience with Cytoscape.. Also I have never had to create a network this large. Would it not be feasible in R?
h3ab74
CC BY-SA 4.0
2019-04-04T15:20:10.077Z
Yes, it is possible to analyse it with igraph. But in which format do you currently have the network and how do you create it?
llrs
CC BY-SA 4.0
2019-04-04T01:02:39.490Z
2019-04-04T01:02:39.490Z
h3ab74
<p>I have constructed a gene co-expression network from RNA-seq data. The network has more than 10000 nodes and more than 1 million edges.</p>

<p>The network file as an edge list format of memory around 1gb which was created by calculating Pearson correlation of each gene pairs and gene pairs having correlation greater than 95% we're selected to create the edge list. The file is too large to run in cytoscape due to limitation of computer configuration.</p>

<p>In R, I am able to calculate the topological properties of the network. And to cluster the gene coexperssion network, I tried using different community detection methods and but I am unable to identify which community detection is good for obtaining clusters?.</p>

<p>After clustering how to rank the subclusters and save each subcluster in separate files.</p>

CC BY-SA 4.0
2019-04-05T08:39:20.877Z
What kind of clustering do you want? Should the clusters be discrete (each node can only belong to a single cluster) or overlapping (each node can belong to multiple clusters)? You say you want to rank the clusters, OK, but according to what value? Cardinality? Connectedness? Something else?
terdon
CC BY-SA 4.0
2019-04-06T22:53:07.180Z
Why not just plot a direct correlation heat map? Very easy indeed via R
M__
<r><rna-seq><gene><networks><gene-expression>
Clustering of gene co-expression network by igraph R package
# Clustering of gene co-expression network by igraph R package

(Asked by: username_0 on 2019-04-03)

I have constructed a gene co-expression network from RNA-seq data. The network has more than 10000 nodes and more than 1 million edges.

The network file as an edge list format of memory around 1gb which was created by calculating Pearson correlation of each gene pairs and gene pairs having correlation greater than 95% we're selected to create the edge list. The file is too large to run in cytoscape due to limitation of computer configuration.

In R, I am able to calculate the topological properties of the network. And to cluster the gene coexperssion network, I tried using different community detection methods and but I am unable to identify which community detection is good for obtaining clusters?.

After clustering how to rank the subclusters and save each subcluster in separate files.

**Tags:** r, rna-seq, gene, networks, gene-expression
> **Comments:**
> **username_1**: What kind of clustering do you want? Should the clusters be discrete (each node can only belong to a single cluster) or overlapping (each node can belong to multiple clusters)? You say you want to rank the clusters, OK, but according to what value? Cardinality? Connectedness? Something else?  
> **username_2**: Why not just plot a direct correlation heat map? Very easy indeed via R  

---

## 1 answers

### Answer by username_3 on 2019-04-04. Score: 2

For the first part, do you mean that the file is too large to be run on your computer?
For the second, if I understood correctly, you can use igraph or ggnet2 to color code the nodes based on the conditions you have and see if communities are formed based on condition. This would be a simple way to do this kind of thing. 
I personally prefer using ggnet2 as I found it more user friendly. What you can do if you have an adjacency matrix, say adj_mat is to create a color vector based on the conditions for each node in the network, where length(color_vec) = ncol(adj_mat) = nrow(adj_mat) - since it is a square matrix. Following that, you could do something like this:
library(ggplot2)
library(network)

neto <- network(adj_mat, directed = FALSE, loops = FALSE, hyper = FALSE)
#assuming that it is undirected here and a simple network diagram. 
#run ?network for more details in case your analysis is to be more complex

color_vec <- as.factor(color_vec)

col_pal <- c("blue", "red", "green") #assuming you only have 3 colors..

names(col_pal) <- levels(color_vec)
neto %v% "color" <- as.character(col_vec) 

ggnet2(neto, node.size = .9, color = "color", palette = col_pal,
       edge.size = .05, edge.color = "white", mode = "adj")

> **Comments:**
> **username_4**: I think that Cytoscape has problems with dealing with such big networks even if OP had the computational resources  needed.  
> **username_3**: I don't have much experience with Cytoscape.. Also I have never had to create a network this large. Would it not be feasible in R?  
> **username_4**: Yes, it is possible to analyse it with igraph. But in which format do you currently have the network and how do you create it?  

---

