From Distance Matrix To Network
3
2
Entering edit mode
10.6 years ago
SamGG ▴ 20

Hi,

I would like to represent the linkage (or correlation) of some data (let say genes) with Cytoscape. So I would like a way to transform a distance (or so) into a network (one-to-one links). Distance filtering is certainly needed in order to avoid a dense and ugly network graphics.

a/ is there an easy way to do such filtering and conversion with R (or Cytoscape directly)?

b/ is there a tool that allows one to move a cursor in order to change the filtering threshold and to see the resulting network?

Cheers.

distance network cytoscape • 13k views
ADD COMMENT
2
Entering edit mode
5.1 years ago

Just adding knowledge to this old question:

I have a tutorial here on Biostars in which I do this via igraph: Network plot from expression data in R using igraph

library(igraph)

#Create a graph adjacency based on correlation distances between genes in  pairwise fashion.
g <- graph.adjacency(
  as.matrix(as.dist(cor(t(estrogenMainEffects), method="pearson"))),
  mode="undirected",
  weighted=TRUE,
  diag=FALSE
)

aaa

ADD COMMENT
1
Entering edit mode
10.6 years ago
Leandro Lima ▴ 970

Hello!

An example with a matrix 5x5:

M <- matrix(rnorm(25), nrow=5)
colnames(M) <- letters[1:5]
rownames(M) <- letters[1:5]
edges <- NULL
for (i in 1:nrow(M)) {
    for (j in 1:ncol(M)) {
        edges <- rbind(edges, c(rownames(M)[i], rownames(M)[j], M[i,j]))
    }
}

colnames(edges) <- c('node1', 'node2', 'value')
write.table(edges, 'edges.txt', row.names=FALSE, quote=FALSE, sep='\t')

After this, it is possible to use Cytoscape to load 'edges.txt' and its filters to remove the edges according to a threshold.

ADD COMMENT
1
Entering edit mode
10.6 years ago
Woa ★ 2.9k

I guess you'll be using the distance between the nodes as edge weights. In that case you can filter edges based on their weights which in this case is the distance.

ADD COMMENT

Login before adding your answer.

Traffic: 3480 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