GraphML import

369 views
Skip to first unread message

Peter Clarke

unread,
Jul 24, 2014, 5:27:13 PM7/24/14
to cytoscape...@googlegroups.com
I have exported a GrapML which contains node attributes from the python NetworkX library. Not all nodes contain all attributes. When I try to import this into Cytoscape it fails because of this. 

Is there any way I can either specify a null value in the GraphML file that will not cause the type checking to default to the wrong data type (NaN or null for example) or have some other way around this?

Thanks! 

-Peter

Samad Lotia

unread,
Jul 31, 2014, 12:21:32 PM7/31/14
to cytoscape...@googlegroups.com
Hi Peter,

I also tried the NetworkX's GraphML exporter and had problems, e.g. Unicode serialization and no support for list attributes. I wrote my own Python function which takes a NetworkX graph and exports it to an XGMML file, which Cytoscape accepts. Here's the Github Gist: https://gist.github.com/samadlotia/8c987acb4de07ed86fba

It should support node attributes without values. It only serializes node attributes of type int, string, and lists. Hopefully this meets your needs.

Samad

Keiichiro Ono

unread,
Aug 2, 2014, 4:09:13 AM8/2/14
to cytoscape...@googlegroups.com
If you are working with NetworkX, an alternative is export networks &
attributes as Cytoscape.js style JSON.

http://nbviewer.ipython.org/github/keiono/cytoscape-ipy/blob/master/CytoscapeREST_Basics.ipynb

This example is used for my ongoing project (REST API module for
Cytoscape 3), but file-based import is already available for Cytoscape
3.1.1. And building JSON object is very straightforward:

https://github.com/keiono/cytoscape-ipy/blob/master/cytoscape/viewer.py#L63

Kei
> --
> You received this message because you are subscribed to the Google Groups
> "cytoscape-helpdesk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cytoscape-helpd...@googlegroups.com.
> To post to this group, send email to cytoscape...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cytoscape-helpdesk.
> For more options, visit https://groups.google.com/d/optout.



--
===================================

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

===================================
Reply all
Reply to author
Forward
0 new messages