Question: From Distance Matrix To Network
2
gravatar for SamGG
5.6 years ago by
SamGG20
France
SamGG20 wrote:

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.

network cytoscape distance • 4.9k views
ADD COMMENTlink modified 6 weeks ago by Kevin Blighe41k • written 5.6 years ago by SamGG20
1
gravatar for Leandro Lima
5.6 years ago by
Leandro Lima920
San Francisco, CA
Leandro Lima920 wrote:

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 COMMENTlink written 5.6 years ago by Leandro Lima920
0
gravatar for Woa
5.6 years ago by
Woa2.7k
United States
Woa2.7k wrote:

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 COMMENTlink written 5.6 years ago by Woa2.7k
0
gravatar for Kevin Blighe
6 weeks ago by
Kevin Blighe41k
Kevin Blighe41k wrote:

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 COMMENTlink modified 6 weeks ago • written 6 weeks ago by Kevin Blighe41k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 731 users visited in the last hour