dondi / GRNsight

Web app and service for modeling and visualizing gene regulatory networks.
http://dondi.github.io/GRNsight
BSD 3-Clause "New" or "Revised" License
17 stars 8 forks source link

GRNsight-exported GraphML imported into yED #310

Closed kdahlquist closed 8 years ago

kdahlquist commented 8 years ago

GRNsight-exported GraphML imported into yED

more detail later...

kdahlquist commented 8 years ago

So, this is going to be tough. yED does not export into any data format, it only exports images, so it's hard to do what I did with Cytoscape to figure out what to fix.

As I noted before, GRNsight-exported GraphML can be opened by yED, but there are no labels on nodes so it's a little hard to know if it was done correctly. The right number of nodes and edges are there, but without labels, I can't check the connections.

It turns out that Cytoscape-exported GraphML also opens with no labels on the nodes, but more data is captured. There is a properties window that displays the SUID, shared name, and name. It has a field for interaction, shared interaction, and weight, but interestingly the values are not displayed.

So with a little digging, I'm finding the documentation for the yED flavor of GraphML here:

So I gather from this that we would need to add some yED-specific customizations to get the labels to show up. I'm not totally certain, but the last link in the list shows that we would be referencing a different XML schema than the regular GraphML one we are using and that this schema allows you to specify drawing instructions like the label for the node.

I don't exactly know what to do about this one. Thoughts?

We could more closely reproduce what Cytoscape is doing and conclude that we are doing at least as well as Cytoscape. Given the forum Q/A, we are not the only ones with this issue.

I note that Cytoscape is using the yFiles libraries (you can see this from the layout menu) and there's a note in the Help that says that they can't tell us what they are doing because it is proprietary...

Anyhow, that's about it for me for today. I will try to check in throughout the weekend to see if you have any questions for me.

dondi commented 8 years ago

Yes, after looking at the documentation, I agree that the y namespace of elements that they shove into the key elements completely supersedes what I’ve seen in the GraphML documents and the Cytoscape files.

One idea is to have a "kitchen sink" export—that is, export GraphML that has key elements for both Cytoscape and yED. The presumption here is that each application will know to gracefully ignore the keys that they don’t care about. This would have to be tested. Also, a "kitchen sink" export will mean that some data items are redundant, and files on average will be larger than they really need to be.

If "kitchen sink" is not desirable, then we can view yED’s flavor of GraphML as a distinct export format. At least this only affects export, since as you said yED doesn't itself export its graph as data. So the Export Data menu can perhaps say (after the SIF items):

So overall, in the interest of time, I am inclined to put this type of export in the same category as GML—we can get to it if necessary, but not as a blocker for the PeerJ response. As you observed, we can at least say that yED has the same issues importing the GraphML from both Cytoscape and GRNsight.

kdahlquist commented 8 years ago

I'm more in favor of having a "kitchen sink" solution (assuming it works upon testing) than calling out yED or Cytoscape as specific export options. I'm not going to close this issue yet, but I'm going to lower the priority.

dondi commented 8 years ago

OK, when/if we get to this we can start by creating a "kitchen sink" file manually then trying that out in both yED and Cytoscape. If that works, we can then go about revising the export routine to do this.

kdahlquist commented 8 years ago

So, I just discovered that yED can export to GraphML, it is in the "Save As..." menu instead of the "Export" menu.

I can now look and see what yED is actually doing. More to come... #321

kdahlquist commented 8 years ago

OK, I think there is still one more tweak we need to do to GRNsight GraphML export. This has come about by observing the difference between what yED imports from Cytoscape-GraphML versus GRNsight-GraphML.

When yED imports Cytoscape-GraphML, even though the node label is not showing up in the box, you can see it in the properties panel, where it shows up in the "name" field. It looks like yED is automatically reading the node attributes and populating their properties panel with the data. In fact, the bug with the for="edge" being mistakenly output as for="node" causes the edge properties to display as node properties.

When I import a GRNsight-GraphML file into yED, the weight data is displayed as an edge property, but there is no node data. So, I think if we also name our nodes, then the names will appear in the properties panel so at least the nodes can be identified that way and the user can manually update the labels in yED. So we have to define

  <key attr.name="name" attr.type="string" for="node" id="name"/>

and

  <data key="name">Node-label-goes-here</data>

I think with these changes (and #321), we've made a good effort to do what we reasonably can for interoperability between yED and GRNsight (and Cytoscape and GRNsight).

dondi commented 8 years ago

OK, this has been implemented and posted. I was not able to do an actual import into yED, but I did visually inspect an export and noted the XML elements as spec'ed above. The presence of those elements is also tested for in the unit test suite.

kdahlquist commented 8 years ago

The v1.17 beta that is posted right now won't export weighted networks to either GraphML or SIF. Unweighted networks export fine. I'll proceed with testing the unweighted ones, hopefully it's an easy fix to get the weighted ones to export again.

kdahlquist commented 8 years ago

I successfully exported an unweighted network from GRNsight to GraphML and loaded it into both Cytoscape and yED. The name showed up as expected in both programs.

I'll need to test the weighted networks before closing this.

dondi commented 8 years ago

OK, export to weighted networks is fixed now. Reload the beta page.

dondi commented 8 years ago

The issue was an unexpected interaction between exporting weighted graphs and the mouseover of weighted networks. Adding the weights to the graph did something to the network data structure that interfered with export. The unit tests unfortunately did not capture this because the weighted graph mouseover is a GUI function that we don’t have unit test support for. Ah well, unexpected consequences and all that :)

kdahlquist commented 8 years ago

OK, this checks out. Weighted networks now export and import correctly into both Cytoscape and yED.