Network Visualization WGCNA
1
0
Entering edit mode
4.2 years ago

Hi, I have done a WGCNA with all typical graphics. Now, I want to do the network visualization using the adjacency matrix to visualize it, but I don't know how I can do it. I know that I have to use the igraph, network and networkD3 packages but I don't know which is the code that I have to put in R.

If someone can help me I would be very grateful.

Thanks

RNA-Seq WGCNA • 4.6k views
ADD COMMENT
1
Entering edit mode
4.2 years ago

Please take a look here: A: Exporting WGCNA step-to-step network construction objects into igraph object

Once you have your WGCNA data as an igraph object, plotting the network is as simple as using the base plot() function.

Kevin

ADD COMMENT
0
Entering edit mode

Ok, thanks for the link that you bring me it's very useful. I follow the same steps like in the link and I have the network construction, but I don't know what it means each color (red, blue, grey) and how interpretate this network.

Also I don't understand why he transform the adjacency matrix into 0 and 1, I mean I don't understand the following steps:

First, he do this:

adjacency[adjacency < 0] = 0 adjacency[adjacency > 1] = 1

and then he do:

adj[adj > 0.1] = 1 adj[adj != 1] = 0

If you can explain me I would be very grateful

Thanks for your attention

ADD REPLY
0
Entering edit mode

Those steps just indirectly result in edges being removed. When you create a graph object in igraph, everything is connected to everything; so, you have to decide which edges to remove, and which to keep. Those steps mean that any edge with adjacency > 0.1 will be retained.

I think that the colours relate to the original WGCNA modules. They are assigned in the line:

V(network)$color <- results$colors

I have more 'advanced' code here, which can help you to do a network analysis independently of WGCNA: Network plot from expression data in R using igraph

ADD REPLY
0
Entering edit mode

Hi Mr Blighe, thanks for the information. I have tried your tutorial in my own data and it’s amazing, it runs fantastic. After analyse the code I have some doubts. The main doubt is why you put “weight” when you do the negative, positive colors correlations, what it means “weight”, what do?

The second doubt I have is, what do the function(x)? And why do you put (x-min(x))/(max(x)-min(x)?

Finally, when I saw my graphics I observed that is a samples aggregation of my data, this code shows you the samples aggregation but if I want to see the genes aggregation of my samples what code/tutorial I should follow?

Thank for your dedication,

Silvia

ADD REPLY
1
Entering edit mode

Hello (Ciao?) Silvia,

The main doubt is why you put “weight” when you do the negative, positive colors correlations, what it means “weight”, what do?

'weight', in this context, relates to the Pearson correlation value between any two vertices (genes). This is due to the fact that the initial network was created from a distance matrix of Pearson correlation values, via:

as.matrix(as.dist(cor(t(estrogenMainEffects), method="pearson")))

In other situations, 'weight' may relate to Euclidean distances, or something else. Positive correlations are then encoded as red, while negative correlations are blue.

The second doubt I have is, what do the function(x)? And why do you put (x-min(x))/(max(x)-min(x)?

This function scales the vertex sizes to be between 0 and 1. It ultimately means that genes that have higher expression will have larger vertices. Here is an example:

x <- data.frame(a = c(1,2,3), b = c(4,5,6))
x
  a b
1 1 4
2 2 5
3 3 6

(x-min(x))/(max(x)-min(x))
    a   b
1 0.0 0.6
2 0.2 0.8
3 0.4 1.0

Finally, when I saw my graphics I observed that is a samples aggregation of my data, this code shows you the samples aggregation but if I want to see the genes aggregation of my samples what code/tutorial I should follow?

For this, you just need to transpose your input data, via t()

ADD REPLY
1
Entering edit mode

Ok, I understand!

Thank you for all,

Silvia

ADD REPLY

Login before adding your answer.

Traffic: 2350 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6