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"));
}
Aggregations