I have a dataframe in R, the columns being Gene names and the rows being Isolate names. The value in each column can be 1 or 0, 1 for "Gene is present in Isolate" and 0 for "Gene not present in Isolate". So all in all, the dataframe shows in one-zero fashion which Isolate has which genes.
Now I want to do a network analysis to see which genes are most likely to co-occur, assess the strength of their connection and so on.
In R, I have tried the following:
>library(igraph) >library(network) >library(sna) >library(ndtv) >Genematrix <- data.matrix(df) >g <- network(Genematrix, directed=FALSE) > summary(g) >plot(g)
What I get from this is a network object with 236 vertices. But what I actually want is the Genes as vertices ( 21 columns), so I can see the clusters and connections between them. In many tutorials I have seen that I need and edge list and a node list. the edge list is I think what I get from >g <- network(Genematrix, directed=FALSE), but I don't know how to get the node list.
Can anyone explain how to solve my problem and what I have to do to get the network I want?
Works, thank you! I'll read up on the why :-)