Re: [Cytoscape-discuss] import a matrix to cytoscape

113 views
Skip to first unread message

Scooter Morris

unread,
Sep 27, 2012, 11:37:40 AM9/27/12
to cytoscap...@googlegroups.com, yazdan asgari
On 09/25/2012 12:53 PM, yazdan asgari wrote:
Dear Friends

I want to import matrix data from an excel file (i.e. each cell (i,j) contains a value 0 or non-zero which demonstrates edge between node (i,j) ) to Cytoscape for further analysis. Could you please help me how could I write a small script (for example in Matlab) to convert an excel file to a sif file format? or is there any plugin I could use for doing so?

Best regards
Yazdan --
You received this message because you are subscribed to the Google Groups "cytoscape-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cytoscape-discuss/-/ydDTS3F1nTMJ.
To post to this group, send email to cytoscap...@googlegroups.com.
To unsubscribe from this group, send email to cytoscape-disc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cytoscape-discuss?hl=en.
Hi Yazdan,
    This is something that's been requested before, and we'll certainly provide something to do this easier in the future, but the sif format file is pretty easy and a script would be easy to write.  If you take your example, here is some pseudo-code:

for (int row=0; row<nrows; row++) {
    for (int col=0; col<ncols; col++) {
        print row+" "+col+" "+cell(row,col);
    }
}

If, in your case cell(i,j) = cell(j,i), then you can change the second line to: for (int col=0; col < row; col++) to avoid getting duplicate edges.  Note that this is *not* a sif format file.   Sif files don't support attributes, so you would read this file in using the Import Network from table.

Hope this helps!

-- scooter

Reply all
Reply to author
Forward
0 new messages