Author: clopes
Date: 2012-05-02 14:40:21 -0700 (Wed, 02 May 2012)
New Revision: 29084
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/AbstractMCODEAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/CyActivator.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAboutAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODECloseAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEDiscardResultAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEHelpAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEOpenAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEVisualStyleAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEAlgorithm.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODECluster.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEParameterSet.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/task/MCODEAnalyzeTaskFactory.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/layout/NodeDistances.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/layout/SpringEmbeddedLayouter.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/view/MCODEResultsPanel.java
Log:
Fixed compilation errors (CyNode.getIndex() replaced by getSUID(), etc)
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/AbstractMCODEAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/AbstractMCODEAction.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/AbstractMCODEAction.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -10,6 +10,7 @@
import org.cytoscape.application.swing.CytoPanelName;
import org.cytoscape.mcode.internal.view.MCODEMainPanel;
import org.cytoscape.mcode.internal.view.MCODEResultsPanel;
+import org.cytoscape.view.model.CyNetworkViewManager;
public abstract class AbstractMCODEAction extends AbstractCyAction {
@@ -17,13 +18,16 @@
protected final CySwingApplication swingApplication;
protected final CyApplicationManager applicationManager;
+ protected final CyNetworkViewManager netViewManager;
public AbstractMCODEAction(final String name,
final
CyApplicationManager applicationManager,
- final
CySwingApplication swingApplication) {
- super(name, applicationManager, "network");
+ final
CySwingApplication swingApplication,
+ final
CyNetworkViewManager netViewManager) {
+ super(name, applicationManager, "network", netViewManager);
this.applicationManager = applicationManager;
this.swingApplication = swingApplication;
+ this.netViewManager = netViewManager;
}
/**
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/CyActivator.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/CyActivator.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/CyActivator.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -36,15 +36,15 @@
@SuppressWarnings("unchecked")
public void start(BundleContext bc) {
- CyApplicationManager applicationManager = getService(bc,
CyApplicationManager.class);
- CyNetworkViewManager networkViewMgr = getService(bc,
CyNetworkViewManager.class);
- CyNetworkManager networkMgr = getService(bc,
CyNetworkManager.class);
- TaskManager<?, ?> taskManager = getService(bc,
TaskManager.class);
+ CyApplicationManager appMgr = getService(bc,
CyApplicationManager.class);
+ CyNetworkViewManager netViewMgr = getService(bc,
CyNetworkViewManager.class);
+ CyNetworkManager netMgr = getService(bc,
CyNetworkManager.class);
+ TaskManager<?, ?> taskMgr = getService(bc, TaskManager.class);
- CyNetworkViewFactory networkViewFactory = getService(bc,
CyNetworkViewFactory.class);
+ CyNetworkViewFactory netViewFactory = getService(bc,
CyNetworkViewFactory.class);
CyRootNetworkManager rootNetworkMgr = getService(bc,
CyRootNetworkManager.class);
- CySwingApplication swingApplication = getService(bc,
CySwingApplication.class);
+ CySwingApplication swingApp = getService(bc,
CySwingApplication.class);
RenderingEngineFactory<CyNetwork> dingRenderingEngineFactory =
getService(bc, RenderingEngineFactory.class, "(id=ding)");
CyServiceRegistrar serviceRegistrar = getService(bc,
CyServiceRegistrar.class);
@@ -57,17 +57,17 @@
OpenBrowser openBrowser = getService(bc, OpenBrowser.class);
CyEventHelper eventHelper = getService(bc, CyEventHelper.class);
- MCODEUtil mcodeUtil = new MCODEUtil(dingRenderingEngineFactory,
networkViewFactory, rootNetworkMgr,
-
applicationManager, networkMgr, networkViewMgr, visualStyleFactory,
-
visualMappingMgr, swingApplication, eventHelper, discreteMappingFactory,
+ MCODEUtil mcodeUtil = new MCODEUtil(dingRenderingEngineFactory,
netViewFactory, rootNetworkMgr,
+
appMgr, netMgr, netViewMgr, visualStyleFactory,
+
visualMappingMgr, swingApp, eventHelper, discreteMappingFactory,
continuousMappingFactory, fileUtil);
- MCODEAnalyzeAction analyzeAction = new
MCODEAnalyzeAction("Analyze current network", applicationManager,
swingApplication, serviceRegistrar, taskManager, mcodeUtil);
- MCODEOpenAction openAction = new MCODEOpenAction("Open MCODE",
applicationManager, swingApplication, serviceRegistrar, analyzeAction,
mcodeUtil);
- MCODECloseAction closeAction = new MCODECloseAction("Close
MCODE", applicationManager, swingApplication, serviceRegistrar, mcodeUtil);
- MCODEHelpAction helpAction = new MCODEHelpAction("Help",
applicationManager, swingApplication, openBrowser);
- MCODEVisualStyleAction visualStyleAction = new
MCODEVisualStyleAction("Apply MCODE style", applicationManager,
swingApplication, visualMappingMgr, mcodeUtil);
- MCODEAboutAction aboutAction = new MCODEAboutAction("About",
applicationManager, swingApplication, openBrowser, mcodeUtil);
+ MCODEAnalyzeAction analyzeAction = new
MCODEAnalyzeAction("Analyze current network", appMgr, swingApp, netViewMgr,
serviceRegistrar, taskMgr, mcodeUtil);
+ MCODEOpenAction openAction = new MCODEOpenAction("Open MCODE",
appMgr, swingApp, netViewMgr, serviceRegistrar, analyzeAction, mcodeUtil);
+ MCODECloseAction closeAction = new MCODECloseAction("Close
MCODE", appMgr, swingApp, netViewMgr, serviceRegistrar, mcodeUtil);
+ MCODEHelpAction helpAction = new MCODEHelpAction("Help",
appMgr, swingApp, netViewMgr, openBrowser);
+ MCODEVisualStyleAction visualStyleAction = new
MCODEVisualStyleAction("Apply MCODE style", appMgr, swingApp, netViewMgr,
visualMappingMgr, mcodeUtil);
+ MCODEAboutAction aboutAction = new MCODEAboutAction("About",
appMgr, swingApp, netViewMgr, openBrowser, mcodeUtil);
registerService(bc, openAction, CyAction.class, new
Properties());
registerService(bc, closeAction, CyAction.class, new
Properties());
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAboutAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAboutAction.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAboutAction.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -7,6 +7,7 @@
import org.cytoscape.mcode.internal.util.MCODEUtil;
import org.cytoscape.mcode.internal.view.MCODEAboutDialog;
import org.cytoscape.util.swing.OpenBrowser;
+import org.cytoscape.view.model.CyNetworkViewManager;
/**
* * Copyright (c) 2004 Memorial Sloan-Kettering Cancer Center
@@ -57,9 +58,10 @@
public MCODEAboutAction(final String name,
final
CyApplicationManager applicationManager,
final
CySwingApplication swingApplication,
+ final
CyNetworkViewManager netViewManager,
final OpenBrowser
openBrowser,
final MCODEUtil
mcodeUtil) {
- super(name, applicationManager, swingApplication);
+ super(name, applicationManager, swingApplication,
netViewManager);
this.openBrowser = openBrowser;
this.mcodeUtil = mcodeUtil;
setPreferredMenu("Apps.MCODE");
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -28,6 +28,7 @@
import org.cytoscape.model.events.NetworkDestroyedListener;
import org.cytoscape.service.util.CyServiceRegistrar;
import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.model.CyNetworkViewManager;
import org.cytoscape.work.TaskManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -82,7 +83,7 @@
public final static int INTERRUPTION = 3;
private final CyServiceRegistrar registrar;
- private final TaskManager taskManager;
+ private final TaskManager<?, ?> taskManager;
private final MCODEUtil mcodeUtil;
int analyze = FIRST_TIME;
@@ -92,16 +93,14 @@
public MCODEAnalyzeAction(final String title,
final
CyApplicationManager applicationManager,
final
CySwingApplication swingApplication,
+ final
CyNetworkViewManager netViewManager,
final
CyServiceRegistrar registrar,
- final TaskManager
taskManager,
+ final TaskManager<?,
?> taskManager,
final MCODEUtil
mcodeUtil) {
- super(title, applicationManager, swingApplication);
+ super(title, applicationManager, swingApplication,
netViewManager);
this.registrar = registrar;
this.taskManager = taskManager;
this.mcodeUtil = mcodeUtil;
-
- // The analysis should be disabled when there is no network
- enableFor = "network";
}
/**
@@ -133,15 +132,15 @@
}
List<CyNode> nodes = network.getNodeList();
- List<Integer> selectedNodes = new ArrayList<Integer>();
+ List<Long> selectedNodes = new ArrayList<Long>();
for (CyNode n : nodes) {
if (network.getRow(n).get(CyNetwork.SELECTED,
Boolean.class)) {
- selectedNodes.add(n.getIndex());
+ selectedNodes.add(n.getSUID());
}
}
- Integer[] selectedNodesRGI = selectedNodes.toArray(new
Integer[selectedNodes.size()]);
+ Long[] selectedNodesRGI = selectedNodes.toArray(new
Long[selectedNodes.size()]);
MCODEParameterSet currentParamsCopy =
getMainPanel().getCurrentParamsCopy();
currentParamsCopy.setSelectedNodes(selectedNodesRGI);
@@ -234,6 +233,7 @@
resultId,
applicationManager,
swingApplication,
+
netViewManager,
registrar,
mcodeUtil);
@@ -269,7 +269,7 @@
// Run MCODE
MCODEAnalyzeTaskFactory analyzeTaskFactory = new
MCODEAnalyzeTaskFactory(network, analyze, resultId, alg,
mcodeUtil, listener);
- taskManager.execute(analyzeTaskFactory);
+
taskManager.execute(analyzeTaskFactory.createTaskIterator());
}
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODECloseAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODECloseAction.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODECloseAction.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -19,6 +19,7 @@
import org.cytoscape.model.events.NetworkAboutToBeDestroyedEvent;
import org.cytoscape.model.events.NetworkAboutToBeDestroyedListener;
import org.cytoscape.service.util.CyServiceRegistrar;
+import org.cytoscape.view.model.CyNetworkViewManager;
/**
* Closes the app panels.
@@ -33,9 +34,10 @@
public MCODECloseAction(final String name,
final
CyApplicationManager applicationManager,
final
CySwingApplication swingApplication,
+ final
CyNetworkViewManager netViewManager,
final
CyServiceRegistrar registrar,
final MCODEUtil
mcodeUtil) {
- super(name, applicationManager, swingApplication);
+ super(name, applicationManager, swingApplication,
netViewManager);
this.registrar = registrar;
this.mcodeUtil = mcodeUtil;
setPreferredMenu("Apps.MCODE");
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEDiscardResultAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEDiscardResultAction.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEDiscardResultAction.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -13,6 +13,7 @@
import org.cytoscape.mcode.internal.util.MCODEUtil;
import org.cytoscape.mcode.internal.view.MCODEResultsPanel;
import org.cytoscape.service.util.CyServiceRegistrar;
+import org.cytoscape.view.model.CyNetworkViewManager;
public class MCODEDiscardResultAction extends AbstractMCODEAction {
@@ -28,9 +29,10 @@
final
int resultId,
final
CyApplicationManager applicationManager,
final
CySwingApplication swingApplication,
+ final
CyNetworkViewManager netViewManager,
final
CyServiceRegistrar registrar,
final
MCODEUtil mcodeUtil) {
- super(name, applicationManager, swingApplication);
+ super(name, applicationManager, swingApplication,
netViewManager);
this.resultId = resultId;
this.registrar = registrar;
this.mcodeUtil = mcodeUtil;
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEHelpAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEHelpAction.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEHelpAction.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -5,6 +5,7 @@
import org.cytoscape.application.CyApplicationManager;
import org.cytoscape.application.swing.CySwingApplication;
import org.cytoscape.util.swing.OpenBrowser;
+import org.cytoscape.view.model.CyNetworkViewManager;
/**
* Copyright (c) 2004 Memorial Sloan-Kettering Cancer Center
@@ -55,8 +56,9 @@
public MCODEHelpAction(final String name,
final CyApplicationManager
applicationManager,
final CySwingApplication
swingApplication,
+ final CyNetworkViewManager
netViewManager,
final OpenBrowser
openBrowser) {
- super(name, applicationManager, swingApplication);
+ super(name, applicationManager, swingApplication,
netViewManager);
this.openBrowser = openBrowser;
setPreferredMenu("Apps.MCODE");
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEOpenAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEOpenAction.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEOpenAction.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -10,6 +10,7 @@
import org.cytoscape.mcode.internal.util.MCODEUtil;
import org.cytoscape.mcode.internal.view.MCODEMainPanel;
import org.cytoscape.service.util.CyServiceRegistrar;
+import org.cytoscape.view.model.CyNetworkViewManager;
/**
* Creates a new menu item under Apps menu section.
@@ -25,10 +26,11 @@
public MCODEOpenAction(final String name,
final CyApplicationManager
applicationManager,
final CySwingApplication
swingApplication,
+ final CyNetworkViewManager
netViewManager,
final CyServiceRegistrar
registrar,
final MCODEAnalyzeAction
analyzeAction,
final MCODEUtil mcodeUtil) {
- super(name, applicationManager, swingApplication);
+ super(name, applicationManager, swingApplication,
netViewManager);
this.registrar = registrar;
this.analyzeAction = analyzeAction;
this.mcodeUtil = mcodeUtil;
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEVisualStyleAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEVisualStyleAction.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEVisualStyleAction.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -10,6 +10,7 @@
import org.cytoscape.mcode.internal.util.MCODEUtil;
import org.cytoscape.mcode.internal.view.MCODEResultsPanel;
import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.model.CyNetworkViewManager;
import org.cytoscape.view.vizmap.VisualMappingManager;
import org.cytoscape.view.vizmap.VisualStyle;
@@ -63,9 +64,10 @@
public MCODEVisualStyleAction(final String title,
final
CyApplicationManager applicationManager,
final
CySwingApplication swingApplication,
+ final
CyNetworkViewManager netViewManager,
final
VisualMappingManager visualMappingMgr,
final
MCODEUtil mcodeUtil) {
- super(title, applicationManager, swingApplication);
+ super(title, applicationManager, swingApplication,
netViewManager);
this.visualMappingMgr = visualMappingMgr;
this.mcodeUtil = mcodeUtil;
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEAlgorithm.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEAlgorithm.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEAlgorithm.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -72,7 +72,7 @@
double density; //neighborhood density
int numNodeNeighbors; //number of node neighbors
- int[] nodeNeighbors; //stores node indices of all neighbors
+ Long[] nodeNeighbors; //stores node indices of all neighbors
int coreLevel; //e.g. 2 = a 2-core
double coreDensity; //density of the core neighborhood
double score; //node score
@@ -86,10 +86,10 @@
}
//data structures useful to have around for more than one cluster
finding iteration
- //key is the node index, value is a NodeInfo instance
- private Map<Integer, NodeInfo> currentNodeInfoHashMap;
+ //key is the node SUID, value is a NodeInfo instance
+ private Map<Long, NodeInfo> currentNodeInfoHashMap;
//key is node score, value is nodeIndex
- private SortedMap<Double, List<Integer>> currentNodeScoreSortedMap;
+ private SortedMap<Double, List<Long>> currentNodeScoreSortedMap;
//because every network can be scored and clustered several times with
different parameters
//these results have to be stored so that the same scores are used
during exploration when
//the user is switching between the various results
@@ -97,9 +97,9 @@
//haven't changed for example) the clustering method must save the
current node scores under the new result
//title for later reference
//key is result id, value is nodeScoreSortedMap
- private Map<Integer, SortedMap<Double, List<Integer>>>
nodeScoreResultsMap = new HashMap<Integer, SortedMap<Double, List<Integer>>>();
+ private Map<Integer, SortedMap<Double, List<Long>>> nodeScoreResultsMap
= new HashMap<Integer, SortedMap<Double, List<Long>>>();
//key is result id, value is nodeInfroHashMap
- private Map<Integer, Map<Integer, NodeInfo>> nodeInfoResultsMap = new
HashMap<Integer, Map<Integer, NodeInfo>>();
+ private Map<Integer, Map<Long, NodeInfo>> nodeInfoResultsMap = new
HashMap<Integer, Map<Long, NodeInfo>>();
private MCODEParameterSet params; //the parameters used for this
instance of the algorithm
//stats
@@ -168,17 +168,17 @@
* Gets the calculated node score of a node from a given result. Used
in MCODEResultsPanel
* during the attribute setting method.
*
- * @param nodeIndex Integer which is used to identify the nodes in the
score-sorted tree map
+ * @param nodeId Number which is used to identify the nodes in the
score-sorted tree map
* @param resultId Id of the results for which we are retrieving a node
score
* @return node score as a Double
*/
- public double getNodeScore(int nodeIndex, int resultId) {
- Map<Double, List<Integer>> nodeScoreSortedMap =
nodeScoreResultsMap.get(resultId);
+ public double getNodeScore(Long nodeId, int resultId) {
+ Map<Double, List<Long>> nodeScoreSortedMap =
nodeScoreResultsMap.get(resultId);
for (double nodeScore : nodeScoreSortedMap.keySet()) {
- List<Integer> nodes = nodeScoreSortedMap.get(nodeScore);
+ List<Long> nodes = nodeScoreSortedMap.get(nodeScore);
- if (nodes.contains(nodeIndex)) {
+ if (nodes.contains(nodeId)) {
return nodeScore;
}
}
@@ -194,7 +194,7 @@
* @return First key in the nodeScoreSortedMap corresponding to the
highest score
*/
public double getMaxScore(int resultId) {
- SortedMap<Double, List<Integer>> nodeScoreSortedMap =
nodeScoreResultsMap.get(resultId);
+ SortedMap<Double, List<Long>> nodeScoreSortedMap =
nodeScoreResultsMap.get(resultId);
//Since the map is sorted, the first key is the highest value
return nodeScoreSortedMap.firstKey();
@@ -218,7 +218,7 @@
// Initialize
long msTimeBefore = System.currentTimeMillis();
- Map<Integer, NodeInfo> nodeInfoHashMap = new HashMap<Integer,
NodeInfo>(inputNetwork.getNodeCount());
+ Map<Long, NodeInfo> nodeInfoHashMap = new HashMap<Long,
NodeInfo>(inputNetwork.getNodeCount());
// Sort Doubles in descending order
Comparator<Double> scoreComparator = new Comparator<Double>() {
@@ -230,17 +230,17 @@
};
// Will store Doubles (score) as the key, Lists of node indexes
as values
- SortedMap<Double, List<Integer>> nodeScoreSortedMap = new
TreeMap<Double, List<Integer>>(scoreComparator);
+ SortedMap<Double, List<Long>> nodeScoreSortedMap = new
TreeMap<Double, List<Long>>(scoreComparator);
// Iterate over all nodes and calculate MCODE score
NodeInfo nodeInfo = null;
- List<Integer> al = null;
+ List<Long> al = null;
int i = 0;
List<CyNode> nodes = inputNetwork.getNodeList();
for (CyNode n : nodes) {
- nodeInfo = calcNodeInfo(inputNetwork, n.getIndex());
- nodeInfoHashMap.put(n.getIndex(), nodeInfo);
+ nodeInfo = calcNodeInfo(inputNetwork, n.getSUID());
+ nodeInfoHashMap.put(n.getSUID(), nodeInfo);
double nodeScore = scoreNode(nodeInfo);
// Save score for later use in TreeMap
@@ -248,10 +248,10 @@
if (nodeScoreSortedMap.containsKey(nodeScore)) {
// Already have a node with this score, add it
to the list
al = nodeScoreSortedMap.get(nodeScore);
- al.add(n.getIndex());
+ al.add(n.getSUID());
} else {
- al = new ArrayList<Integer>();
- al.add(n.getIndex());
+ al = new ArrayList<Long>();
+ al.add(n.getSUID());
nodeScoreSortedMap.put(nodeScore, al);
}
@@ -283,8 +283,8 @@
* @return An array containing an MCODECluster object for each cluster.
*/
public MCODECluster[] findClusters(CyNetwork inputNetwork, int
resultId) {
- SortedMap<Double, List<Integer>> nodeScoreSortedMap;
- Map<Integer, NodeInfo> nodeInfoHashMap;
+ SortedMap<Double, List<Long>> nodeScoreSortedMap;
+ Map<Long, NodeInfo> nodeInfoHashMap;
// First we check if the network has been scored under this
result title (i.e. scoring
// was required due to a scoring parameter change). If it
hasn't then we want to use the
@@ -317,15 +317,15 @@
// Initialization
long msTimeBefore = System.currentTimeMillis();
- HashMap<Integer, Boolean> nodeSeenHashMap = new
HashMap<Integer, Boolean>(); //key is node ID
- int currentNode = -1;
+ HashMap<Long, Boolean> nodeSeenHashMap = new HashMap<Long,
Boolean>(); //key is node SUID
+ Long currentNode = null;
double findingProgress = 0;
double findingTotal = 0;
- Collection<List<Integer>> values = nodeScoreSortedMap.values();
//returns a Collection sorted by key order (descending)
+ Collection<List<Long>> values = nodeScoreSortedMap.values();
//returns a Collection sorted by key order (descending)
// In order to track the progress without significant lags (for
times when many nodes have the same score
// and no progress is reported) we count all the scored nodes
and track those instead
- for (List<Integer> value : values) {
+ for (List<Long> value : values) {
findingTotal += value.size();
}
@@ -333,7 +333,7 @@
List<MCODECluster> alClusters = new ArrayList<MCODECluster>();
// Iterate over node ids sorted descending by their score
- for (List<Integer> alNodesWithSameScore : values) {
+ for (List<Long> alNodesWithSameScore : values) {
// Each score may be associated with multiple nodes,
iterate over these lists
for (int j = 0; j < alNodesWithSameScore.size(); j++) {
currentNode = alNodesWithSameScore.get(j);
@@ -342,14 +342,14 @@
currentCluster = new MCODECluster();
currentCluster.setSeedNode(currentNode);//store the current node as the seed
node
// We store the current node seen hash
map for later exploration purposes
- Map<Integer, Boolean>
nodeSeenHashMapSnapShot = new HashMap<Integer, Boolean>(nodeSeenHashMap);
+ Map<Long, Boolean>
nodeSeenHashMapSnapShot = new HashMap<Long, Boolean>(nodeSeenHashMap);
// Here we use the original node score
cutoff
- List<Integer> alCluster =
getClusterCore(currentNode,
-
nodeSeenHashMap,
-
params.getNodeScoreCutoff(),
-
params.getMaxDepthFromStart(),
-
nodeInfoHashMap);
+ List<Long> alCluster =
getClusterCore(currentNode,
+
nodeSeenHashMap,
+
params.getNodeScoreCutoff(),
+
params.getMaxDepthFromStart(),
+
nodeInfoHashMap);
if (alCluster.size() > 0) {
// Make sure seed node is part
of cluster, if not already in there
if
(!alCluster.contains(currentNode)) {
@@ -402,15 +402,15 @@
if (MCODEParameterSet.SELECTION.equals(params.getScope())) {
for (MCODECluster cluster : alClusters) {
- List<Integer> alCluster =
cluster.getALCluster();
- List<Integer> alSelectedNodes = new
ArrayList<Integer>();
+ List<Long> alCluster = cluster.getALCluster();
+ List<Long> alSelectedNodes = new
ArrayList<Long>();
for (int i = 0; i <
params.getSelectedNodes().length; i++) {
alSelectedNodes.add(params.getSelectedNodes()[i]);
}
// Method for returning all clusters that
contain any of the selected nodes
- for (Integer nodeIndex : alSelectedNodes) {
+ for (Long nodeIndex : alSelectedNodes) {
if (alCluster.contains(nodeIndex)) {
selectedALClusters.add(cluster);
break;
@@ -449,22 +449,22 @@
int
resultId) {
// This method is similar to the finding method with the
exception of the filtering so that the decrease of the cluster size
// can produce a single node, also the use of the node seen
hash map is differentially applied...
- Map<Integer, NodeInfo> nodeInfoHashMap =
nodeInfoResultsMap.get(resultId);
+ Map<Long, NodeInfo> nodeInfoHashMap =
nodeInfoResultsMap.get(resultId);
MCODEParameterSet params =
mcodeUtil.getCurrentParameters().getResultParams(cluster.getResultId());
- final Map<Integer, Boolean> nodeSeenHashMap;
+ final Map<Long, Boolean> nodeSeenHashMap;
// If the size slider is below the set node score cutoff we use
the node seen hash map so that clusters
// with higher scoring seeds have priority, however when the
slider moves higher than the node score cutoff
// we allow the cluster to accrue nodes from all around without
the priority restriction
if (nodeScoreCutoff <= params.getNodeScoreCutoff()) {
- nodeSeenHashMap = new HashMap<Integer,
Boolean>(cluster.getNodeSeenHashMap());
+ nodeSeenHashMap = new HashMap<Long,
Boolean>(cluster.getNodeSeenHashMap());
} else {
- nodeSeenHashMap = new HashMap<Integer, Boolean>();
+ nodeSeenHashMap = new HashMap<Long, Boolean>();
}
- int seedNode = cluster.getSeedNode();
+ Long seedNode = cluster.getSeedNode();
- List<Integer> alCluster = getClusterCore(seedNode,
nodeSeenHashMap, nodeScoreCutoff, params
+ List<Long> alCluster = getClusterCore(seedNode,
nodeSeenHashMap, nodeScoreCutoff, params
.getMaxDepthFromStart(), nodeInfoHashMap);
// Make sure seed node is part of cluster, if not already in
there
@@ -491,11 +491,11 @@
return cluster;
}
- private CySubNetwork createClusterNetwork(List<Integer> alCluster,
CyNetwork inputNetwork) {
+ private CySubNetwork createClusterNetwork(List<Long> alCluster,
CyNetwork inputNetwork) {
Set<CyNode> nodes = new HashSet<CyNode>();
- for (int index : alCluster) {
- CyNode n = inputNetwork.getNode(index);
+ for (Long id : alCluster) {
+ CyNode n = inputNetwork.getNode(id);
nodes.add(n);
}
@@ -546,11 +546,11 @@
* This is a utility function for the algorithm.
*
* @param inputNetwork The input network for reference
- * @param nodeIndex The index of the node in the input network to
score
+ * @param nodeId The SUID of the node in the input network to score
* @return A NodeInfo object containing node information required for
the algorithm
*/
- private NodeInfo calcNodeInfo(CyNetwork inputNetwork, int nodeIndex) {
- final int[] neighborhood;
+ private NodeInfo calcNodeInfo(CyNetwork inputNetwork, Long nodeId) {
+ final Long[] neighborhood;
String callerID = "MCODEAlgorithm.calcNodeInfo";
@@ -560,7 +560,7 @@
}
// Get neighborhood of this node (including the node)
- CyNode rootNode = inputNetwork.getNode(nodeIndex);
+ CyNode rootNode = inputNetwork.getNode(nodeId);
List<CyNode> neighbors = inputNetwork.getNeighborList(rootNode,
CyEdge.Type.ANY);
if (neighbors.size() < 2) {
@@ -576,20 +576,20 @@
return nodeInfo;
}
- int[] neighborIndexes = new int[neighbors.size()];
+ Long[] neighborIndexes = new Long[neighbors.size()];
int i = 0;
for (CyNode n : neighbors) {
- neighborIndexes[i++] = n.getIndex();
+ neighborIndexes[i++] = n.getSUID();
}
// Add original node to extract complete neighborhood
Arrays.sort(neighborIndexes);
- if (Arrays.binarySearch(neighborIndexes, nodeIndex) < 0) {
- neighborhood = new int[neighborIndexes.length + 1];
+ if (Arrays.binarySearch(neighborIndexes, nodeId) < 0) {
+ neighborhood = new Long[neighborIndexes.length + 1];
System.arraycopy(neighborIndexes, 0, neighborhood, 1,
neighborIndexes.length);
- neighborhood[0] = nodeIndex;
+ neighborhood[0] = nodeId;
neighbors.add(rootNode);
} else {
neighborhood = neighborIndexes;
@@ -644,12 +644,12 @@
* @param nodeInfoHashMap Provides the node scores
* @return A list of node indexes representing the core of the cluster
*/
- private List<Integer> getClusterCore(int startNode,
-
Map<Integer, Boolean> nodeSeenHashMap,
-
double nodeScoreCutoff,
-
int maxDepthFromStart,
-
Map<Integer, NodeInfo> nodeInfoHashMap) {
- List<Integer> cluster = new ArrayList<Integer>(); //stores node
indexes
+ private List<Long> getClusterCore(Long startNode,
+
Map<Long, Boolean> nodeSeenHashMap,
+
double nodeScoreCutoff,
+ int
maxDepthFromStart,
+
Map<Long, NodeInfo> nodeInfoHashMap) {
+ List<Long> cluster = new ArrayList<Long>(); //stores node
indexes
getClusterCoreInternal(startNode,
nodeSeenHashMap,
((NodeInfo)
nodeInfoHashMap.get(startNode)).score,
@@ -675,14 +675,14 @@
* @param nodeInfoHashMap Provides score info
* @return true
*/
- private boolean getClusterCoreInternal(int startNode,
-
Map<Integer, Boolean> nodeSeenHashMap,
+ private boolean getClusterCoreInternal(Long startNode,
+
Map<Long, Boolean> nodeSeenHashMap,
double startNodeScore,
int currentDepth,
-
List<Integer> cluster,
+
List<Long> cluster,
double nodeScoreCutoff,
int maxDepthFromStart,
-
Map<Integer, NodeInfo> nodeInfoHashMap) {
+
Map<Long, NodeInfo> nodeInfoHashMap) {
// base cases for recursion
if (nodeSeenHashMap.containsKey(startNode)) {
return true; //don't recheck a node
@@ -695,7 +695,7 @@
}
// Initialization
- Integer currentNeighbor;
+ Long currentNeighbor;
int numNodeNeighbors =
nodeInfoHashMap.get(startNode).numNodeNeighbors;
int i = 0;
@@ -735,17 +735,17 @@
* @param nodeInfoHashMap Provides neighbour info
* @return true
*/
- private boolean fluffClusterBoundary(List<Integer> cluster,
-
Map<Integer, Boolean> nodeSeenHashMap,
-
Map<Integer, NodeInfo> nodeInfoHashMap) {
- Integer currentNode = null, nodeNeighbor = null;
+ private boolean fluffClusterBoundary(List<Long> cluster,
+
Map<Long, Boolean> nodeSeenHashMap,
+
Map<Long, NodeInfo> nodeInfoHashMap) {
+ Long currentNode = null, nodeNeighbor = null;
// Create a temp list of nodes to add to avoid concurrently
modifying 'cluster'
- List<Integer> nodesToAdd = new ArrayList<Integer>();
+ List<Long> nodesToAdd = new ArrayList<Long>();
// Keep a separate internal nodeSeenHashMap because nodes seen
during a fluffing
// should not be marked as permanently seen,
// they can be included in another cluster's fluffing step.
- Map<Integer, Boolean> nodeSeenHashMapInternal = new
HashMap<Integer, Boolean>();
+ Map<Long, Boolean> nodeSeenHashMapInternal = new HashMap<Long,
Boolean>();
// add all current neighbour's neighbours into cluster (if they
have high enough clustering coefficients) and mark them all as seen
for (int i = 0; i < cluster.size(); i++) {
@@ -795,7 +795,7 @@
* @param cluster The cluster node ID list (in the original
graph)
* @return true
*/
- private boolean haircutCluster(CySubNetwork clusterNetwork,
List<Integer> cluster) {
+ private boolean haircutCluster(CySubNetwork clusterNetwork, List<Long>
cluster) {
// get 2-core
CySubNetwork kCore = getKCore(clusterNetwork, 2);
@@ -804,7 +804,7 @@
cluster.clear();
// must add back the nodes in a way that preserves
gpInputGraph node indices
for (CyNode n : kCore.getNodeList()) {
- cluster.add(n.getIndex());
+ cluster.add(n.getSUID());
}
}
@@ -879,14 +879,14 @@
while (true && !cancelled) {
int numDeleted = 0;
- List<Integer> alCoreNodeIndices = new
ArrayList<Integer>(inputNetwork.getNodeCount());
+ List<Long> alCoreNodeIndices = new
ArrayList<Long>(inputNetwork.getNodeCount());
List<CyNode> nodes = inputNetwork.getNodeList();
for (CyNode n : nodes) {
int degree =
inputNetwork.getAdjacentEdgeList(n, CyEdge.Type.ANY).size();
if (degree >= k) {
- alCoreNodeIndices.add(n.getIndex());
//contains all nodes with degree >= k
+ alCoreNodeIndices.add(n.getSUID());
//contains all nodes with degree >= k
} else {
numDeleted++;
}
@@ -895,7 +895,7 @@
if (numDeleted > 0 || firstLoop) {
Set<CyNode> outputNodes = new HashSet<CyNode>();
- for (int index : alCoreNodeIndices) {
+ for (Long index : alCoreNodeIndices) {
CyNode n = inputNetwork.getNode(index);
outputNodes.add(n);
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODECluster.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODECluster.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODECluster.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -47,11 +47,11 @@
*/
public class MCODECluster {
- private List<Integer> alCluster;
+ private List<Long> alCluster;
private CyNetworkView view; // keeps track of layout so that layout
process doesn't have to be repeated unecessarily
private CySubNetwork network;
- private int seedNode;
- private Map<Integer, Boolean> nodeSeenHashMap; // stores the nodes that
have already been included in higher ranking clusters
+ private Long seedNode;
+ private Map<Long, Boolean> nodeSeenHashMap; // stores the nodes that
have already been included in higher ranking clusters
private double clusterScore;
private String clusterName; // pretty much unused so far, but could
store name by user's input
private int rank;
@@ -100,27 +100,27 @@
this.clusterScore = clusterScore;
}
- public List<Integer> getALCluster() {
+ public List<Long> getALCluster() {
return alCluster;
}
- public void setALCluster(List<Integer> alCluster) {
+ public void setALCluster(List<Long> alCluster) {
this.alCluster = alCluster;
}
- public int getSeedNode() {
+ public Long getSeedNode() {
return seedNode;
}
- public void setSeedNode(Integer seedNode) {
+ public void setSeedNode(Long seedNode) {
this.seedNode = seedNode;
}
- public Map<Integer, Boolean> getNodeSeenHashMap() {
+ public Map<Long, Boolean> getNodeSeenHashMap() {
return nodeSeenHashMap;
}
- public void setNodeSeenHashMap(Map<Integer, Boolean> nodeSeenHashMap) {
+ public void setNodeSeenHashMap(Map<Long, Boolean> nodeSeenHashMap) {
this.nodeSeenHashMap = nodeSeenHashMap;
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEParameterSet.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEParameterSet.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEParameterSet.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -47,7 +47,7 @@
public static String NETWORK = "network";
public static String SELECTION = "selection";
private String scope;
- private Integer[] selectedNodes;
+ private Long[] selectedNodes;
//used in scoring stage
private boolean includeLoops;
@@ -105,7 +105,7 @@
* @param fluffNodeDensityCutoff fluff node density cutoff
*/
public MCODEParameterSet(String scope,
- Integer[]
selectedNodes,
+ Long[] selectedNodes,
boolean includeLoops,
int degreeCutoff,
int kCore,
@@ -136,7 +136,7 @@
* Method for setting all parameters to their default values
*/
public void setDefaultParams() {
- setAllAlgorithmParams(NETWORK, new Integer[0], false, 2, 2,
false, 100, 0.2, false, true, 0.1);
+ setAllAlgorithmParams(NETWORK, new Long[0], false, 2, 2, false,
100, 0.2, false, true, 0.1);
}
/**
@@ -155,7 +155,7 @@
* @param fluffNodeDensityCutoff fluff node density cutoff
*/
public void setAllAlgorithmParams(String scope,
-
Integer[] selectedNodes,
+
Long[] selectedNodes,
boolean includeLoops,
int
degreeCutoff,
int
kCore,
@@ -211,11 +211,11 @@
this.scope = scope;
}
- public Integer[] getSelectedNodes() {
+ public Long[] getSelectedNodes() {
return selectedNodes;
}
- public void setSelectedNodes(Integer[] selectedNodes) {
+ public void setSelectedNodes(Long[] selectedNodes) {
this.selectedNodes = selectedNodes;
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/task/MCODEAnalyzeTaskFactory.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/task/MCODEAnalyzeTaskFactory.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/task/MCODEAnalyzeTaskFactory.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -35,4 +35,9 @@
return new TaskIterator(new MCODEAnalyzeTask(network, analyze,
resultId, alg, mcodeUtil, listener));
}
+ @Override
+ public boolean isReady() {
+ // TODO Auto-generated method stub
+ return true;
+ }
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -1,6 +1,23 @@
package org.cytoscape.mcode.internal.util;
-import static org.cytoscape.view.presentation.property.BasicVisualLexicon.*;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.EDGE_PAINT;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.EDGE_SELECTED_PAINT;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.EDGE_STROKE_SELECTED_PAINT;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.EDGE_STROKE_UNSELECTED_PAINT;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.EDGE_UNSELECTED_PAINT;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.EDGE_WIDTH;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NETWORK_BACKGROUND_PAINT;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NETWORK_HEIGHT;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NETWORK_WIDTH;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_BORDER_WIDTH;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_FILL_COLOR;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_HEIGHT;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_PAINT;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_SHAPE;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_SIZE;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_WIDTH;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_X_LOCATION;
+import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_Y_LOCATION;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -46,12 +63,12 @@
import org.cytoscape.mcode.internal.view.MCODELoader;
import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyEdge;
+import org.cytoscape.model.CyIdentifiable;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyRow;
import org.cytoscape.model.CyTable;
-import org.cytoscape.model.CyTableEntry;
import org.cytoscape.model.subnetwork.CyRootNetwork;
import org.cytoscape.model.subnetwork.CyRootNetworkManager;
import org.cytoscape.model.subnetwork.CySubNetwork;
@@ -365,7 +382,7 @@
nv.setVisualProperty(NODE_Y_LOCATION, y);
// Node shape
- if (cluster.getSeedNode() == nv.getModel().getIndex()) {
+ if (cluster.getSeedNode() == nv.getModel().getSUID()) {
nv.setLockedValue(NODE_SHAPE,
NodeShapeVisualProperty.RECTANGLE);
} else {
nv.setLockedValue(NODE_SHAPE,
NodeShapeVisualProperty.ELLIPSE);
@@ -607,11 +624,11 @@
}
@SuppressWarnings("unchecked")
- public void setSelected(final Collection<? extends CyTableEntry>
elements, CyNetwork network, CyNetworkView view) {
- Collection<? extends CyTableEntry> allElements = new
ArrayList<CyTableEntry>(network.getNodeList());
+ public void setSelected(final Collection<? extends CyIdentifiable>
elements, CyNetwork network, CyNetworkView view) {
+ Collection<? extends CyIdentifiable> allElements = new
ArrayList<CyIdentifiable>(network.getNodeList());
allElements.addAll((Collection) network.getEdgeList());
- for (final CyTableEntry nodeOrEdge : allElements) {
+ for (final CyIdentifiable nodeOrEdge : allElements) {
boolean select = elements.contains(nodeOrEdge);
network.getRow(nodeOrEdge).set(CyNetwork.SELECTED,
select);
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/layout/NodeDistances.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/layout/NodeDistances.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/layout/NodeDistances.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -39,7 +39,7 @@
protected String statusMessage;
protected boolean done;
protected boolean canceled;
- protected Map<Integer, Integer> nodeIndexToMatrixIndexMap; // a root
node index to matrix
+ protected Map<Long, Integer> nodeIndexToMatrixIndexMap; // a root node
index to matrix
/**
* The main constructor
@@ -48,7 +48,7 @@
* @param network The <code>org.cytoscape.model.CyNetwork</code> in
which the nodes reside
* @param nodeIndexToMatrixIndexMap An index map that maps your root
graph indices to the returned matrix indices
*/
- public NodeDistances(List<CyNode> nodesList, CyNetwork network,
Map<Integer, Integer> nodeIndexToMatrixIndexMap) {
+ public NodeDistances(List<CyNode> nodesList, CyNetwork network,
Map<Long, Integer> nodeIndexToMatrixIndexMap) {
this.nodesList = nodesList;
this.nodeIndexToMatrixIndexMap = nodeIndexToMatrixIndexMap;
this.network = network;
@@ -174,7 +174,7 @@
continue;
}
- index =
nodeIndexToMatrixIndexMap.get(from_node.getIndex());
+ index =
nodeIndexToMatrixIndexMap.get(from_node.getSUID());
if ((index < 0) || (index >= nodes.length)) {
System.err.println("WARNING: GraphNode \"" +
from_node +
@@ -285,7 +285,7 @@
return this.distances;
}
- neighbor_index =
nodeIndexToMatrixIndexMap.get(neighbor.getIndex());
+ neighbor_index =
nodeIndexToMatrixIndexMap.get(neighbor.getSUID());
// If this neighbor was not in the
incoming List, we cannot include it in any paths.
if (nodes[neighbor_index] == null) {
@@ -331,15 +331,15 @@
if (edges == null || edges.size() == 0) return result;
- int targetIndex = node.getIndex();
+ Long targetID = node.getSUID();
for (CyEdge curEdge : edges) {
- if (curEdge.getSource().getIndex() != targetIndex) {
+ if (curEdge.getSource().getSUID() != targetID) {
result.add(curEdge.getSource());
continue;
}
- if (curEdge.getTarget().getIndex() != targetIndex)
result.add(curEdge.getTarget());
+ if (curEdge.getTarget().getSUID() != targetID)
result.add(curEdge.getTarget());
}
return result;
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/layout/SpringEmbeddedLayouter.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/layout/SpringEmbeddedLayouter.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/layout/SpringEmbeddedLayouter.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -61,9 +61,9 @@
protected int layoutPass;
//maps a root graph index to a distance matrix index
- protected Map<Integer, Integer> nodeIndexToMatrixIndexMap;
+ protected Map<Long, Integer> nodeIndexToMatrixIndexMap;
//maps a distance matrix index to a root graph instance
- protected SortedMap<Integer, Integer> matrixIndexToNodeIndexMap;
+ protected SortedMap<Integer, Long> matrixIndexToNodeIndexMap;
private boolean interrupted;
@@ -110,16 +110,16 @@
edgeCount = graphView.getModel().getEdgeCount();
// Initialize the index map
- nodeIndexToMatrixIndexMap = new HashMap<Integer, Integer>();
- matrixIndexToNodeIndexMap = new TreeMap<Integer, Integer>();
+ nodeIndexToMatrixIndexMap = new HashMap<Long, Integer>();
+ matrixIndexToNodeIndexMap = new TreeMap<Integer, Long>();
Iterator<CyNode> nodes =
graphView.getModel().getNodeList().iterator();
int count = 0;
while (nodes.hasNext()) {
CyNode n = nodes.next();
- nodeIndexToMatrixIndexMap.put(n.getIndex(), count);
- matrixIndexToNodeIndexMap.put(count, n.getIndex());
+ nodeIndexToMatrixIndexMap.put(n.getSUID(), count);
+ matrixIndexToNodeIndexMap.put(count, n.getSUID());
count++;
}
@@ -205,11 +205,11 @@
//create a list of nodes that has the same indices as the
nodeIndexToMatrixIndexMap
List<CyNode> nodeList = new ArrayList<CyNode>();
- Collection<Integer> matrixIndices =
matrixIndexToNodeIndexMap.values();
+ Collection<Long> matrixIndices =
matrixIndexToNodeIndexMap.values();
int i = 0;
- for (int nodeIndex : matrixIndices) {
- nodeList.add(i,
graphView.getModel().getNode(nodeIndex));
+ for (Long nodeId : matrixIndices) {
+ nodeList.add(i, graphView.getModel().getNode(nodeId));
i++;
}
@@ -277,7 +277,7 @@
View<CyNode> nodeView = partials.getNodeView();
- int node_view_index =
nodeIndexToMatrixIndexMap.get(nodeView.getModel().getIndex());
+ int node_view_index =
nodeIndexToMatrixIndexMap.get(nodeView.getModel().getSUID());
double node_view_radius =
nodeView.getVisualProperty(NODE_WIDTH);
double node_view_x =
nodeView.getVisualProperty(NODE_X_LOCATION);
double node_view_y =
nodeView.getVisualProperty(NODE_Y_LOCATION);
@@ -312,11 +312,11 @@
other_node_view =
other_node_partials.getNodeView();
}
- if (nodeView.getModel().getIndex() ==
other_node_view.getModel().getIndex()) {
+ if (nodeView.getModel().getSUID() ==
other_node_view.getModel().getSUID()) {
continue;
}
- other_node_view_index =
nodeIndexToMatrixIndexMap.get(other_node_view.getModel().getIndex());
+ other_node_view_index =
nodeIndexToMatrixIndexMap.get(other_node_view.getModel().getSUID());
other_node_view_radius =
Math.max(other_node_view.getVisualProperty(NODE_WIDTH),
other_node_view.getVisualProperty(NODE_HEIGHT));
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/view/MCODEResultsPanel.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/view/MCODEResultsPanel.java
2012-05-02 20:18:44 UTC (rev 29083)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/view/MCODEResultsPanel.java
2012-05-02 21:40:21 UTC (rev 29084)
@@ -65,6 +65,7 @@
import org.cytoscape.mcode.internal.util.MCODEUtil;
import org.cytoscape.mcode.internal.util.layout.SpringEmbeddedLayouter;
import org.cytoscape.model.CyColumn;
+import org.cytoscape.model.CyIdentifiable;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyRow;
@@ -421,7 +422,7 @@
*/
public double setNodeAttributesAndGetMaxScore() {
for (CyNode n : network.getNodeList()) {
- int rgi = n.getIndex();
+ Long rgi = n.getSUID();
CyTable netNodeTbl = network.getDefaultNodeTable();
if (netNodeTbl.getColumn("MCODE_Cluster") == null)
@@ -433,7 +434,7 @@
CyRow nodeRow = network.getRow(n);
nodeRow.set("MCODE_Node_Status", "Unclustered");
- nodeRow.set("MCODE_Score",
alg.getNodeScore(n.getIndex(), resultId));
+ nodeRow.set("MCODE_Score",
alg.getNodeScore(n.getSUID(), resultId));
for (int c = 0; c < clusters.length; c++) {
MCODECluster cluster = clusters[c];
@@ -932,7 +933,7 @@
JOptionPane.INFORMATION_MESSAGE);
}
} else {
- mcodeUtil.setSelected(new ArrayList<CyNode>(), network,
networkView); // deselect all
+ mcodeUtil.setSelected(new ArrayList<CyIdentifiable>(),
network, networkView); // deselect all
}
}
@@ -1048,7 +1049,7 @@
double nodeScoreCutoff = (((double) source.getValue())
/ 1000);
// Store current cluster content for comparison
- List<Integer> oldCluster =
clusters[selectedRow].getALCluster();
+ List<Long> oldCluster =
clusters[selectedRow].getALCluster();
// Find the new cluster given the node score cutoff
MCODECluster cluster =
alg.exploreCluster(clusters[selectedRow], nodeScoreCutoff, network, resultId);
@@ -1056,7 +1057,7 @@
// We only want to do the following work if the newly
found cluster
// is actually different
// So we get the new cluster content
- List<Integer> newCluster = cluster.getALCluster();
+ List<Long> newCluster = cluster.getALCluster();
// If the new cluster is too large to draw within a
reasonable time
// and won't look understandable in the table cell then
we draw a place holder
--
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.