Search in sources :

Example 26 with DataSetFiles

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

the class FileReaderTest method testExpression1ReaderCommentLines.

@Test
public void testExpression1ReaderCommentLines(Provider<EnrichmentMapParameters> empFactory) throws Exception {
    //load the test expression file
    String testDataFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/Expressiontestfile_comments.gct";
    //create a new instance of the parameters
    EnrichmentMapParameters params = empFactory.get();
    //set gmt file name 
    params.getFiles().get(LegacySupport.DATASET1).setExpressionFileName(testDataFileName);
    //Create a new Enrichment map
    EnrichmentMap map = new EnrichmentMap(params.getCreationParameters(), serviceRegistrar);
    //get the default dataset
    Method method = EnrichmentMapParameters.stringToMethod(params.getMethod());
    DataSetFiles files = params.getFiles().get(LegacySupport.DATASET1);
    EMDataSet dataset = map.createDataSet(LegacySupport.DATASET1, method, files);
    //make sure that the genes are empty
    assertEquals(0, map.getNumberOfGenes());
    //add the gene to the master list of genes
    map.addGene("GLS");
    map.addGene("PSMA1");
    map.addGene("ZP1");
    map.addGene("ZYX");
    //make sure all four genes have been associated
    assertEquals(4, map.getNumberOfGenes());
    //load expression file
    ExpressionFileReaderTask task = new ExpressionFileReaderTask(dataset);
    task.run(taskMonitor);
    //There was one more gene in the expression file that wasn't in the set of genes
    //make sure it was was added
    assertEquals(4, map.getNumberOfGenes());
    assertEquals(5.131481026, map.getDataSet(LegacySupport.DATASET1).getExpressionSets().getMaxExpression(), 0.0);
    assertEquals(4, map.getDataSet(LegacySupport.DATASET1).getExpressionSets().getNumGenes());
    assertEquals(59, map.getDataSet(LegacySupport.DATASET1).getExpressionSets().getNumConditions());
    assertEquals(0.008720342, map.getDataSet(LegacySupport.DATASET1).getExpressionSets().getMinExpression(), 0.0);
}
Also used : EnrichmentMapParameters(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapParameters) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) Method(org.baderlab.csplugins.enrichmentmap.model.EMDataSet.Method) DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles) Test(org.junit.Test)

Example 27 with DataSetFiles

use of org.baderlab.csplugins.enrichmentmap.model.DataSetFiles 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 28 with DataSetFiles

use of org.baderlab.csplugins.enrichmentmap.model.DataSetFiles 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)

Example 29 with DataSetFiles

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

the class EditDataSetPanel method createDataSetParameters.

@Override
public DataSetParameters createDataSetParameters() {
    String name = nameText.getText().trim();
    Method method = getMethod();
    DataSetFiles files = new DataSetFiles();
    if (!enrichments1Text.isEmpty())
        files.setEnrichmentFileName1(enrichments1Text.getText());
    if (!enrichments2Text.isEmpty() && method == Method.GSEA)
        files.setEnrichmentFileName2(enrichments2Text.getText());
    if (!expressionsText.isEmpty())
        files.setExpressionFileName(expressionsText.getText());
    if (!gmtText.isEmpty())
        files.setGMTFileName(gmtText.getText());
    if (!ranksText.isEmpty())
        files.setRankedFile(ranksText.getText());
    if (!classesText.isEmpty())
        files.setClassFile(classesText.getText());
    String positive = positiveText.getText();
    String negative = negativeText.getText();
    if (!isNullOrEmpty(positive) && !isNullOrEmpty(negative) && classes != null) {
        files.setPhenotype1(positive);
        files.setPhenotype2(negative);
        files.setTemp_class1(classes);
    }
    return new DataSetParameters(name, method, files);
}
Also used : DataSetParameters(org.baderlab.csplugins.enrichmentmap.resolver.DataSetParameters) Method(org.baderlab.csplugins.enrichmentmap.model.EMDataSet.Method) DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)

Example 30 with DataSetFiles

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

the class EditDataSetPanel method initialize.

private void initialize(DataSetParameters initDataSet) {
    nameText.setText(initDataSet.getName());
    DataSetFiles files = initDataSet.getFiles();
    enrichments1Text.setText(files.getEnrichmentFileName1());
    enrichments2Text.setText(files.getEnrichmentFileName2());
    gmtText.setText(files.getGMTFileName());
    expressionsText.setText(files.getExpressionFileName());
    ranksText.setText(files.getRankedFile());
    classesText.setText(files.getClassFile());
    positiveText.setText(files.getPhenotype1());
    negativeText.setText(files.getPhenotype2());
    analysisTypeCombo.setSelectedItem(ComboItem.of(initDataSet.getMethod()));
}
Also used : DataSetFiles(org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)

Aggregations

DataSetFiles (org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)33 EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)21 Test (org.junit.Test)21 EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)20 EMCreationParameters (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters)14 Method (org.baderlab.csplugins.enrichmentmap.model.EMDataSet.Method)14 EnrichmentMapParameters (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapParameters)11 Map (java.util.Map)6 EnrichmentResult (org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult)6 DataSetParameters (org.baderlab.csplugins.enrichmentmap.resolver.DataSetParameters)5 CyNetwork (org.cytoscape.model.CyNetwork)5 GMTFileReaderTask (org.baderlab.csplugins.enrichmentmap.parsers.GMTFileReaderTask)4 Baton (org.baderlab.csplugins.enrichmentmap.util.Baton)4 ArrayList (java.util.ArrayList)3 ExpressionFileReaderTask (org.baderlab.csplugins.enrichmentmap.parsers.ExpressionFileReaderTask)3 File (java.io.File)2 Path (java.nio.file.Path)2 HashMap (java.util.HashMap)2 BaseIntegrationTest (org.baderlab.csplugins.enrichmentmap.integration.BaseIntegrationTest)2 SimilarityMetric (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric)2