Author: rodche
Date: 2010-02-02 10:32:17 -0800 (Tue, 02 Feb 2010)
New Revision: 19124
Modified:
coreplugins/trunk/BioPAX/lib/paxtools-core-2.0-SNAPSHOT.jar
coreplugins/trunk/BioPAX/lib/paxtools-simple-io-2.0-SNAPSHOT.jar
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/BioPaxGraphReader.java
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/BiopaxPlugin.java
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/MapBioPaxToCytoscape.java
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/util/BioPaxUtil.java
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/util/BioPaxVisualStyleUtil.java
Log:
BioPAX core plugin: libs updates; network name fixed; removed plugin's default
layout menu, etc.
Modified: coreplugins/trunk/BioPAX/lib/paxtools-core-2.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Modified: coreplugins/trunk/BioPAX/lib/paxtools-simple-io-2.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Modified:
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/BioPaxGraphReader.java
===================================================================
---
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/BioPaxGraphReader.java
2010-02-02 18:30:01 UTC (rev 19123)
+++
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/BioPaxGraphReader.java
2010-02-02 18:32:17 UTC (rev 19124)
@@ -106,15 +106,8 @@
log.info("Model contains " + model.getObjects().size()
+ " BioPAX elements");
-
- // Set network name (also checks if it exists)
networkName = getNetworkName(model);
- if(networkName==null
- || networkName.trim().equals("")) {
- networkName = fileName;
- }
-
// Map BioPAX Data to Cytoscape Nodes/Edges (run as task)
MapBioPaxToCytoscape mapper = new MapBioPaxToCytoscape();
mapper.doMapping(model);
@@ -134,7 +127,6 @@
String candidateName;
String networkViewTitle =
System.getProperty("biopax.network_view_title");
if (networkViewTitle != null && networkViewTitle.length() > 0) {
- validNetworkName = true;
System.setProperty("biopax.network_view_title", "");
try {
networkViewTitle =
URLDecoder.decode(networkViewTitle, "UTF-8");
@@ -148,13 +140,18 @@
}
if(candidateName == null || "".equalsIgnoreCase(candidateName))
{
- int idx = fileName.lastIndexOf('/');
- if(idx==-1) idx = fileName.lastIndexOf('\\');
- candidateName = fileName.substring(idx+1);
+ candidateName = fileName;
}
// Take appropriate adjustments, if name already exists
- return CyNetworkNaming.getSuggestedNetworkTitle(candidateName);
+ String name =
CyNetworkNaming.getSuggestedNetworkTitle(candidateName);
+
+ if(log.isDebugging()) {
+ log.debug("Network name (adjusted) : " + candidateName
+ + " (" + name + ")");
+ }
+
+ return name;
}
/**
@@ -207,7 +204,7 @@
*
* @param cyNetwork CyNetwork object.
*/
- public void doPostProcessing(CyNetwork cyNetwork) {
+ public void doPostProcessing(final CyNetwork cyNetwork) {
// get cyNetwork id
this.networkId = cyNetwork.getIdentifier();
@@ -217,12 +214,16 @@
networkAttributes.setAttribute(networkId,
MapBioPaxToCytoscape.BIOPAX_NETWORK, Boolean.TRUE);
// Repair Canonical Name
- repairCanonicalName(cyNetwork);
+ repairNodesCanonicalName(cyNetwork);
// repair network name
- if (!validNetworkName) {
- repairNetworkName(cyNetwork);
- }
+ //repairNetworkName(cyNetwork);
+ // Update UI. Must be done via SwingUtilities...
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+
Cytoscape.getDesktop().getNetworkPanel().updateTitle(cyNetwork);
+ }
+ });
// Set default Quick Find Index
networkAttributes.setAttribute(cyNetwork.getIdentifier(),
"quickfind.default_index",
@@ -258,6 +259,9 @@
VisualStyle bioPaxVisualStyle =
BioPaxVisualStyleUtil.getBioPaxVisualStyle();
VisualMappingManager manager =
Cytoscape.getVisualMappingManager();
CyNetworkView view =
Cytoscape.getNetworkView(cyNetwork.getIdentifier());
+ // set tooltips
+ BioPaxVisualStyleUtil.setNodeToolTips(view);
+ // set style
view.setVisualStyle(bioPaxVisualStyle.getName());
manager.setVisualStyle(bioPaxVisualStyle);
view.applyVizmapper(bioPaxVisualStyle);
@@ -267,8 +271,6 @@
BioPaxContainer bpContainer = BioPaxContainer.getInstance();
bpContainer.showLegend();
- BioPaxVisualStyleUtil.setNodeToolTips(view);
-
// add network listener
NetworkListener networkListener = bpContainer.getNetworkListener();
networkListener.registerNetwork(cyNetwork);
@@ -323,7 +325,8 @@
*
* @param cyNetwork CyNetwork Object.
*/
- private static void repairNetworkName(final CyNetwork cyNetwork) {
+ /*
+ public static void repairNetworkName(final CyNetwork cyNetwork) {
try {
CyAttributes nodeAttributes =
Cytoscape.getNodeAttributes();
Iterator<CyNode> iter = cyNetwork.nodesIterator();
@@ -349,7 +352,7 @@
// network is empty, do nothing
}
}
-
+ */
/**
* Repairs Canonical Name; temporary fix for bug: 1001.
@@ -358,7 +361,7 @@
*
* @param cyNetwork CyNetwork Object.
*/
- private static void repairCanonicalName(CyNetwork cyNetwork) {
+ private static void repairNodesCanonicalName(CyNetwork cyNetwork) {
CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
Iterator<CyNode> iter = cyNetwork.nodesIterator();
while (iter.hasNext()) {
Modified:
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/BiopaxPlugin.java
===================================================================
--- coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/BiopaxPlugin.java
2010-02-02 18:30:01 UTC (rev 19123)
+++ coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/BiopaxPlugin.java
2010-02-02 18:32:17 UTC (rev 19124)
@@ -30,23 +30,13 @@
import cytoscape.Cytoscape;
import cytoscape.CytoscapeInit;
-import cytoscape.coreplugins.biopax.action.DisplayBiopaxXmlAction;
import cytoscape.coreplugins.biopax.action.ExportAsBioPAXAction;
-import cytoscape.coreplugins.biopax.util.BioPaxUtil;
-import cytoscape.coreplugins.biopax.util.BioPaxVisualStyleUtil;
import cytoscape.coreplugins.biopax.view.BioPaxContainer;
-import cytoscape.coreplugins.biopax.view.BioPaxDetailsPanel;
import cytoscape.data.ImportHandler;
-import cytoscape.layout.CyLayoutAlgorithm;
-import cytoscape.layout.CyLayouts;
import cytoscape.logger.CyLogger;
import cytoscape.plugin.CytoscapePlugin;
-import cytoscape.util.CytoscapeAction;
import cytoscape.view.CyMenus;
-import java.awt.event.ActionEvent;
-import java.util.Arrays;
-import java.util.Comparator;
import java.util.Properties;
/**
@@ -58,19 +48,6 @@
protected static final CyLogger log =
CyLogger.getLogger(BiopaxPlugin.class);
- // Set True to see debug messages
- private static final boolean DEBUG = false;
-
- static {
- BiopaxPlugin.log.setDebug(DEBUG);
- BioPaxGraphReader.log.setDebug(DEBUG);
- MapBioPaxToCytoscape.log.setDebug(DEBUG);
- BioPaxDetailsPanel.log.setDebug(DEBUG);
- BioPaxVisualStyleUtil.log.setDebug(DEBUG);
- BioPaxUtil.log.setDebug(DEBUG);
- DisplayBiopaxXmlAction.log.setDebug(DEBUG);
- }
-
/**
* Version Major Number.
*/
@@ -120,46 +97,13 @@
System.getProperties().put("proxyPort", proxyPort);
}
+ // add export to BioPAX menu
CyMenus cyMenus = Cytoscape.getDesktop().getCyMenus();
cyMenus.addAction(new ExportAsBioPAXAction());
- CyLayoutAlgorithm allLayouts[] = CyLayouts.getAllLayouts()
- .toArray(new CyLayoutAlgorithm[1]);
- // Put layout names in alphabetical order.
- Arrays.sort(allLayouts, new Comparator<CyLayoutAlgorithm>() {
- public int compare(CyLayoutAlgorithm o1,
CyLayoutAlgorithm o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
-
- // For each layout algorithm, create a menu item to select it
as default when reading.
- for (CyLayoutAlgorithm algo : allLayouts) {
- cyMenus.addAction(new SelectDefaultLayoutAction(algo));
- }
-
// to start listening to network events, like a load of a
network from a session,
// we create an instance of a BioPaxContainerClass this
contains the network listener
BioPaxContainer.getInstance();
}
- /**
- * For "Plugins->BioPaX Import->Default Layout" menu.
- * One of these actions exists for each known layout.
- * When the layout name is clicked, it becomes the default initial
layout for future biopax reads.
- */
- public class SelectDefaultLayoutAction extends CytoscapeAction {
- private static final long serialVersionUID = 1L;
- private CyLayoutAlgorithm algo =
BioPaxGraphReader.getDefaultLayoutAlgorithm();
-
- public SelectDefaultLayoutAction(CyLayoutAlgorithm algo) {
- super(algo.getName());
- this.algo = algo;
- this.setPreferredMenu("Plugins.BioPaX Import.Default
Layout");
- }
-
- public void actionPerformed(ActionEvent ae) {
- BioPaxGraphReader.setDefaultLayoutAlgorithm(algo);
- }
- }
-
}
Modified:
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/MapBioPaxToCytoscape.java
===================================================================
---
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/MapBioPaxToCytoscape.java
2010-02-02 18:30:01 UTC (rev 19123)
+++
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/MapBioPaxToCytoscape.java
2010-02-02 18:32:17 UTC (rev 19124)
@@ -1244,7 +1244,8 @@
}
// pathway name
- stringRef = BioPaxUtil.getParentPathwayName(resource,
model).toString();
+ stringRef = BioPaxUtil.getParentPathwayName(resource, model)
+ .toString().replaceAll("\\]|\\[", "").trim();
nodeAttributes.setAttribute(nodeID, BIOPAX_PATHWAY_NAME,
stringRef);
// add all xref ids for global lookup
Modified:
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/util/BioPaxUtil.java
===================================================================
---
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/util/BioPaxUtil.java
2010-02-02 18:30:01 UTC (rev 19123)
+++
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/util/BioPaxUtil.java
2010-02-02 18:32:17 UTC (rev 19124)
@@ -727,26 +727,43 @@
Collection<Pathway> pws =
model.getObjects(Pathway.class);
for(Pathway pw: pws) {
if(pw.getPathwayComponentsOf().isEmpty()
- &&
pw.getParticipantsOf().isEmpty()) {
+ &&
pw.getParticipantsOf().isEmpty()
+ &&
pw.getControlledOf().isEmpty()) {
modelName.append("
").append(getNodeName(pw));
}
}
+ if(modelName.length()==0) {
+ Collection<Interaction> itrs =
model.getObjects(Interaction.class);
+ for(Interaction it: itrs) {
+ if(it.getPathwayComponentsOf().isEmpty()
+ &&
it.getControlledOf().isEmpty()
+ &&
it.getParticipantsOf().isEmpty()) {
+ modelName.append("
").append(getNodeName(it));
+ }
+ }
+ }
} else { // Level 1 and 2
Collection<pathway> pws =
model.getObjects(pathway.class);
for(pathway pw: pws) {
if(pw.isPATHWAY_COMPONENTSof().isEmpty()
- &&
pw.isPARTICIPANTSof().isEmpty()) {
+ &&
pw.isPARTICIPANTSof().isEmpty()
+ &&
pw.isCONTROLLEDOf().isEmpty()) {
modelName.append("
").append(getNodeName(pw));
}
}
+ if(modelName.length()==0) {
+ Collection<interaction> itrs =
model.getObjects(interaction.class);
+ for(interaction it: itrs) {
+ if(it.isPATHWAY_COMPONENTSof().isEmpty()
+ &&
it.isPARTICIPANTSof().isEmpty()
+ &&
it.isCONTROLLEDOf().isEmpty()) {
+ modelName.append("
").append(getNodeName(it));
+ }
+ }
+ }
}
- if ((modelName.length() > 0)) {
- return modelName.toString();
- }
-
-
- return null;
+ return modelName.toString().trim();
}
/**
@@ -807,6 +824,36 @@
pathwayNames.add(getNodeName(bpe));
}
+
+ if(!pathwayNames.isEmpty()) {
+ return pathwayNames;
+ }
+
+ // otherwise, find top-level interactions
+ procs = BioPaxUtil.getObjects(model, interaction.class,
Interaction.class);
+ for(BioPAXElement itr : procs ) {
+ if( (itr instanceof interaction
+ &&
((interaction)itr).isPATHWAY_COMPONENTSof().isEmpty()
+ &&
((interaction)itr).isPARTICIPANTSof().isEmpty()
+ &&
((interaction)itr).isCONTROLLEDOf().isEmpty())
+ ||
+ (itr instanceof Interaction
+ &&
((Interaction)itr).getPathwayComponentsOf().isEmpty()
+ &&
((Interaction)itr).getParticipantsOf().isEmpty()
+ &&
((Interaction)itr).getControlledOf().isEmpty()))
+ {
+ topPathways.add(itr);
+ }
+ }
+ pathways = fetchParentNodeNames(bpe, topPathways);
+ if(!pathways.isEmpty()) {
+ for(BioPAXElement pw : pathways) {
+ pathwayNames.add(getNodeName(pw));
+ }
+ } else if(bpe instanceof interaction || bpe instanceof
Interaction) {
+ pathwayNames.add(getNodeName(bpe));
+ }
+
return pathwayNames;
}
Modified:
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/util/BioPaxVisualStyleUtil.java
===================================================================
---
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/util/BioPaxVisualStyleUtil.java
2010-02-02 18:30:01 UTC (rev 19123)
+++
coreplugins/trunk/BioPAX/src/cytoscape/coreplugins/biopax/util/BioPaxVisualStyleUtil.java
2010-02-02 18:32:17 UTC (rev 19124)
@@ -364,15 +364,7 @@
String tip =
nodeAttributes.getAttribute(id,
MapBioPaxToCytoscape.BIOPAX_ENTITY_TYPE)
+ "\n" +
- nodeAttributes.getAttribute(id,
MapBioPaxToCytoscape.BIOPAX_AVAILABILITY)
- + "\n" +
- nodeAttributes.getAttribute(id,
MapBioPaxToCytoscape.BIOPAX_CELLULAR_LOCATIONS)
- + "\n" +
- nodeAttributes.getAttribute(id,
MapBioPaxToCytoscape.BIOPAX_DATA_SOURCES)
- + "\n" +
- nodeAttributes.getAttribute(id,
MapBioPaxToCytoscape.BIOPAX_PATHWAY_NAME)
- + "\n" +
- nodeAttributes.getAttribute(id,
MapBioPaxToCytoscape.BIOPAX_RDF_ID);
+ nodeAttributes.getListAttribute(id,
MapBioPaxToCytoscape.BIOPAX_CELLULAR_LOCATIONS);
nodeView.setToolTip(tip);
--
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.