use of ca.utoronto.tdccbr.mcode.internal.model.MCODECluster in project MCODE by BaderLab.
the class AbstractMCODETest method findClusters.
protected List<MCODECluster> findClusters(CyNetwork net, MCODEParameters params) {
final int resultId = resultsMgr.getNextResultId();
mcodeUtil.getParameterManager().setParams(params, resultId, net);
alg = new MCODEAlgorithm(net.getSUID(), mcodeUtil);
alg.scoreGraph(net, resultId);
List<MCODECluster> clusters = alg.findClusters(net, resultId);
if (!clusters.isEmpty()) {
MCODEResult res = resultsMgr.createResult(net, params.copy(), clusters);
resultsMgr.addResult(res);
}
return clusters;
}
use of ca.utoronto.tdccbr.mcode.internal.model.MCODECluster in project MCODE by BaderLab.
the class MCODEAlgorithmTest method testCompleteGraphIncludingLoops.
@Test
public void testCompleteGraphIncludingLoops() {
CyNetwork net = createCompleteGraph(16);
int resultId = resultsMgr.getNextResultId();
MCODEParameters params = new MCODEParameters();
params.setIncludeLoops(true);
List<MCODECluster> clusters = findClusters(net, params);
assertEquals(1, clusters.size());
MCODECluster c = clusters.get(0);
CySubNetwork cn = c.getNetwork();
assertNotNull(cn);
assertEquals(resultId, c.getResultId());
assertEquals(14.118, c.getScore(), 0.0009);
assertEquals(16, cn.getNodeCount());
assertEquals(120, cn.getEdgeCount());
assertNotNull(c.getSeedNode());
// TODO: fix
// check scores of all nodes
// for (CyNode n : cn.getNodeList()) {
// assertEquals(13.345, alg.getNodeScore(n.getSUID(), resultId), 0.001);
// }
}
use of ca.utoronto.tdccbr.mcode.internal.model.MCODECluster in project MCODE by BaderLab.
the class MCODEUtilTest method testDisposeUnnusedNetworks.
@Test
public void testDisposeUnnusedNetworks() {
final CyNetwork net = createCompleteGraph(16);
final CyRootNetwork rn = netViewTestSupport.getRootNetworkFactory().getRootNetwork(net);
int originalNetCount = rn.getSubNetworkList().size();
final List<MCODECluster> clusters = findClusters(net);
assertEquals(1, clusters.size());
MCODEResult res = resultsMgr.createResult(net, new MCODEParameters(), clusters);
mcodeUtil.disposeUnusedNetworks(Collections.singleton(res));
assertEquals(originalNetCount + clusters.size(), rn.getSubNetworkList().size());
}
use of ca.utoronto.tdccbr.mcode.internal.model.MCODECluster in project MCODE by BaderLab.
the class MCODEAlgorithmTest method testCompleteGraphWithDefaultParameters.
@Test
public void testCompleteGraphWithDefaultParameters() {
CyNetwork net = createCompleteGraph(16);
int resultId = resultsMgr.getNextResultId();
List<MCODECluster> clusters = findClusters(net);
assertEquals(1, clusters.size());
MCODECluster c = clusters.get(0);
CySubNetwork cn = c.getNetwork();
assertNotNull(cn);
assertEquals(resultId, c.getResultId());
assertEquals(16, c.getScore(), 0.0);
assertEquals(16, cn.getNodeCount());
assertEquals(120, cn.getEdgeCount());
assertNotNull(c.getSeedNode());
// check scores of the nodes
for (CyNode n : cn.getNodeList()) {
assertEquals(15.0, alg.getNodeScore(n.getSUID(), resultId), 0.0);
}
}
Aggregations