Author: clopes
Date: 2013-01-18 12:39:53 -0800 (Fri, 18 Jan 2013)
New Revision: 31059
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy2SessionReaderImpl.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
Log:
Fixes #1691 (Parent network not loaded in 3.0 from 2.8 generated session file)
: Also making sure stale values for network attribute "Cy2 Parent Network.SUID"
are removed when a Cy2 session is loaded.
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy2SessionReaderImpl.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy2SessionReaderImpl.java
2013-01-18 19:12:20 UTC (rev 31058)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/session/Cy2SessionReaderImpl.java
2013-01-18 20:39:53 UTC (rev 31059)
@@ -83,8 +83,9 @@
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyRow;
-import org.cytoscape.model.subnetwork.CyRootNetwork;
+import org.cytoscape.model.CyTable;
import org.cytoscape.model.subnetwork.CyRootNetworkManager;
+import org.cytoscape.model.subnetwork.CySubNetwork;
import org.cytoscape.property.CyProperty;
import org.cytoscape.property.SimpleCyProperty;
import org.cytoscape.property.bookmark.Bookmarks;
@@ -309,18 +310,25 @@
for (int i = 0; i < netArray.length; i++) {
// Process each CyNetwork
- CyNetwork net = netArray[i];
- String netName =
net.getRow(net).get(CyNetwork.NAME, String.class);
+ final CyNetwork net = netArray[i];
+ final String netName =
net.getRow(net).get(CyNetwork.NAME, String.class);
networkLookup.put(netName, net);
// Add parent network attribute, to preserve
the network hierarchy info from Cytoscape 2.x
- if (parent != null && !(parent instanceof
CyRootNetwork)) {
- CyRow row = net.getRow(net);
-
- if
(row.getTable().getColumn(CY2_PARENT_NETWORK_COLUMN) == null)
-
row.getTable().createColumn(CY2_PARENT_NETWORK_COLUMN, Long.class, false);
-
- row.set(CY2_PARENT_NETWORK_COLUMN,
parent.getSUID());
+ final CyRow row = net.getRow(net,
CyNetwork.LOCAL_ATTRS);
+ final CyTable tbl = row.getTable();
+
+ if (parent instanceof CySubNetwork &&
tbl.getColumn(CY2_PARENT_NETWORK_COLUMN) == null)
+
tbl.createColumn(CY2_PARENT_NETWORK_COLUMN, Long.class, false);
+
+ if (tbl.getColumn(CY2_PARENT_NETWORK_COLUMN) !=
null) {
+ if (parent instanceof CySubNetwork) {
+
row.set(CY2_PARENT_NETWORK_COLUMN, parent.getSUID());
+ } else {
+ // Remove the column to prevent
stale values
+ // (e.g. the user imported a
Cy3 XGMML that contains this attribute into Cy2)
+
tbl.deleteColumn(CY2_PARENT_NETWORK_COLUMN);
+ }
}
// Restore node/edge selection
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
2013-01-18 19:12:20 UTC (rev 31058)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
2013-01-18 20:39:53 UTC (rev 31059)
@@ -46,7 +46,7 @@
case REAL:
if (value != null) {
if (SUIDUpdater.isUpdatable(name))
- typedValue = Long.valueOf(value);
+ typedValue =
Double.valueOf(value).longValue();
else
typedValue = Double.valueOf(value);
}
--
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.