Author: rodche
Date: 2011-09-20 13:59:26 -0700 (Tue, 20 Sep 2011)
New Revision: 26890
Modified:
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/cytoscape/BinarySifVisualStyleUtil.java
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/task/ExecuteGetRecordByCPathId.java
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/util/NetworkGroupUtil.java
Log:
Fixed bugs in loading node/edge attributes and showing node details (in the
results panel) for PC SIF networks, etc.
Modified:
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/cytoscape/BinarySifVisualStyleUtil.java
===================================================================
---
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/cytoscape/BinarySifVisualStyleUtil.java
2011-09-20 20:56:51 UTC (rev 26889)
+++
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/cytoscape/BinarySifVisualStyleUtil.java
2011-09-20 20:59:26 UTC (rev 26890)
@@ -4,7 +4,6 @@
import java.awt.Paint;
import org.cytoscape.biopax.MapBioPaxToCytoscape;
-import org.cytoscape.biopax.util.BioPaxVisualStyleUtil;
import org.cytoscape.model.CyNode;
import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
import org.cytoscape.view.presentation.property.NodeShapeVisualProperty;
@@ -23,7 +22,6 @@
*/
public class BinarySifVisualStyleUtil {
public final static String BINARY_SIF_VISUAL_STYLE =
"Binary_SIF_Version_1";
- public final static String BINARY_NETWORK = "BINARY_NETWORK";
public final static String COMPONENT_OF = "COMPONENT_OF";
public final static String COMPONENT_IN_SAME = "IN_SAME_COMPONENT";
public final static String SEQUENTIAL_CATALYSIS =
"SEQUENTIAL_CATALYSIS";
@@ -35,8 +33,6 @@
public final static String CO_CONTROL_INDEPENDENT_ANTI =
"CO_CONTROL_INDEPENDENT_ANTI";
public final static String CO_CONTROL_DEPENDENT_SIMILAR =
"CO_CONTROL_DEPENDENT_SIMILAR";
public final static String CO_CONTROL_DEPENDENT_ANTI =
"CO_CONTROL_DEPENDENT_ANTI";
- private final static String COMPLEX = "Complex";
- private static final String INTERACTION = "interaction"; // TODO:
Double check this constant
VisualStyle binarySifStyle;
@@ -65,8 +61,7 @@
public VisualStyle getVisualStyle() {
synchronized (this) {
if (binarySifStyle == null) {
- binarySifStyle = styleFactory
-
.getInstance(BINARY_SIF_VISUAL_STYLE);
+ binarySifStyle =
styleFactory.getInstance(BINARY_SIF_VISUAL_STYLE);
// set node opacity
binarySifStyle.setDefaultValue(
@@ -78,8 +73,7 @@
createNodeColors(binarySifStyle);
createNodeLabel(binarySifStyle);
-
binarySifStyle.setDefaultValue(MinimalVisualLexicon.EDGE_WIDTH,
- 4.0);
+
binarySifStyle.setDefaultValue(MinimalVisualLexicon.EDGE_WIDTH, 4.0);
createEdgeColor(binarySifStyle);
createDirectedEdges(binarySifStyle);
@@ -107,7 +101,7 @@
.createVisualMappingFunction(
MapBioPaxToCytoscape.BIOPAX_ENTITY_TYPE, String.class,
RichVisualLexicon.NODE_SHAPE);
- function.putMapValue(COMPLEX, NodeShapeVisualProperty.HEXAGON);
+ function.putMapValue("Complex",
NodeShapeVisualProperty.HEXAGON);
style.addVisualMappingFunction(function);
}
@@ -121,7 +115,7 @@
.createVisualMappingFunction(
MapBioPaxToCytoscape.BIOPAX_ENTITY_TYPE, String.class,
RichVisualLexicon.NODE_FILL_COLOR);
- function.putMapValue(COMPLEX, lightBlue);
+ function.putMapValue("Complex", lightBlue);
style.addVisualMappingFunction(function);
}
@@ -130,7 +124,7 @@
// to a particular node color
style.setDefaultValue(MinimalVisualLexicon.EDGE_PAINT,
Color.BLACK);
DiscreteMapping<String, Paint> function =
(DiscreteMapping<String, Paint>) discreteFactory
- .createVisualMappingFunction(INTERACTION,
String.class,
+ .createVisualMappingFunction("interaction",
String.class,
RichVisualLexicon.EDGE_PAINT);
function.putMapValue(PARTICIPATES_CONVERSION,
Modified:
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/task/ExecuteGetRecordByCPathId.java
===================================================================
---
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/task/ExecuteGetRecordByCPathId.java
2011-09-20 20:56:51 UTC (rev 26889)
+++
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/task/ExecuteGetRecordByCPathId.java
2011-09-20 20:59:26 UTC (rev 26890)
@@ -14,10 +14,14 @@
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
+import org.biopax.paxtools.controller.ModelUtils;
import org.biopax.paxtools.converter.OneTwoThree;
import org.biopax.paxtools.io.SimpleIOHandler;
+import org.biopax.paxtools.model.BioPAXElement;
import org.biopax.paxtools.model.BioPAXLevel;
import org.biopax.paxtools.model.Model;
+import org.biopax.paxtools.model.level3.Complex;
+import org.biopax.paxtools.model.level3.EntityReference;
import org.biopax.paxtools.model.level3.PhysicalEntity;
import org.cytoscape.biopax.BioPaxContainer;
import org.cytoscape.biopax.MapBioPaxToCytoscape;
@@ -25,7 +29,6 @@
import org.cytoscape.biopax.NetworkListener;
import org.cytoscape.biopax.util.BioPaxUtil;
import org.cytoscape.cpath2.internal.CPath2Factory;
-import org.cytoscape.cpath2.internal.cytoscape.BinarySifVisualStyleUtil;
import org.cytoscape.cpath2.internal.util.AttributeUtil;
import org.cytoscape.cpath2.internal.util.SelectUtil;
import org.cytoscape.cpath2.internal.web_service.CPathException;
@@ -160,14 +163,6 @@
writer.write(data);
writer.close();
- // Load up File via ImportHandler Framework
- // the biopax graph reader is going to be called
- // it will look for the network view title
- // via system properties, so lets set it now
-// if (networkTitle != null && networkTitle.length() > 0) {
-// System.setProperty("biopax.network_view_title",
networkTitle);
-// }
-
CyNetworkReader reader =
cPathFactory.getCyNetworkViewReaderManager().getReader(tmpFile.toURI(),
tmpFile.getName());
if (taskMonitor != null) {
@@ -271,10 +266,10 @@
final CyNetwork cyNetwork = view.getModel();
// Set the Quick Find Default Index
- AttributeUtil.set(cyNetwork, "quickfind.default_index",
"biopax.node_label", String.class);
+ AttributeUtil.set(cyNetwork, "quickfind.default_index",
CyNode.NAME, String.class);
// Specify that this is a BINARY_NETWORK
- AttributeUtil.set(cyNetwork,
BinarySifVisualStyleUtil.BINARY_NETWORK, Boolean.TRUE, Boolean.class);
+ AttributeUtil.set(cyNetwork,
MapBioPaxToCytoscape.BINARY_NETWORK, Boolean.TRUE, Boolean.class);
// Get all node details.
getNodeDetails(cyNetwork, taskMonitor);
@@ -454,6 +449,7 @@
for (int j = 0; j < currentList.size(); j++) {
CyNode node = currentList.get(j);
String name = node.getCyRow().get(CyNode.NAME,
String.class);
+ // 'name' is actually a CPATH-ID (for SIF
imports)
nodes.put(name, node);
ids[j] = Long.valueOf(name);
}
@@ -464,14 +460,30 @@
if(BioPAXLevel.L2.equals(model.getLevel())) {
//
model = (new
OneTwoThree()).filter(model);
}
-
- for (PhysicalEntity pe :
model.getObjects(PhysicalEntity.class)) {
- String id =
BioPaxUtil.getLocalPartRdfId(pe);
- if (id != null) {
- //id = id.replaceAll("CPATH-",
""); // why??
-
mapBioPaxToCytoscape.createAttributesFromProperties(pe, nodes.get(id));
+ //normalize/infer properties: displayName,
organism, dataSource
+ BioPaxUtil.fixDisplayName(model);
+ ModelUtils mu = new ModelUtils(model);
+ mu.inferPropertyFromParent("dataSource");
+ mu.inferPropertyFromParent("organism");
+ //map biopax properties to Cy attributes for
SIF nodes
+ for (BioPAXElement e : model.getObjects()) {
+ if(e instanceof EntityReference
+ || e instanceof Complex
+ ||
e.getModelInterface().equals(PhysicalEntity.class)) {
+ String id =
e.getRDFId().replaceFirst(model.getXmlBase(), "");
+ if (id != null) {
+ id =
id.replaceAll("CPATH-", "");
+ CyNode node =
nodes.get(id);
+ if(node != null)
+
mapBioPaxToCytoscape.createAttributesFromProperties(e, node, cyNetwork);
+ // - this will also
update the 'name' attribute (to a biol. label)
+ else {
+
logger.debug("Oops: no node for " + e.getRDFId());
+ }
+ }
}
}
+
double percentComplete = i / (double)
batchList.size();
if (taskMonitor != null) {
taskMonitor.setProgress(percentComplete);
@@ -492,9 +504,7 @@
for (CyNode node : cyNetwork.getNodeList()) {
CyRow row = node.getCyRow();
String label = row.get(CyNode.NAME, String.class);
-
- // If we already have details on this node, skip it.
- if (label == null) {
+ if (label != null) {
currentList.add(node);
counter++;
}
Modified:
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/util/NetworkGroupUtil.java
===================================================================
---
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/util/NetworkGroupUtil.java
2011-09-20 20:56:51 UTC (rev 26889)
+++
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/util/NetworkGroupUtil.java
2011-09-20 20:59:26 UTC (rev 26890)
@@ -4,7 +4,6 @@
import java.util.Set;
import org.cytoscape.biopax.MapBioPaxToCytoscape;
-import org.cytoscape.cpath2.internal.cytoscape.BinarySifVisualStyleUtil;
import org.cytoscape.cpath2.internal.web_service.CPathProperties;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkManager;
@@ -34,7 +33,7 @@
for (CyNetwork net : cyNetworks) {
String attribute = MapBioPaxToCytoscape.BIOPAX_NETWORK;
if (type == CPathProperties.DOWNLOAD_REDUCED_BINARY_SIF) {
- attribute = BinarySifVisualStyleUtil.BINARY_NETWORK;
+ attribute = MapBioPaxToCytoscape.BINARY_NETWORK;
}
Boolean b = net.getCyRow().get(attribute, Boolean.class);
if (b != null && b) {
--
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.