Search in sources :

Example 1 with SessionFile

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

the class LegacySessionLoadTest method testSavingSession.

@Ignore
@SessionFile("em_session_2.2.cys")
public void testSavingSession() throws Exception {
    EnrichmentMapManager emManager = injector.getInstance(EnrichmentMapManager.class);
    Map<Long, EnrichmentMap> maps = emManager.getAllEnrichmentMaps();
    assertEquals(1, maps.size());
    SessionModelIO listener = injector.getInstance(SessionModelIO.class);
    listener.saveModel();
}
Also used : EnrichmentMapManager(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager) SessionModelIO(org.baderlab.csplugins.enrichmentmap.model.io.SessionModelIO) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) Ignore(org.junit.Ignore) SessionFile(org.baderlab.csplugins.enrichmentmap.integration.SessionFile)

Example 2 with SessionFile

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

the class LegacySessionLoadTest method test_1_LoadedLegacyData.

@Test
@SessionFile("em_session_2.2.cys")
public void test_1_LoadedLegacyData() throws Exception {
    EnrichmentMap map = getEnrichmentMap();
    assertEquals("EM1_Enrichment Map", map.getName());
    CyNetwork network = networkManager.getNetwork(map.getNetworkID());
    assertNotNull(network);
    assertEquals(1, map.getDataSetCount());
    assertEquals(14067, map.getNumberOfGenes());
    assertEquals(14067, map.getAllGenes().size());
    // Number of edges: 3339 - that's how many geneset similarity objects there should be!!!
    CyTable edgeTable = network.getDefaultEdgeTable();
    assertEquals(3339, edgeTable.getRowCount());
    EMCreationParameters params = map.getParams();
    String prefix = params.getAttributePrefix();
    assertEquals("EM1_", prefix);
    assertEquals(0.5, params.getCombinedConstant(), 0.0);
    assertFalse(params.isEMgmt());
    assertEquals("Geneset_Overlap", params.getEnrichmentEdgeType());
    assertTrue(params.isFDR());
    assertEquals(GreatFilter.HYPER, params.getGreatFilter());
    assertEquals(0.005, params.getPvalue(), 0.0);
    assertEquals(1.0, params.getPvalueMin(), 0.0);
    assertEquals(0.1, params.getQvalue(), 0.0);
    assertEquals(1.0, params.getQvalueMin(), 0.0);
    assertEquals(0.5, params.getSimilarityCutoff(), 0.0);
    assertEquals(SimilarityMetric.OVERLAP, params.getSimilarityMetric());
    //		assertFalse(params.isDistinctExpressionSets());
    String geneset1 = "RESOLUTION OF SISTER CHROMATID COHESION%REACTOME%REACT_150425.2";
    String geneset2 = "CHROMOSOME, CENTROMERIC REGION%GO%GO:0000775";
    Collection<CyRow> rows = edgeTable.getMatchingRows(CyNetwork.NAME, geneset1 + " (Geneset_Overlap) " + geneset2);
    assertEquals(1, rows.size());
    CyRow row = rows.iterator().next();
    assertEquals("Geneset_Overlap", row.get(CyEdge.INTERACTION, String.class));
    assertEquals(0.6097560975609756, EMStyleBuilder.Columns.EDGE_SIMILARITY_COEFF.get(row, prefix), 0.0);
    EMDataSet dataset = map.getDataSet("Dataset 1");
    assertNotNull(dataset);
    assertSame(map, dataset.getMap());
    assertEquals(Method.GSEA, dataset.getMethod());
    assertEquals(12653, dataset.getDataSetGenes().size());
    assertEquals(389, dataset.getGeneSetsOfInterest().getGeneSets().size());
    //		assertEquals(17259, dataset.getSetofgenesets().getGenesets().size()); // MKTODO why? what is this used for
    assertEndsWith(dataset.getSetOfGeneSets().getFilename(), "Human_GO_AllPathways_no_GO_iea_April_15_2013_symbol.gmt");
    for (long suid : dataset.getNodeSuids()) {
        assertNotNull(network.getNode(suid));
    }
    GeneSet geneset = dataset.getGeneSetsOfInterest().getGeneSets().get("NCRNA PROCESSING%GO%GO:0034470");
    assertEquals(88, geneset.getGenes().size());
    assertEquals("NCRNA PROCESSING%GO%GO:0034470", geneset.getName());
    assertEquals("ncRNA processing", geneset.getDescription());
    assertEquals(Optional.of("GO"), geneset.getSource());
    SetOfEnrichmentResults enrichments = dataset.getEnrichments();
    assertEquals(4756, enrichments.getEnrichments().size());
    assertEndsWith(enrichments.getFilename1(), "gsea_report_for_ES12_1473194913081.xls");
    assertEndsWith(enrichments.getFilename2(), "gsea_report_for_NT12_1473194913081.xls");
    assertEquals("ES12", enrichments.getPhenotype1());
    assertEquals("NT12", enrichments.getPhenotype2());
    EnrichmentResult result = enrichments.getEnrichments().get("RIBONUCLEOSIDE TRIPHOSPHATE BIOSYNTHETIC PROCESS%GO%GO:0009201");
    assertTrue(result instanceof GSEAResult);
    GSEAResult gseaResult = (GSEAResult) result;
    assertEquals("RIBONUCLEOSIDE TRIPHOSPHATE BIOSYNTHETIC PROCESS%GO%GO:0009201", gseaResult.getName());
    assertEquals(0.42844063, gseaResult.getES(), 0.0);
    assertEquals(0.45225498, gseaResult.getFdrqvalue(), 0.0);
    assertEquals(1.0, gseaResult.getFwerqvalue(), 0.0);
    assertEquals(23, gseaResult.getGsSize());
    assertEquals(1.1938541, gseaResult.getNES(), 0.0);
    assertEquals(0.2457786, gseaResult.getPvalue(), 0.0);
    assertEquals(4689, gseaResult.getRankAtMax());
    assertEquals(Optional.of("GO"), gseaResult.getSource());
    GeneExpressionMatrix expressions = dataset.getExpressionSets();
    assertEquals(20326, expressions.getExpressionUniverse());
    assertEquals(3.686190609, expressions.getClosesttoZero(), 0.0);
    //		assertEndsWith(expressions.getFilename(), "MCF7_ExprMx_v2_names.gct");
    assertEquals(15380.42388, expressions.getMaxExpression(), 0.0);
    assertEquals(3.686190609, expressions.getMinExpression(), 0.0);
    assertEquals(20, expressions.getNumConditions());
    assertEquals(12653, expressions.getExpressionMatrix().size());
    assertEquals(12653, expressions.getExpressionMatrix_rowNormalized().size());
    GeneExpression expression = expressions.getExpressionMatrix().get(0);
    assertEquals("MOCOS", expression.getName());
    assertEquals("MOCOS (molybdenum cofactor sulfurase)", expression.getDescription());
    assertEquals(18, expression.getExpression().length);
    Ranking ranking = expressions.getRanks().get("GSEARanking");
    assertEquals(12653, ranking.getAllRanks().size());
    assertEquals(12653, ranking.getRanking().size());
    Rank rank = ranking.getRanking().get(0);
    assertEquals("MOCOS", rank.getName());
    assertEquals(1238, rank.getRank().intValue());
    assertEquals(0.54488367, rank.getScore(), 0.0);
    DataSetFiles files = dataset.getDataSetFiles();
    assertEndsWith(files.getClassFile(), "ES_NT.cls");
    assertEndsWith(files.getEnrichmentFileName1(), "gsea_report_for_ES12_1473194913081.xls");
    assertEndsWith(files.getEnrichmentFileName2(), "gsea_report_for_NT12_1473194913081.xls");
    //		assertEndsWith(files.getExpressionFileName(), "MCF7_ExprMx_v2_names.gct");
    assertEndsWith(files.getGMTFileName(), "Human_GO_AllPathways_no_GO_iea_April_15_2013_symbol.gmt");
    assertEndsWith(files.getGseaHtmlReportFile(), "estrogen_treatment_12hr_gsea_enrichment_results.Gsea.1473194913081/index.html");
    assertEndsWith(files.getRankedFile(), "ranked_gene_list_ES12_versus_NT12_1473194913081.xls");
    assertEquals("ES12", files.getPhenotype1());
    assertEquals("NT12", files.getPhenotype2());
}
Also used : EnrichmentResult(org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult) EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) GSEAResult(org.baderlab.csplugins.enrichmentmap.model.GSEAResult) CyNetwork(org.cytoscape.model.CyNetwork) Rank(org.baderlab.csplugins.enrichmentmap.model.Rank) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) CyRow(org.cytoscape.model.CyRow) GeneExpressionMatrix(org.baderlab.csplugins.enrichmentmap.model.GeneExpressionMatrix) CyTable(org.cytoscape.model.CyTable) Ranking(org.baderlab.csplugins.enrichmentmap.model.Ranking) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) GeneSet(org.baderlab.csplugins.enrichmentmap.model.GeneSet) GeneExpression(org.baderlab.csplugins.enrichmentmap.model.GeneExpression) DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles) SetOfEnrichmentResults(org.baderlab.csplugins.enrichmentmap.model.SetOfEnrichmentResults) BaseIntegrationTest(org.baderlab.csplugins.enrichmentmap.integration.BaseIntegrationTest) Test(org.junit.Test) SessionFile(org.baderlab.csplugins.enrichmentmap.integration.SessionFile)

Example 3 with SessionFile

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

the class LegacySessionLoadTest method loadSessionFile.

@Before
public void loadSessionFile() throws Exception {
    java.lang.reflect.Method testMethod = getClass().getMethod(testName.getMethodName());
    SessionFile annotation = testMethod.getAnnotation(SessionFile.class);
    String fileName = annotation.value();
    assertNotNull(fileName);
    assertNotNull(openSessionTF);
    File sessionFile = TestUtils.createTempFile(PATH, fileName);
    TaskIterator tasks = openSessionTF.createTaskIterator(sessionFile);
    SerialTestTaskManager taskManager = new SerialTestTaskManager();
    taskManager.execute(tasks);
}
Also used : SerialTestTaskManager(org.baderlab.csplugins.enrichmentmap.integration.SerialTestTaskManager) TaskIterator(org.cytoscape.work.TaskIterator) SessionFile(org.baderlab.csplugins.enrichmentmap.integration.SessionFile) File(java.io.File) SessionFile(org.baderlab.csplugins.enrichmentmap.integration.SessionFile) Before(org.junit.Before)

Example 4 with SessionFile

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

the class LegacySessionLoadTest method test_2_LoadTwoDataSetWithPostAnalysisLegacySession.

@Test
@SessionFile("em_session_2.2_twodataset_pa.cys")
public void test_2_LoadTwoDataSetWithPostAnalysisLegacySession() {
    EnrichmentMap map = getEnrichmentMap();
    assertEquals(2, map.getDataSetCount());
    assertEquals(11445, map.getAllGenes().size());
    CyNetwork network = networkManager.getNetwork(map.getNetworkID());
    Map<String, CyEdge> edges = TestUtils.getEdges(network);
    assertEquals(15, edges.size());
    assertTrue(edges.containsKey("PA_TOP8_MIDDLE8_BOTTOM8 (sig_set1) BOTTOM8_PLUS100"));
    assertTrue(edges.containsKey("PA_TOP8_MIDDLE8_BOTTOM8 (sig_set1) TOP8_PLUS100"));
    assertTrue(edges.containsKey("PA_TOP8_MIDDLE8_BOTTOM8 (sig_set1) MIDDLE8_PLUS100"));
}
Also used : CyNetwork(org.cytoscape.model.CyNetwork) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) CyEdge(org.cytoscape.model.CyEdge) BaseIntegrationTest(org.baderlab.csplugins.enrichmentmap.integration.BaseIntegrationTest) Test(org.junit.Test) SessionFile(org.baderlab.csplugins.enrichmentmap.integration.SessionFile)

Example 5 with SessionFile

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

the class LegacySessionLoadTest method test_2_LoadTwoDataSetLegacySession.

@Test
@SessionFile("em_session_2.2_twodataset.cys")
public void test_2_LoadTwoDataSetLegacySession() {
    EnrichmentMap map = getEnrichmentMap();
    assertEquals(2, map.getDataSetCount());
    assertEquals(11445, map.getAllGenes().size());
    CyNetwork network = networkManager.getNetwork(map.getNetworkID());
    Map<String, CyEdge> edges = TestUtils.getEdges(network);
    assertEquals(12, edges.size());
    assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set2) MIDDLE8_PLUS100"));
    assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set2) TOP8_PLUS100"));
    assertTrue(edges.containsKey("MIDDLE8_PLUS100 (Geneset_Overlap_set2) TOP8_PLUS100"));
    assertTrue(edges.containsKey("MIDDLE8_PLUS100 (Geneset_Overlap_set2) TOP1_PLUS100"));
    assertTrue(edges.containsKey("TOP8_PLUS100 (Geneset_Overlap_set2) TOP1_PLUS100"));
    assertTrue(edges.containsKey("TOP8_PLUS100 (Geneset_Overlap_set1) TOP1_PLUS100"));
    assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set2) TOP1_PLUS100"));
    assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set1) TOP1_PLUS100"));
    assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set1) MIDDLE8_PLUS100"));
    assertTrue(edges.containsKey("MIDDLE8_PLUS100 (Geneset_Overlap_set1) TOP1_PLUS100"));
    assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set1) TOP8_PLUS100"));
    assertTrue(edges.containsKey("MIDDLE8_PLUS100 (Geneset_Overlap_set1) TOP8_PLUS100"));
}
Also used : CyNetwork(org.cytoscape.model.CyNetwork) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) CyEdge(org.cytoscape.model.CyEdge) BaseIntegrationTest(org.baderlab.csplugins.enrichmentmap.integration.BaseIntegrationTest) Test(org.junit.Test) SessionFile(org.baderlab.csplugins.enrichmentmap.integration.SessionFile)

Aggregations

SessionFile (org.baderlab.csplugins.enrichmentmap.integration.SessionFile)5 EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)4 BaseIntegrationTest (org.baderlab.csplugins.enrichmentmap.integration.BaseIntegrationTest)3 CyNetwork (org.cytoscape.model.CyNetwork)3 Test (org.junit.Test)3 CyEdge (org.cytoscape.model.CyEdge)2 File (java.io.File)1 SerialTestTaskManager (org.baderlab.csplugins.enrichmentmap.integration.SerialTestTaskManager)1 DataSetFiles (org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)1 EMCreationParameters (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters)1 EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)1 EnrichmentMapManager (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager)1 EnrichmentResult (org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult)1 GSEAResult (org.baderlab.csplugins.enrichmentmap.model.GSEAResult)1 GeneExpression (org.baderlab.csplugins.enrichmentmap.model.GeneExpression)1 GeneExpressionMatrix (org.baderlab.csplugins.enrichmentmap.model.GeneExpressionMatrix)1 GeneSet (org.baderlab.csplugins.enrichmentmap.model.GeneSet)1 Rank (org.baderlab.csplugins.enrichmentmap.model.Rank)1 Ranking (org.baderlab.csplugins.enrichmentmap.model.Ranking)1 SetOfEnrichmentResults (org.baderlab.csplugins.enrichmentmap.model.SetOfEnrichmentResults)1