Re: How to export graph from cytoscape to JSON?

593 views
Skip to first unread message

Alexander Pico

unread,
Oct 25, 2012, 1:08:01 PM10/25/12
to cytoscap...@googlegroups.com
Hi Peter,

It's still on the to-do list. That GSoC project hasn't been picked up yet. It's available as a mentored project year-round through our NRNB Academy program if you (or anyone else) is interested in taking it on: 


One of the main reasons it's on our list is for better communication from cytoscape to cytoscape.js, you're right. But as far as I know, it hasn't been implemented yet.

 - Alex


On Thursday, October 18, 2012 1:45:17 PM UTC-7, Peter wrote:
Dear cytoscape-discuss,

I am trying to help my biologist friend make d3.js visualizations from cytoscape network data.
What's the easiest way to get the network into JSON ?

I'm a bit surprised this information is hard to find: don't the cytoscape.js use JSON??

A JSON export plugin was proposed for google Summer of Code 2012, but I dunno if it went anywhere:
https://groups.google.com/d/topic/cytoscape-discuss/J-z3IHHpCto/discussion

Do I do it with a javascript plugin: http://wiki.cytoscape.org/ScriptingPlugins#Accessing_Cytoscape_Objects

Help?

Thanks!

Max Franz

unread,
Oct 26, 2012, 2:43:43 PM10/26/12
to cytoscap...@googlegroups.com
Though I definitely agree it would be great to have more collaborators on Cytoscape -- as Alex has mentioned -- here is an alternative that may help guide you if you need to do this quickly:
  • Export the networks in a simple-to-parse format, like SIF.
  • In your JavaScript code, parse the exported networks -- creating a resultant JavaScript object for each one that can be read in by d3.js, Cytoscape.js, or similar.
All the best,
Max
--
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/-/kmxlrLZCow8J.
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.

Keiichiro Ono

unread,
Oct 26, 2012, 3:14:39 PM10/26/12
to cytoscap...@googlegroups.com
Hi everyone.

One of my students is working on project related to this topic.

https://github.com/idekerlab/cyto-bridge/tree/develop

Currently, his code is pushing igraph's "graph" data structure from R
as JSON. And he've just started to work on the opposite direction:
send CyNetwork and CyTables in JSON (GraphSON) via HTTP.

https://github.com/tinkerpop/blueprints/wiki/GraphSON-Reader-and-Writer-Library

This is for Cytoscape 3, but some sort of prototype will be available
by the end of this quarter.

Thanks,
Kei

2012/10/26 Max Franz <maxk...@gmail.com>:
--
Keiichiro Ono http://www.keiono.net/

Peter

unread,
Oct 31, 2012, 11:32:25 AM10/31/12
to cytoscap...@googlegroups.com
Exported as SIF and parse with JavaScript was the answer I was looking for.

Thanks a lot, Max

elahe kamaliha

unread,
Apr 16, 2014, 3:58:30 PM4/16/14
to cytoscap...@googlegroups.com
Hi Kei,

is this project working now? 

I need to convert my graph (adj list/matrix) to json to be used with cytoscape.js . I've tried RJSON, not functioning as it should. Do you think your student's code give me this functionality?


Thanks a lot,
Ela 

Keiichiro Ono

unread,
Apr 16, 2014, 4:32:14 PM4/16/14
to cytoscap...@googlegroups.com
Hi Ela.

Yes, this feature is available in Cytoscape 3.1.0 (latest version).
If you need to export your Cytoscape 3 networks into Cytoscape.js
JSON, you just need to select File-->Export-->Network and View...

If your original data file is an adj. matrix, you need to convert it
into Cytoscape compatible format first. If you use R, something like:

g <- as.matrix(read.table(your_matrix_file.txt))
write.graph(g, "myGraph.txt" format="edgelist")

and then you can read the generated file into Cytoscape.

Kei
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cytoscape-disc...@googlegroups.com.
>
> To post to this group, send email to cytoscap...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cytoscape-discuss.
> For more options, visit https://groups.google.com/d/optout.



--
Keiichiro Ono http://keiono.github.io/

elahe kamaliha

unread,
Apr 16, 2014, 5:04:26 PM4/16/14
to cytoscap...@googlegroups.com
Thanks Kei,

I guess my question wasn't clear. I don't want to export JSON from Cytscape. 

I have my data file (in adj matrix and adj list format) and I want to send it as input to Cytsocape.js (that is, JSON format). I'm using R Shiny package as web service. 


Ela

Keiichiro Ono

unread,
Apr 16, 2014, 5:21:05 PM4/16/14
to cytoscap...@googlegroups.com
Hi.

The procedure in my last e-mail is exactly what you need. Basically,
you need desktop version of Cytoscape to generate cytoscape.js data
(without coding). The steps are:

1. Prepare adj. matrix data as file
2. Load it into R/igraph
3. Export it as Edge list/GraphML/etc.
4. Load them into Cytoscape 3.1.0
5. Export as Cytoscape.js JSON
6. Load into Cytoscape.js


Kei

elahe kamaliha

unread,
Apr 16, 2014, 5:31:52 PM4/16/14
to cytoscap...@googlegroups.com
Oh I see. I thought it is not that difficult (a little coding is ok for me) to do it without going through Desktop Version of Cytoscape...

The reason I am avoiding desktop version is that, there is no R package to connect to cytscape 3x currently. 

Thank you,
Ela


You received this message because you are subscribed to a topic in the Google Groups "cytoscape-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cytoscape-discuss/qTnKTUS_q2w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cytoscape-disc...@googlegroups.com.

To post to this group, send email to cytoscap...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-discuss.
For more options, visit https://groups.google.com/d/optout.



--
Elahe

Keiichiro Ono

unread,
Apr 16, 2014, 5:45:11 PM4/16/14
to cytoscap...@googlegroups.com
Hi Ela.

> The reason I am avoiding desktop version is that, there is no R package to
> connect to cytscape 3x currently.

Literally, I'm working on the project right now on my machine :)
Eventually, you can access Cytoscape 3 directly via REST in
programmer-friendly way, like:

GET http://localhost:1234/networks/1234 (Get network with SUID 1234 as JSON)
POST http://localhost:1234/networks (Create new network from
Cytoscape.js JSON by posting it)

etc.

This is my main project now, and if you are interested in as an early
adopter, please let me know.

Thanks,
Kei
Reply all
Reply to author
Forward
0 new messages