Author: clopes
Date: 2012-07-27 12:56:05 -0700 (Fri, 27 Jul 2012)
New Revision: 30026
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEAlgorithm.java
csplugins/trunk/toronto/clopes/mcode/src/test/java/org/cytoscape/mcode/internal/model/MCODEAlgorithmTest.java
Log:
Fixed bug that was setting "false" to the includeLoops parameter when
calculating the cluster's score, rather than getting the value from the current
parameters set.
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-07-27 19:38:19 UTC (rev 30025)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/model/MCODEAlgorithm.java
2012-07-27 19:56:05 UTC (rev 30026)
@@ -209,7 +209,6 @@
* @param resultId Title of the result, used as an identifier in
various hash maps
*/
public void scoreGraph(CyNetwork inputNetwork, int resultId) {
- params = getParams();
String callerID = "MCODEAlgorithm.MCODEAlgorithm";
if (inputNetwork == null) {
@@ -302,7 +301,6 @@
nodeInfoHashMap = nodeInfoResultsMap.get(resultId);
}
- params = getParams();
MCODECluster currentCluster;
String callerID = "MCODEAlgorithm.findClusters";
@@ -535,7 +533,7 @@
double density = 0.0, score = 0.0;
numNodes = cluster.getNetwork().getNodeCount();
- density = calcDensity(cluster.getNetwork(), true);
+ density = calcDensity(cluster.getNetwork(),
params.isIncludeLoops());
score = density * numNodes;
return score;
Modified:
csplugins/trunk/toronto/clopes/mcode/src/test/java/org/cytoscape/mcode/internal/model/MCODEAlgorithmTest.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/test/java/org/cytoscape/mcode/internal/model/MCODEAlgorithmTest.java
2012-07-27 19:38:19 UTC (rev 30025)
+++
csplugins/trunk/toronto/clopes/mcode/src/test/java/org/cytoscape/mcode/internal/model/MCODEAlgorithmTest.java
2012-07-27 19:56:05 UTC (rev 30026)
@@ -114,7 +114,7 @@
}
@Test
- public void testCompleteGraph() {
+ public void testCompleteGraphWithDefaultParameters() {
CyNetwork net = createCompleteGraph(16);
int resultId = 1;
MCODECluster[] clusters = findClusters(net, resultId);
@@ -126,7 +126,7 @@
assertNotNull(cn);
assertEquals(resultId, c.getResultId());
- assertEquals(14.118, c.getClusterScore(), 0.001);
+ assertEquals(16, c.getClusterScore(), 0.0);
assertEquals(16, cn.getNodeCount());
assertEquals(120, cn.getEdgeCount());
assertNotNull(c.getSeedNode());
@@ -137,8 +137,40 @@
}
}
+ @Test
+ public void testCompleteGraphIncludingLoops() {
+ CyNetwork net = createCompleteGraph(16);
+ int resultId = 1;
+ MCODEParameterSet params = new MCODEParameterSet();
+ params.setIncludeLoops(true);
+
+ MCODECluster[] clusters = findClusters(net, resultId, params);
+
+ assertEquals(1, clusters.length);
+
+ MCODECluster c = clusters[0];
+ CySubNetwork cn = c.getNetwork();
+
+ assertNotNull(cn);
+ assertEquals(resultId, c.getResultId());
+ assertEquals(14.118, c.getClusterScore(), 0.0009);
+ assertEquals(16, cn.getNodeCount());
+ assertEquals(120, cn.getEdgeCount());
+ assertNotNull(c.getSeedNode());
+
+ // TODO: fix
+ // check scores of the nodes
+// for (CyNode n : cn.getNodeList()) {
+// assertEquals(13.345, alg.getNodeScore(n.getSUID(),
resultId), 0.001);
+// }
+ }
+
private MCODECluster[] findClusters(CyNetwork net, int resultId) {
- mcodeUtil.getCurrentParameters().setParams(new
MCODEParameterSet(), resultId, net.getSUID());
+ return findClusters(net, resultId, new MCODEParameterSet());
+ }
+
+ private MCODECluster[] findClusters(CyNetwork net, int resultId,
MCODEParameterSet params) {
+ mcodeUtil.getCurrentParameters().setParams(params, resultId,
net.getSUID());
alg = new MCODEAlgorithm(net.getSUID(), mcodeUtil);
alg.scoreGraph(net, resultId);
--
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.