Search in sources :

Example 1 with MCODECluster

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;
}
Also used : MCODEAlgorithm(ca.utoronto.tdccbr.mcode.internal.model.MCODEAlgorithm) MCODECluster(ca.utoronto.tdccbr.mcode.internal.model.MCODECluster) MCODEResult(ca.utoronto.tdccbr.mcode.internal.model.MCODEResult)

Example 2 with MCODECluster

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);
// }
}
Also used : MCODEParameters(ca.utoronto.tdccbr.mcode.internal.model.MCODEParameters) MCODECluster(ca.utoronto.tdccbr.mcode.internal.model.MCODECluster) CyNetwork(org.cytoscape.model.CyNetwork) CySubNetwork(org.cytoscape.model.subnetwork.CySubNetwork) AbstractMCODETest(org.cytoscape.mcode.internal.AbstractMCODETest) Test(org.junit.Test)

Example 3 with MCODECluster

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());
}
Also used : MCODEParameters(ca.utoronto.tdccbr.mcode.internal.model.MCODEParameters) MCODECluster(ca.utoronto.tdccbr.mcode.internal.model.MCODECluster) MCODEResult(ca.utoronto.tdccbr.mcode.internal.model.MCODEResult) CyNetwork(org.cytoscape.model.CyNetwork) CyRootNetwork(org.cytoscape.model.subnetwork.CyRootNetwork) AbstractMCODETest(org.cytoscape.mcode.internal.AbstractMCODETest) Test(org.junit.Test)

Example 4 with MCODECluster

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);
    }
}
Also used : MCODECluster(ca.utoronto.tdccbr.mcode.internal.model.MCODECluster) CyNetwork(org.cytoscape.model.CyNetwork) CyNode(org.cytoscape.model.CyNode) CySubNetwork(org.cytoscape.model.subnetwork.CySubNetwork) AbstractMCODETest(org.cytoscape.mcode.internal.AbstractMCODETest) Test(org.junit.Test)

Aggregations

MCODECluster (ca.utoronto.tdccbr.mcode.internal.model.MCODECluster)4 AbstractMCODETest (org.cytoscape.mcode.internal.AbstractMCODETest)3 CyNetwork (org.cytoscape.model.CyNetwork)3 Test (org.junit.Test)3 MCODEParameters (ca.utoronto.tdccbr.mcode.internal.model.MCODEParameters)2 MCODEResult (ca.utoronto.tdccbr.mcode.internal.model.MCODEResult)2 CySubNetwork (org.cytoscape.model.subnetwork.CySubNetwork)2 MCODEAlgorithm (ca.utoronto.tdccbr.mcode.internal.model.MCODEAlgorithm)1 CyNode (org.cytoscape.model.CyNode)1 CyRootNetwork (org.cytoscape.model.subnetwork.CyRootNetwork)1