Search in sources :

Example 11 with EMCreationParameters

use of org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters in project EnrichmentMapApp by BaderLab.

the class LoadDatasetTaskTest method testLoadDataset1GSEAResult_withexpression.

@Test
public void testLoadDataset1GSEAResult_withexpression() throws Exception {
    //for a dataset we require genesets, an expression file (optional), enrichment results
    String testGMTFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/gs_apop_mouse.gmt";
    String testExpressionFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/Expressiontestfile.gct";
    String testGSEAResults1FileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/GSEA_enrichments1.xls";
    String testGSEAResults2FileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/GSEA_enrichments2.xls";
    DataSetFiles files = new DataSetFiles();
    files.setGMTFileName(testGMTFileName);
    files.setExpressionFileName(testExpressionFileName);
    files.setEnrichmentFileName1(testGSEAResults1FileName);
    files.setEnrichmentFileName2(testGSEAResults2FileName);
    EMCreationParameters params = new EMCreationParameters("EM1_", 0.1, 0.1, NESFilter.ALL, Optional.empty(), SimilarityMetric.JACCARD, 0.1, 0.1);
    //create an new enrichment Map
    EnrichmentMap em = new EnrichmentMap(params, serviceRegistrar);
    //create a dataset
    EMDataSet dataset = em.createDataSet(LegacySupport.DATASET1, Method.Generic, files);
    //load Data
    GMTFileReaderTask task = new GMTFileReaderTask(dataset);
    task.run(taskMonitor);
    ParseGSEAEnrichmentResults enrichmentResultsFilesTask = new ParseGSEAEnrichmentResults(dataset);
    enrichmentResultsFilesTask.run(taskMonitor);
    //load expression file
    ExpressionFileReaderTask exptask = new ExpressionFileReaderTask(dataset);
    exptask.run(taskMonitor);
    //check to see if the dataset loaded
    assertEquals(193, dataset.getSetOfGeneSets().getGeneSets().size());
    assertEquals(14, dataset.getEnrichments().getEnrichments().size());
    assertEquals(41, dataset.getDataSetGenes().size());
    assertEquals(41, dataset.getExpressionSets().getNumGenes());
}
Also used : EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) GMTFileReaderTask(org.baderlab.csplugins.enrichmentmap.parsers.GMTFileReaderTask) ExpressionFileReaderTask(org.baderlab.csplugins.enrichmentmap.parsers.ExpressionFileReaderTask) DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles) ParseGSEAEnrichmentResults(org.baderlab.csplugins.enrichmentmap.parsers.ParseGSEAEnrichmentResults) Test(org.junit.Test)

Example 12 with EMCreationParameters

use of org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters in project EnrichmentMapApp by BaderLab.

the class LoadDavidResultTest method testLoad2DavidResult_withoutexpression.

@Test
public void testLoad2DavidResult_withoutexpression() throws Exception {
    //for a dataset we require genesets, an expression file (optional), enrichment results
    String testDavidResultsFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/task/david_output/12hr_David_Output.txt";
    DataSetFiles files = new DataSetFiles();
    files.setEnrichmentFileName1(testDavidResultsFileName);
    //for a dataset we require genesets, an expression file (optional), enrichment results
    String testDavidResultsFileName2 = "src/test/resources/org/baderlab/csplugins/enrichmentmap/task/david_output/24hr_David_Output.txt";
    DataSetFiles files2 = new DataSetFiles();
    files2.setEnrichmentFileName1(testDavidResultsFileName2);
    //set the method to David
    double similarityCutoff = 0.25;
    double pvalue = 0.005;
    // 5.0 X 10-3
    double qvalue = 0.005;
    EMCreationParameters params = new EMCreationParameters("EM1_", pvalue, qvalue, NESFilter.ALL, Optional.empty(), SimilarityMetric.JACCARD, similarityCutoff, 0.5);
    //create an new enrichment Map
    EnrichmentMap em = new EnrichmentMap(params, serviceRegistrar);
    //Load first dataset
    //create a dataset
    EMDataSet dataset = em.createDataSet(LegacySupport.DATASET1, Method.Specialized, files);
    //create a DatasetTask
    ParseDavidEnrichmentResults enrichmentResultsFilesTask = new ParseDavidEnrichmentResults(dataset);
    enrichmentResultsFilesTask.run(taskMonitor);
    //Load second dataset
    //create a dataset
    EMDataSet dataset2 = em.createDataSet(LegacySupport.DATASET2, Method.Specialized, files2);
    //create a DatasetTask
    ParseDavidEnrichmentResults enrichmentResultsFiles2Task = new ParseDavidEnrichmentResults(dataset2);
    enrichmentResultsFiles2Task.run(taskMonitor);
    // check to see if the two datasets are distinct
    if (!((dataset.getDataSetGenes().containsAll(dataset2.getDataSetGenes())) && (dataset2.getDataSetGenes().containsAll(dataset.getDataSetGenes()))))
        em.setDistinctExpressionSets(true);
    CreateDummyExpressionTask dummyExpressionTask = new CreateDummyExpressionTask(dataset);
    dummyExpressionTask.run(taskMonitor);
    CreateDummyExpressionTask dummyExpressionTask2 = new CreateDummyExpressionTask(dataset2);
    dummyExpressionTask2.run(taskMonitor);
    em.filterGenesets();
    InitializeGenesetsOfInterestTask genesets_init = new InitializeGenesetsOfInterestTask(em);
    genesets_init.run(taskMonitor);
    // check to see if the dataset loaded - there should be 215 genesets
    assertEquals(215, dataset.getSetOfGeneSets().getGeneSets().size());
    // there should also be 215 enrichments (the genesets are built from the txt file)
    assertEquals(215, dataset.getEnrichments().getEnrichments().size());
    // there should be 7 genesets in the enrichments of interest
    assertEquals(7, dataset.getGeneSetsOfInterest().getGeneSets().size());
    // there should be 114 genes in the geneset "acetylation"
    assertEquals(114, em.getDataSet(LegacySupport.DATASET1).getSetOfGeneSets().getGeneSets().get("ACETYLATION").getGenes().size());
    //		assertEquals(114, em.getAllGenesets().get("ACETYLATION").getGenes().size());
    dataset2 = em.getDataSet(LegacySupport.DATASET2);
    // check the stats for dataset2
    // check to see if the dataset loaded - there should be 263 genesets
    assertEquals(263, dataset2.getSetOfGeneSets().getGeneSets().size());
    // there should also be 263 enrichments (the genesets are built from the bgo file)
    assertEquals(263, dataset2.getEnrichments().getEnrichments().size());
    // there should be 0 genesets in the enrichments of interest
    assertEquals(0, dataset2.getGeneSetsOfInterest().getGeneSets().size());
    // make sure the dummy expression has values for all the genes
    assertEquals(367, dataset2.getExpressionSets().getNumGenes());
    assertEquals(367, dataset2.getDataSetGenes().size());
    // there should be 20 edges (2 edges for every node because of the distinct expresison sets)
    // assertEquals((7*6),em.getGenesetSimilarity().size()); there should be a total of 366 genes
    assertEquals(661, em.getNumberOfGenes());
}
Also used : EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles) ParseDavidEnrichmentResults(org.baderlab.csplugins.enrichmentmap.parsers.ParseDavidEnrichmentResults) Test(org.junit.Test)

Example 13 with EMCreationParameters

use of org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters in project EnrichmentMapApp by BaderLab.

the class LoadDavidResultTest method testLoadDavidResult_withoutexpression.

@Test
public void testLoadDavidResult_withoutexpression() throws Exception {
    //for a dataset we require genesets, an expression file (optional), enrichment results
    String testDavidResultsFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/task/david_output/12hr_David_Output.txt";
    DataSetFiles files = new DataSetFiles();
    files.setEnrichmentFileName1(testDavidResultsFileName);
    //set the method to David
    double similarityCutoff = 0.25;
    double pvalue = 0.005;
    // 5.0 X 10-3
    double qvalue = 0.005;
    EMCreationParameters params = new EMCreationParameters("EM1_", pvalue, qvalue, NESFilter.ALL, Optional.empty(), SimilarityMetric.JACCARD, similarityCutoff, 0.5);
    //create an new enrichment Map
    EnrichmentMap em = new EnrichmentMap(params, serviceRegistrar);
    //Load data set
    //create a dataset
    EMDataSet dataset = em.createDataSet(LegacySupport.DATASET1, Method.Specialized, files);
    //create a DatasetTask
    ParseDavidEnrichmentResults enrichmentResultsFilesTask = new ParseDavidEnrichmentResults(dataset);
    enrichmentResultsFilesTask.run(taskMonitor);
    CreateDummyExpressionTask dummyExpressionTask = new CreateDummyExpressionTask(dataset);
    dummyExpressionTask.run(taskMonitor);
    em.filterGenesets();
    InitializeGenesetsOfInterestTask genesets_init = new InitializeGenesetsOfInterestTask(em);
    genesets_init.run(taskMonitor);
    Baton<Map<SimilarityKey, GenesetSimilarity>> baton = new Baton<>();
    ComputeSimilarityTaskParallel similarities = new ComputeSimilarityTaskParallel(em, baton.consumer());
    similarities.run(taskMonitor);
    //check to see if the dataset loaded - there should be 215 genesets
    assertEquals(215, dataset.getSetOfGeneSets().getGeneSets().size());
    //there should also be 215 enrichments (the genesets are built from the txt file)
    assertEquals(215, dataset.getEnrichments().getEnrichments().size());
    //there should be 7 genesets in the enrichments of interest
    assertEquals(7, dataset.getGeneSetsOfInterest().getGeneSets().size());
    //there should be 7 * 6 edges
    assertEquals(11, baton.supplier().get().size());
    //there should be a total of 366 genes
    assertEquals(414, em.getNumberOfGenes());
    //there should be 43 genes in the geneset "nucleolus"
    assertEquals(114, em.getAllGeneSets().get("ACETYLATION").getGenes().size());
    //make sure the dummy expression has values for all the genes
    assertEquals(414, dataset.getExpressionSets().getNumGenes());
    assertEquals(414, dataset.getDataSetGenes().size());
}
Also used : EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) Baton(org.baderlab.csplugins.enrichmentmap.util.Baton) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) Map(java.util.Map) DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles) ParseDavidEnrichmentResults(org.baderlab.csplugins.enrichmentmap.parsers.ParseDavidEnrichmentResults) Test(org.junit.Test)

Example 14 with EMCreationParameters

use of org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters in project EnrichmentMapApp by BaderLab.

the class PostAnalysisTaskTest method test_1_EnrichmentMapBuildMapTask.

@Test
public void test_1_EnrichmentMapBuildMapTask(CyApplicationManager applicationManager, CyNetworkManager networkManager, EnrichmentMapManager emManager) {
    DataSetFiles dataset1files = new DataSetFiles();
    dataset1files.setGMTFileName(PATH + "gene_sets.gmt");
    dataset1files.setExpressionFileName(PATH + "FakeExpression.txt");
    dataset1files.setEnrichmentFileName1(PATH + "fakeEnrichments.txt");
    dataset1files.setRankedFile(PATH + "FakeRank.rnk");
    EMCreationParameters params = new EMCreationParameters("EM1_", 0.1, 0.1, NESFilter.ALL, Optional.empty(), SimilarityMetric.JACCARD, 0.1, 0.1);
    buildEnrichmentMap(params, dataset1files, Method.Generic, 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"));
    // Make the network available to the subsequent test methods (requires test methods are run in order)
    emNetwork = network;
}
Also used : EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) CyNetwork(org.cytoscape.model.CyNetwork) CyNode(org.cytoscape.model.CyNode) EdgeSimilarities(org.baderlab.csplugins.enrichmentmap.EdgeSimilarities) DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles) Test(org.junit.Test)

Example 15 with EMCreationParameters

use of org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters in project EnrichmentMapApp by BaderLab.

the class PostAnalysisCutoffTest method _setup.

@Test
public void _setup(PropertyManager pm, CyApplicationManager applicationManager, CyNetworkManager networkManager) {
    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(PATH + "gene_sets.gmt");
    dataset1files.setExpressionFileName(PATH + "FakeExpression.txt");
    dataset1files.setEnrichmentFileName1(PATH + "fakeEnrichments.txt");
    dataset1files.setRankedFile(PATH + "FakeRank.rnk");
    buildEnrichmentMap(params, dataset1files, Method.Generic, LegacySupport.DATASET1);
    // Assert the network is as expected
    Set<CyNetwork> networks = networkManager.getNetworkSet();
    assertEquals(1, networks.size());
    emNetwork = networks.iterator().next();
}
Also used : EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) CyNetwork(org.cytoscape.model.CyNetwork) DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles) Test(org.junit.Test)

Aggregations

EMCreationParameters (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters)21 DataSetFiles (org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)15 EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)11 Test (org.junit.Test)11 EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)9 Map (java.util.Map)4 SimilarityMetric (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric)4 DataSetParameters (org.baderlab.csplugins.enrichmentmap.resolver.DataSetParameters)4 CreateEnrichmentMapTaskFactory (org.baderlab.csplugins.enrichmentmap.task.CreateEnrichmentMapTaskFactory)4 CyNetwork (org.cytoscape.model.CyNetwork)4 ArrayList (java.util.ArrayList)3 Baton (org.baderlab.csplugins.enrichmentmap.util.Baton)3 GroupLayout (javax.swing.GroupLayout)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 JScrollPane (javax.swing.JScrollPane)2 BaseIntegrationTest (org.baderlab.csplugins.enrichmentmap.integration.BaseIntegrationTest)2 EnrichmentResult (org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult)2 NESFilter (org.baderlab.csplugins.enrichmentmap.model.EnrichmentResultFilterParams.NESFilter)2 GeneSet (org.baderlab.csplugins.enrichmentmap.model.GeneSet)2