How have I ended up with a non-square adjacency matrix: 

It is something like this -

> m<-matrix(rnorm(1000),nrow=100,ncol=10,dimnames=list(paste("met",c(1:100))))
> g<-matrix(rnorm(10000),nrow=1000,ncol=10,dimnames=list(paste("gen",c(1:1000))))
> cm<-cm <- cor(t(m),t(g))
> cm<-cor(t(m),t(g))
> ADJ<-ifelse(c(cm)>0.75,1,0)
> dim(ADJ)<-dim(cm)
> str(ADJ)
 num [1:100, 1:1000] 0 0 0 0 0 0 0 0 0 0 ...

Now need to convert the ADJ to a edge list or sif. I have tried igraph package. But, it can convert square Adjacency matrix to edge list or a graphNEL object. Is there a way that I can convert my non square AM to a graph object or edge list ?
 
Pankaj 


________________________________
 From: "Tim Triche, Jr." <tim.triche@gmail.com>

Cc: "bioconductor@r-project.org" <bioconductor@r-project.org> 
Sent: Saturday, 24 March 2012 9:08 PM
Subject: Re: [BioC] Adjacency to network using R


How have you ended up with a non-square adjacency matrix?  (can it be made square by adding additional columns/rows set to 0?)


Alternatively, why not enumerate and add the edges between nodes for all [N,M] such that mat[n,m] != 0. 
(see the RCytoscape vignette for more on this and export functions)




 wrote:

Thanks Tim,
>
>Yes you are true if the adjacency matrix is a square matrix (NxN). But my adjacency is non square NxM matrix. 
>
>
>Regards, Pankaj
>
>
>
>________________________________
> From: "Tim Triche, Jr." <tim.triche@gmail.com>

>Cc: "bioconductor@r-project.org" <bioconductor@r-project.org> 
>Sent: Saturday, 24 March 2012 6:16 PM
>Subject: Re: [BioC] Adjacency to network using R
> 
>
>
>doesn't RCytoscape take a graphNEL object as input for some routines?  In Paul Shannon's workshop I seemed to remember this being the case (look at the materials from Bioc2011, there should be a bunch of examples).  Adjacency matrices are almost always much smaller when represented as adjacency lists, and a graphAM can be coerced to a graphNEL for the purpose you wish.
>
>
>R> library(graph)
>R> class?graphAM
>R> class?graphNEL
># say your adj. matrix is in matrix 'mat'
>R> graphmat <- new("graphAM", adjMat=mat, edgemode='directed')
>R> graphlist <- as(graphmat, 'graphNEL')
>
>
># now from the vignette:
>R> library(RCytoscape)
>R> cw <- new.CytoscapeWindow ('vignette', graph=graphlist)
>R> displayGraph(cw)
>
>
>Is that the sort of thing you were thinking of ?
>
>
>
>
>

 wrote:
>
>Hi All, 
>>
>>
>>Can anyone help me with how to convert an adjacency matrix of (NxM) dimension  to cytoscape 
>>input file (edge list, SIF etc) using R ? 
>>
>>
>>Consider an adjacency of  5x10 dimension , where rows are genes and columns are metabolite(or vice versa). Now if I want to import it to any network visualization software how can I do that ?
>>
>>
>>Thanks, 
>> 
>>Pankaj 
>>       [[alternative HTML version deleted]]
>>
>>
>>_______________________________________________
>>Bioconductor mailing list
>>Bioconductor@r-project.org
>>https://stat.ethz.ch/mailman/listinfo/bioconductor
>>Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>>
>
>
>
>-- 
>A model is a lie that helps you see the truth.
>
>
>Howard Skipper
>
>
>


-- 
A model is a lie that helps you see the truth.


Howard Skipper
	[[alternative HTML version deleted]]

