Search in sources :

Example 1 with EdgeSimilarities

use of org.baderlab.csplugins.enrichmentmap.integration.EdgeSimilarities in project EnrichmentMapApp by BaderLab.

the class CreateEnrichmentMapTaskTest method testEnrichmentMapBuildMapTask.

@Test
public void testEnrichmentMapBuildMapTask() throws Exception {
    String geneSetsFile = TestUtils.createTempFile(PATH, "gene_sets.gmt").getAbsolutePath();
    String expressionFile = TestUtils.createTempFile(PATH, "FakeExpression.txt").getAbsolutePath();
    String enrichmentFile = TestUtils.createTempFile(PATH, "fakeEnrichments.txt").getAbsolutePath();
    String rankFile = TestUtils.createTempFile(PATH, "FakeRank.rnk").getAbsolutePath();
    PropertyManager pm = new PropertyManager();
    EMCreationParameters params = new EMCreationParameters("EM1_", pm.getDefaultPvalue(), pm.getDefaultQvalue(), NESFilter.ALL, Optional.empty(), SimilarityMetric.JACCARD, pm.getDefaultJaccardCutOff(), pm.getDefaultCombinedConstant());
    DataSetFiles dataset1files = new DataSetFiles();
    dataset1files.setGMTFileName(geneSetsFile);
    dataset1files.setExpressionFileName(expressionFile);
    dataset1files.setEnrichmentFileName1(enrichmentFile);
    dataset1files.setRankedFile(rankFile);
    buildEnrichmentMap(params, dataset1files, LegacySupport.DATASET1);
    // Assert the network is as expected
    Set<CyNetwork> networks = networkManager.getNetworkSet();
    assertEquals(1, networks.size());
    CyNetwork network = networks.iterator().next();
    Map<String, CyNode> nodes = TestUtils.getNodes(network);
    assertEquals(4, nodes.size());
    assertTrue(nodes.containsKey("BOTTOM8_PLUS100"));
    assertTrue(nodes.containsKey("MIDDLE8_PLUS100"));
    assertTrue(nodes.containsKey("TOP8_PLUS100"));
    assertTrue(nodes.containsKey("TOP1_PLUS100"));
    EdgeSimilarities edges = TestUtils.getEdgeSimilarities(network);
    assertEquals(6, edges.size());
    assertTrue(edges.containsEdge("MIDDLE8_PLUS100", "Geneset_Overlap", "BOTTOM8_PLUS100"));
    assertTrue(edges.containsEdge("TOP8_PLUS100", "Geneset_Overlap", "MIDDLE8_PLUS100"));
    assertTrue(edges.containsEdge("TOP8_PLUS100", "Geneset_Overlap", "BOTTOM8_PLUS100"));
    assertTrue(edges.containsEdge("TOP1_PLUS100", "Geneset_Overlap", "TOP8_PLUS100"));
    assertTrue(edges.containsEdge("TOP1_PLUS100", "Geneset_Overlap", "MIDDLE8_PLUS100"));
    assertTrue(edges.containsEdge("TOP1_PLUS100", "Geneset_Overlap", "BOTTOM8_PLUS100"));
}
Also used : EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) PropertyManager(org.baderlab.csplugins.enrichmentmap.PropertyManager) CyNetwork(org.cytoscape.model.CyNetwork) CyNode(org.cytoscape.model.CyNode) EdgeSimilarities(org.baderlab.csplugins.enrichmentmap.integration.EdgeSimilarities) DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles) BaseIntegrationTest(org.baderlab.csplugins.enrichmentmap.integration.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

PropertyManager (org.baderlab.csplugins.enrichmentmap.PropertyManager)1 BaseIntegrationTest (org.baderlab.csplugins.enrichmentmap.integration.BaseIntegrationTest)1 EdgeSimilarities (org.baderlab.csplugins.enrichmentmap.integration.EdgeSimilarities)1 DataSetFiles (org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)1 EMCreationParameters (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters)1 CyNetwork (org.cytoscape.model.CyNetwork)1 CyNode (org.cytoscape.model.CyNode)1 Test (org.junit.Test)1