Author: clopes
Date: 2012-08-27 13:41:23 -0700 (Mon, 27 Aug 2012)
New Revision: 30277
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
Log:
Cy2 session loading: Moving "__externalEdges.SUID" column (groups metadata)
from the CyRootNetwork's hidden table to the network pointer's one.
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
2012-08-27 15:49:49 UTC (rev 30276)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
2012-08-27 20:41:23 UTC (rev 30277)
@@ -488,42 +488,45 @@
+ "\" to the expected
sub-network, because it does not contain the source or target node." +
" Will try to add the edge to
the root-network instead.");
- net = getRootNetwork();
+ final CyRootNetwork rootNet = getRootNetwork();
if (actualSrc == null)
- actualSrc = net.getNode(source.getSUID());
+ actualSrc = rootNet.getNode(source.getSUID());
if (actualTgt == null)
- actualTgt = net.getNode(target.getSUID());
+ actualTgt = rootNet.getNode(target.getSUID());
// Does the current subnetwork belong to a 2.x group?
if (getDocumentVersion() < 3.0 &&
!compoundNodeStack.isEmpty() && networkStack.size() > 1) {
// Get the current compound node
final CyNode grNode = compoundNodeStack.peek();
// Get the network of that node (the current
one is its network pointer)
- final CyNetwork grNet =
cache.getNetwork(networkStack.elementAt(networkStack.size() - 2));
+ final CyNetwork parentNet =
cache.getNetwork(networkStack.elementAt(networkStack.size() - 2));
// Check for the group's metadata attribute
- final CyRow grhRow = grNet.getRow(grNode,
CyNetwork.HIDDEN_ATTRS);
+ final CyRow gnhRow = parentNet.getRow(grNode,
CyNetwork.HIDDEN_ATTRS);
- if (grhRow.isSet(GROUP_STATE_ATTRIBUTE)) { //
It's a group!
+ if (gnhRow.isSet(GROUP_STATE_ATTRIBUTE)) { //
It's a group!
+ // Get the network pointer's hidden row
+ final CyRow nphRow = net.getRow(net,
CyNetwork.HIDDEN_ATTRS);
+
// Add extra metadata for external
edges, so that the information is not lost
- final CyRow rnRow =
getRootNetwork().getRow(grNode, CyNetwork.HIDDEN_ATTRS);
-
- if
(rnRow.getTable().getColumn(EXTERNAL_EDGE_ATTRIBUTE) == null) {
-
rnRow.getTable().createListColumn(EXTERNAL_EDGE_ATTRIBUTE, Long.class, false);
+ if
(nphRow.getTable().getColumn(EXTERNAL_EDGE_ATTRIBUTE) == null) {
+
nphRow.getTable().createListColumn(EXTERNAL_EDGE_ATTRIBUTE, Long.class, false);
// These are already the new
SUIDs. Let's tell the SUIDUpdater to ignore this column,
// in order to prevent it from
replacing the correct list by an empty one.
-
suidUpdater.ignoreColumn(rnRow.getTable(), EXTERNAL_EDGE_ATTRIBUTE);
+
suidUpdater.ignoreColumn(nphRow.getTable(), EXTERNAL_EDGE_ATTRIBUTE);
}
- extEdgeIds =
rnRow.getList(EXTERNAL_EDGE_ATTRIBUTE, Long.class);
+ extEdgeIds =
nphRow.getList(EXTERNAL_EDGE_ATTRIBUTE, Long.class);
if (extEdgeIds == null) {
extEdgeIds = new
ArrayList<Long>();
-
rnRow.set(EXTERNAL_EDGE_ATTRIBUTE, extEdgeIds);
+
nphRow.set(EXTERNAL_EDGE_ATTRIBUTE, extEdgeIds);
}
}
}
+
+ net = rootNet;
}
edge = net.addEdge(actualSrc, actualTgt, directed);
Modified:
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
2012-08-27 15:49:49 UTC (rev 30276)
+++
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
2012-08-27 20:41:23 UTC (rev 30277)
@@ -404,16 +404,15 @@
assertEquals(1, np.getEdgeCount());
// Check if the nested graph's attribute was imported to the
network pointer
- CyRow grNetrow = np.getRow(np);
- assertEquals("Lorem Ipsum", grNetrow.get("gr_att_1",
String.class));
+ CyRow npRow = np.getRow(np);
+ assertEquals("Lorem Ipsum", npRow.get("gr_att_1",
String.class));
// Check external edges metadata (must be added by the reader!)
- CyRootNetwork rootNet = rootNetworkMgr.getRootNetwork(np);
- CyRow rnRow = rootNet.getRow(gn, HIDDEN_ATTRS);
- List<Long> extEdgeIds =
rnRow.getList(ReadDataManager.EXTERNAL_EDGE_ATTRIBUTE, Long.class);
-
- assertNotNull(extEdgeIds);
+ CyRow nphRow = np.getRow(np, HIDDEN_ATTRS);
+ List<Long> extEdgeIds =
nphRow.getList(ReadDataManager.EXTERNAL_EDGE_ATTRIBUTE, Long.class);
assertEquals(1, extEdgeIds.size());
+
+ CyRootNetwork rootNet = rootNetworkMgr.getRootNetwork(np);
assertNotNull(rootNet.getEdge(extEdgeIds.get(0)));
return gn;
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.