Author: rodche
Date: 2011-09-19 19:57:57 -0700 (Mon, 19 Sep 2011)
New Revision: 26871
Modified:
core3/impl/trunk/cpath2-impl/pom.xml
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/CPath2Factory.java
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/ViewNetworkNeighborhoodTask.java
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/task/GetParentInteractions.java
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/web_service/CytoscapeCPathWebService.java
Log:
Updated - to work well with also updated biopax-impl core plugin. Minor bug
fixes.
Modified: core3/impl/trunk/cpath2-impl/pom.xml
===================================================================
--- core3/impl/trunk/cpath2-impl/pom.xml 2011-09-20 02:56:25 UTC (rev
26870)
+++ core3/impl/trunk/cpath2-impl/pom.xml 2011-09-20 02:57:57 UTC (rev
26871)
@@ -65,11 +65,6 @@
<version>3.1</version>
</dependency>
- <dependency>
- <groupId>org.jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.1</version>
- </dependency>
<dependency>
<groupId>junit</groupId>
Modified:
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/CPath2Factory.java
===================================================================
---
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/CPath2Factory.java
2011-09-20 02:56:25 UTC (rev 26870)
+++
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/CPath2Factory.java
2011-09-20 02:57:57 UTC (rev 26871)
@@ -89,11 +89,13 @@
}
public ExecuteGetRecordByCPathIdTaskFactory
createExecuteGetRecordByCPathIdTaskFactory(CPathWebService webApi, long[] ids,
CPathResponseFormat format, String networkTitle, CyNetwork networkToMerge) {
+ networkTitle = naming.getSuggestedNetworkTitle(networkTitle);
return new ExecuteGetRecordByCPathIdTaskFactory(webApi, ids,
format, networkTitle, networkToMerge, this, bpContainer, mapperFactory,
networkListener, mappingManager);
}
public ExecuteGetRecordByCPathIdTaskFactory
createExecuteGetRecordByCPathIdTaskFactory(
CPathWebService webApi, long[] ids, CPathResponseFormat
format, String title) {
+ title = naming.getSuggestedNetworkTitle(title);
return new ExecuteGetRecordByCPathIdTaskFactory(webApi, ids,
format, title, null, this, bpContainer, mapperFactory, networkListener,
mappingManager);
}
Modified:
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/ViewNetworkNeighborhoodTask.java
===================================================================
---
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/ViewNetworkNeighborhoodTask.java
2011-09-20 02:56:25 UTC (rev 26870)
+++
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/ViewNetworkNeighborhoodTask.java
2011-09-20 02:57:57 UTC (rev 26871)
@@ -5,7 +5,6 @@
import java.net.URLEncoder;
import org.cytoscape.biopax.MapBioPaxToCytoscape;
-import org.cytoscape.biopax.util.BioPaxVisualStyleUtil;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyRow;
@@ -46,7 +45,7 @@
CyRow nodeRow = cyNode.getCyRow();
String biopaxID = nodeRow.get(MapBioPaxToCytoscape.BIOPAX_RDF_ID,
String.class);
biopaxID = biopaxID.replace("CPATH-", "");
- String neighborhoodParam = "Neighborhood: " +
nodeRow.get(BioPaxVisualStyleUtil.BIOPAX_NODE_LABEL, String.class);
+ String neighborhoodParam = "Neighborhood: " + nodeRow.get(CyNode.NAME,
String.class);
// encode some parts of the url
try {
@@ -58,7 +57,7 @@
neighborhoodParam = neighborhoodParam.replaceAll(" ", "%20");
}
- final String urlString = "http://127.0.0.1:27182/" + webServicesURL +
+ final String urlString = webServicesURL +
PC_WEB_SERVICE_URL + biopaxID + "&neighborhood_title=" +
neighborhoodParam +
"&data_source=" + dataSources;
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 02:56:25 UTC (rev 26870)
+++
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/cytoscape/BinarySifVisualStyleUtil.java
2011-09-20 02:57:57 UTC (rev 26871)
@@ -5,6 +5,7 @@
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;
import org.cytoscape.view.presentation.property.RichVisualLexicon;
@@ -180,8 +181,7 @@
private void createNodeLabel(VisualStyle style) {
// create pass through mapper for node labels
style.addVisualMappingFunction(passthroughFactory
- .createVisualMappingFunction(
-
BioPaxVisualStyleUtil.BIOPAX_NODE_LABEL, String.class,
+ .createVisualMappingFunction(CyNode.NAME,
String.class,
MinimalVisualLexicon.NODE_LABEL));
}
}
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 02:56:25 UTC (rev 26870)
+++
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/task/ExecuteGetRecordByCPathId.java
2011-09-20 02:57:57 UTC (rev 26871)
@@ -14,17 +14,16 @@
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
+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.level2.physicalEntity;
import org.biopax.paxtools.model.level3.PhysicalEntity;
import org.cytoscape.biopax.BioPaxContainer;
import org.cytoscape.biopax.MapBioPaxToCytoscape;
import org.cytoscape.biopax.MapBioPaxToCytoscapeFactory;
import org.cytoscape.biopax.NetworkListener;
import org.cytoscape.biopax.util.BioPaxUtil;
-import org.cytoscape.biopax.util.BioPaxVisualStyleUtil;
import org.cytoscape.cpath2.internal.CPath2Factory;
import org.cytoscape.cpath2.internal.cytoscape.BinarySifVisualStyleUtil;
import org.cytoscape.cpath2.internal.util.AttributeUtil;
@@ -73,55 +72,32 @@
private final NetworkListener networkListener;
private final VisualMappingManager mappingManager;
- /**.
- * Constructor.
- *
- * @param webApi
- * cPath Web API.
- * @param ids
- * Array of cPath IDs.
- * @param format
- * CPathResponseFormat Object.
- * @param networkTitle
- * Tentative Network Title.
- * @param bpContainer
- * @param application
- */
- public ExecuteGetRecordByCPathId(CPathWebService webApi, long ids[],
CPathResponseFormat format,
- String networkTitle, CPath2Factory cPathFactory,
BioPaxContainer bpContainer,
- MapBioPaxToCytoscapeFactory mapperFactory,
NetworkListener networkListener, VisualMappingManager mappingManager) {
- this.webApi = webApi;
- this.ids = ids;
- this.format = format;
- this.networkTitle = networkTitle;
- this.cPathFactory = cPathFactory;
- this.bpContainer = bpContainer;
- this.mapperFactory = mapperFactory;
- this.networkListener = networkListener;
- this.mappingManager = mappingManager;
- }
/**
* Constructor.
*
- * @param webApi
- * cPath Web API.
- * @param ids
- * Array of cPath IDs.
- * @param format
- * CPathResponseFormat Object.
- * @param networkTitle
- * Tentative Network Title.
- * @param mergedNetwork
- * Network to merge into.
+ * @param webApi cPath Web API.
+ * @param ids Array of cPath IDs.
+ * @param format CPathResponseFormat Object.
+ * @param networkTitle Tentative Network Title.
+ * @param mergedNetwork Network to merge into.
* @param mapperFactory
* @param mapBioPaxToCytoscape
* @param viewManager
* @param application
*/
- public ExecuteGetRecordByCPathId(CPathWebService webApi, long ids[],
CPathResponseFormat format,
- String networkTitle, CyNetwork mergedNetwork,
CPath2Factory cPathFactory, BioPaxContainer bpContainer,
- MapBioPaxToCytoscapeFactory mapperFactory,
NetworkListener networkListener, VisualMappingManager mappingManager) {
+ public ExecuteGetRecordByCPathId(
+ CPathWebService webApi,
+ long ids[],
+ CPathResponseFormat format,
+ String networkTitle,
+ CyNetwork mergedNetwork,
+ CPath2Factory cPathFactory,
+ BioPaxContainer bpContainer,
+ MapBioPaxToCytoscapeFactory mapperFactory,
+ NetworkListener networkListener,
+ VisualMappingManager mappingManager)
+ {
this.webApi = webApi;
this.ids = ids;
this.format = format;
@@ -188,9 +164,9 @@
// 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);
- }
+// if (networkTitle != null && networkTitle.length() > 0) {
+// System.setProperty("biopax.network_view_title",
networkTitle);
+// }
CyNetworkReader reader =
cPathFactory.getCyNetworkViewReaderManager().getReader(tmpFile.toURI(),
tmpFile.getName());
@@ -201,6 +177,8 @@
reader.run(taskMonitor);
final CyNetwork cyNetwork = reader.getCyNetworks()[0];
+ AttributeUtil.set(cyNetwork, CyNetwork.NAME,
networkTitle, String.class);
+
final CyNetworkView view = reader.buildCyNetworkView(cyNetwork);
cPathFactory.getCyNetworkManager().addNetwork(cyNetwork);
@@ -313,16 +291,6 @@
taskMonitor.setProgress(0);
}
- // Set up the right layout algorithm.
- // LayoutUtil layoutAlgorithm = new
LayoutUtil();
-
- // Now, create the view.
- // Use local create view option, so that we
don't mess up the
- // visual style.
- // final CyNetworkView view = createNetworkView
- // (cyNetwork,
cyNetwork.getCyRow().get(CyNetwork.NAME,
- // String.class), layoutAlgorithm, null);
-
VisualStyle visualStyle =
cPathFactory.getBinarySifVisualStyleUtil().getVisualStyle();
mappingManager.setVisualStyle(visualStyle,
view);
networkListener.registerNetwork(view);
@@ -474,7 +442,7 @@
if (batchList.size() == 0) {
logger.info("Skipping node details. Already have all
the details new need.");
}
- MapBioPaxToCytoscape mapBioPaxToCytoscape =
mapperFactory.getInstance(cyNetwork, taskMonitor);
+ MapBioPaxToCytoscape mapBioPaxToCytoscape =
mapperFactory.getInstance(null, taskMonitor);
for (int i = 0; i < batchList.size(); i++) {
if (haltFlag == true) {
break;
@@ -491,21 +459,17 @@
}
try {
final String xml = webApi.getRecordsByIds(ids,
CPathResponseFormat.BIOPAX, new NullTaskMonitor());
- // StringReader reader = new StringReader(xml);
- // BioPaxUtil bpUtil = new BioPaxUtil(reader,
new
- // NullTaskMonitor());
- Model model = new
SimpleIOHandler().convertFromOWL(new ByteArrayInputStream(xml.getBytes()));
- // ArrayList peList =
bpUtil.getPhysicalEntityList();
- // Namespace ns =
- //
Namespace.getNamespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
- // for (int j=0; j<peList.size(); j++) {
- for (BioPAXElement pe :
BioPaxUtil.getObjects(model, physicalEntity.class, PhysicalEntity.class)) {
- // Element element = (Element)
peList.get(j);
- // String id =
element.getAttributeValue("ID", ns);
+ Model model = (new
SimpleIOHandler()).convertFromOWL(new ByteArrayInputStream(xml.getBytes()));
+ // convert L2 to L3 if required (L1 is
converted to L2 always anyway - by the handler)
+ 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-",
"");
-
mapBioPaxToCytoscape.mapNodeAttribute(pe, model, cyNetwork, nodes.get(id));
+ //id = id.replaceAll("CPATH-",
""); // why??
+
mapBioPaxToCytoscape.createAttributesFromProperties(pe, nodes.get(id));
}
}
double percentComplete = i / (double)
batchList.size();
@@ -527,7 +491,7 @@
int counter = 0;
for (CyNode node : cyNetwork.getNodeList()) {
CyRow row = node.getCyRow();
- String label =
row.get(BioPaxVisualStyleUtil.BIOPAX_NODE_LABEL, String.class);
+ String label = row.get(CyNode.NAME, String.class);
// If we already have details on this node, skip it.
if (label == null) {
@@ -579,6 +543,7 @@
// view.redrawGraph(false, true);
// return view;
// }
+
}
class NullTaskMonitor implements TaskMonitor {
Modified:
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/task/GetParentInteractions.java
===================================================================
---
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/task/GetParentInteractions.java
2011-09-20 02:56:25 UTC (rev 26870)
+++
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/task/GetParentInteractions.java
2011-09-20 02:57:57 UTC (rev 26871)
@@ -3,7 +3,6 @@
import javax.swing.JDialog;
import org.cytoscape.application.swing.CySwingApplication;
-import org.cytoscape.biopax.util.BioPaxVisualStyleUtil;
import org.cytoscape.cpath2.internal.CPath2Factory;
import
org.cytoscape.cpath2.internal.schemas.summary_response.SummaryResponseType;
import org.cytoscape.cpath2.internal.view.InteractionBundlePanel;
@@ -52,7 +51,7 @@
CySwingApplication application = factory.getCySwingApplication();
JDialog dialog = new JDialog(application.getJFrame());
- String nodeLabel =
node.getCyRow().get(BioPaxVisualStyleUtil.BIOPAX_NODE_LABEL, String.class);
+ String nodeLabel = node.getCyRow().get(CyNode.NAME, String.class);
if (nodeLabel != null) {
dialog.setTitle(nodeLabel);
} else {
Modified:
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/web_service/CytoscapeCPathWebService.java
===================================================================
---
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/web_service/CytoscapeCPathWebService.java
2011-09-20 02:56:25 UTC (rev 26870)
+++
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/web_service/CytoscapeCPathWebService.java
2011-09-20 02:57:57 UTC (rev 26871)
@@ -27,7 +27,9 @@
/**
* CPath Web Service, integrated into the Cytoscape Web Services Framework.
*/
-public class CytoscapeCPathWebService extends AbstractWebServiceClient
implements NetworkImportWebServiceClient, SearchWebServiceClient<Object> {
+public class CytoscapeCPathWebService extends AbstractWebServiceClient
+ implements NetworkImportWebServiceClient,
SearchWebServiceClient<Object>
+{
// Display name of this client.
private static final String DISPLAY_NAME =
CPathProperties.getInstance().getCPathServerName() +
" Web Service Client";
@@ -101,9 +103,6 @@
super(CPathProperties.getInstance().getCPathUrl(), DISPLAY_NAME,
makeDescription());
this.factory = factory;
- // Set properties for this client.
- setProperty();
-
mainPanel = new JPanel();
mainPanel.setPreferredSize(new Dimension (500,400));
mainPanel.setLayout (new BorderLayout());
@@ -126,15 +125,5 @@
return "<html><body>" + desc + "</body></html>";
}
- /**
- * Set props for this client.
- */
- private void setProperty() {
-// props = new ModulePropertiesImpl(clientID, "wsc");
-// props.add(new Tunable(NCBI_TAXONOMY_ID_FILTER, "Filter by Organism -
NCBI Taxonomy ID",
-// Tunable.INTEGER, new Integer(-1)));
-// props.add(new Tunable(RESPONSE_FORMAT, "Response Format",
-// Tunable.INTEGER,
CPathResponseFormat.BINARY_SIF.getFormatString()));
- }
}
--
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.