Murali-group / CyGraphSpace

A GraphSpace app for Cytoscape
GNU General Public License v3.0
1 stars 2 forks source link

Convert Cytoscape.js JSON style file to Cytoscape XML style file #1

Open jlaw9 opened 7 years ago

jlaw9 commented 7 years ago

According to the Cytoscape documentation for Style File Formats, Cytoscape can export XML style files and Cytoscape.js compatible JSON style files, but only imports XML style files.

I suspect a good place to start for syncing graphs between Cytoscape and GraphSpace would be to create a script (in Java) which converts the JSON style file to an XML style file. That would enable a user to manually download a graph and style from GraphSpace, convert it to XML and then import the graph and style files to Cytoscape.

That same Java code could then be used to convert the styles internally for the app.

tmmurali commented 7 years ago

@adbharadwaj @rishabhsethi Should we consider this functionality in CyGraphSpace?

tmmurali commented 7 years ago

Sorry. I see that Jeff opened this bug in CyGraphSpace!

adbharadwaj commented 7 years ago

There are two ways to solve this problem.

OPTION 1 - implement the logic to import style file in JSON format in CyGraphSpace.

OPTION 2 - implement the logic to export style file in XML format in Graphspace.

I would choose option 1. This will be a great feature to have in CyGraphSpace.

In order to find out how to parse Json style files in CyGraphSpace code, we need to read through Cytoscape code for importing graph structure from Json file and Cytoscape code for importing style from XML file. My intuition is that they will have a class for style and all we need to do is implement a function that will parse Json style files and creates an object of this style class.

On Jun 8, 2017 12:44 AM, "T. M. Murali" notifications@github.com wrote:

@adbharadwaj https://github.com/adbharadwaj @rishabhsethi https://github.com/rishabhsethi Should we consider this functionality in CyGraphSpace?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/Murali-group/CyGraphSpace/issues/1#issuecomment-306896483, or mute the thread https://github.com/notifications/unsubscribe-auth/ADUeBwyHD7XwXIvp8pPqk2eWaXDQLIfuks5sBvaXgaJpZM4NzIzO .

rishabhsethi commented 7 years ago

Cytoscape should have an API to add style to the graph manually. So we should be able to parse the JSON file and add the style parameters. I'll try to implement this and get back.

tmmurali commented 7 years ago

@rishabhsethi Thanks for offering to implement this functionality. You do not need to work on this issue right away. I suggest you add it to your timeline sometime later in the summer. Getting the core functionality implemented first is more important.