Search in sources :

Example 6 with EnrichmentMapParameters

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

the class FileReaderTest method testGSEAEnrichmentsReader.

//test GSEA enrichment results reader
@Test
public void testGSEAEnrichmentsReader(Provider<EnrichmentMapParameters> empFactory) throws Exception {
    //load the test enrichment files - GSEA creates two enrichment results files.
    String testDataFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/GSEA_enrichments1.xls";
    String testDataFileName2 = "src/test/resources/org/baderlab/csplugins/enrichmentmap/GSEA_enrichments2.xls";
    //create a new instance of the parameters
    EnrichmentMapParameters params = empFactory.get();
    //set enrichment file name 
    params.getFiles().get(LegacySupport.DATASET1).setEnrichmentFileName1(testDataFileName);
    params.getFiles().get(LegacySupport.DATASET1).setEnrichmentFileName2(testDataFileName2);
    //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);
    ParseGSEAEnrichmentResults task = new ParseGSEAEnrichmentResults(dataset);
    task.run(taskMonitor);
    //Get the enrichment
    Map<String, EnrichmentResult> enrichments = map.getDataSet(LegacySupport.DATASET1).getEnrichments().getEnrichments();
    assertEquals(40, enrichments.size());
    //Check the contents of some of the genesets
    // example from file 1 (ANTIGEN PROCESSING AND PRESENTATION%KEGG%HSA04612)
    //check p-values
    assertEquals(0.0, ((GSEAResult) enrichments.get("ANTIGEN PROCESSING AND PRESENTATION%KEGG%HSA04612")).getPvalue(), 0.0);
    //check fdr value
    assertEquals(0.086938426, ((GSEAResult) enrichments.get("ANTIGEN PROCESSING AND PRESENTATION%KEGG%HSA04612")).getFdrqvalue(), 0.0);
    //check ES value
    assertEquals(0.6854155, ((GSEAResult) enrichments.get("ANTIGEN PROCESSING AND PRESENTATION%KEGG%HSA04612")).getES(), 0.0);
    //check NES
    assertEquals(2.1194055, ((GSEAResult) enrichments.get("ANTIGEN PROCESSING AND PRESENTATION%KEGG%HSA04612")).getNES(), 0.0);
    //check ranks at max
    assertEquals(836, ((GSEAResult) enrichments.get("ANTIGEN PROCESSING AND PRESENTATION%KEGG%HSA04612")).getRankAtMax());
    //check size
    assertEquals(27, ((GSEAResult) enrichments.get("ANTIGEN PROCESSING AND PRESENTATION%KEGG%HSA04612")).getGsSize());
    // example from file 2 (EMBRYONIC HEART TUBE MORPHOGENESIS%GO%GO:0003143)
    //check p-values
    assertEquals(0.040152963, ((GSEAResult) enrichments.get("EMBRYONIC HEART TUBE MORPHOGENESIS%GO%GO:0003143")).getPvalue(), 0.0);
    //check fdr value
    assertEquals(1.0, ((GSEAResult) enrichments.get("EMBRYONIC HEART TUBE MORPHOGENESIS%GO%GO:0003143")).getFdrqvalue(), 0.0);
    //check ES value
    assertEquals(-0.49066687, ((GSEAResult) enrichments.get("EMBRYONIC HEART TUBE MORPHOGENESIS%GO%GO:0003143")).getES(), 0.0);
    //check NES
    assertEquals(-1.477554, ((GSEAResult) enrichments.get("EMBRYONIC HEART TUBE MORPHOGENESIS%GO%GO:0003143")).getNES(), 0.0);
    //check ranks at max
    assertEquals(1597, ((GSEAResult) enrichments.get("EMBRYONIC HEART TUBE MORPHOGENESIS%GO%GO:0003143")).getRankAtMax());
    //check size
    assertEquals(17, ((GSEAResult) enrichments.get("EMBRYONIC HEART TUBE MORPHOGENESIS%GO%GO:0003143")).getGsSize());
}
Also used : EnrichmentResult(org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult) 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 7 with EnrichmentMapParameters

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

the class FileReaderTest method testDavidEnrichmentsReader.

//test David enrichment results reader
@Test
public void testDavidEnrichmentsReader(Provider<EnrichmentMapParameters> empFactory) throws Exception {
    //load the test enrichment files - Bingo
    String testDataFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/DavidResults.txt";
    //create a new instance of the parameters
    EnrichmentMapParameters params = empFactory.get();
    //set enrichment file name 
    params.getFiles().get(LegacySupport.DATASET1).setEnrichmentFileName1(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);
    ParseDavidEnrichmentResults task = new ParseDavidEnrichmentResults(dataset);
    task.run(taskMonitor);
    //Get the enrichment
    Map<String, EnrichmentResult> enrichments = map.getDataSet(LegacySupport.DATASET1).getEnrichments().getEnrichments();
    assertEquals(215, enrichments.size());
    //check p-values
    assertEquals(0.00000005210169741980237, ((GenericResult) enrichments.get("GO:0031974~MEMBRANE-ENCLOSED LUMEN")).getPvalue(), 0.0);
    //check fdr value
    assertEquals(0.000016724505445320226, ((GenericResult) enrichments.get("GO:0031974~MEMBRANE-ENCLOSED LUMEN")).getFdrqvalue(), 0.0);
    //check geneset siz
    assertEquals(95, ((GenericResult) enrichments.get("GO:0031974~MEMBRANE-ENCLOSED LUMEN")).getGsSize());
    //check p-values
    assertEquals(0.0009179741851709047, ((GenericResult) enrichments.get(((String) "domain:Leucine-zipper").toUpperCase())).getPvalue(), 0.0);
    //check fdr value
    assertEquals(0.46717397126592464, ((GenericResult) enrichments.get(((String) "domain:Leucine-zipper").toUpperCase())).getFdrqvalue(), 0.0);
    //check geneset siz
    assertEquals(11, ((GenericResult) enrichments.get(((String) "domain:Leucine-zipper").toUpperCase())).getGsSize());
}
Also used : EnrichmentResult(org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult) 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 8 with EnrichmentMapParameters

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

the class FileReaderTest method testGMTFileReader.

@Test
public void testGMTFileReader(Provider<EnrichmentMapParameters> empFactory) throws Exception {
    String testDataFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/Genesetstestfile.gmt";
    //create a new instance of the parameters
    EnrichmentMapParameters params = empFactory.get();
    //set gmt file name 
    params.getFiles().get(LegacySupport.DATASET1).setGMTFileName(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);
    //set up task
    GMTFileReaderTask task = new GMTFileReaderTask(dataset);
    task.run(taskMonitor);
    //test to make sure that the file loaded in 10 genesets with a total of 75 genes
    assertEquals(10, map.getAllGeneSets().size());
    assertEquals(75, map.getNumberOfGenes());
}
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 9 with EnrichmentMapParameters

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

the class FileReaderTest method testExpression1ReaderNormal.

@Test
public void testExpression1ReaderNormal(Provider<EnrichmentMapParameters> empFactory) throws Exception {
    //load the test expression file
    String testDataFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/Expressiontestfile.gct";
    //create a new instance of the parameters
    EnrichmentMapParameters params = empFactory.get();
    //set expression 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);
    //in order to load expression data the genes have to be registered with the application
    //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(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);
    assertEquals(5.131481026, map.getDataSet(LegacySupport.DATASET1).getExpressionSets().getMaxExpression(), 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 10 with EnrichmentMapParameters

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

the class FileReaderTest method testBingoEnrichmentsReader.

//test Bingo enrichment results
@Test
public void testBingoEnrichmentsReader(Provider<EnrichmentMapParameters> empFactory) throws Exception {
    //load the test enrichment files - Bingo
    String testDataFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/BingoResults.bgo";
    //create a new instance of the parameters
    EnrichmentMapParameters params = empFactory.get();
    //set enrichment file name 
    params.getFiles().get(LegacySupport.DATASET1).setEnrichmentFileName1(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);
    ParseBingoEnrichmentResults task = new ParseBingoEnrichmentResults(dataset);
    task.run(taskMonitor);
    //Get the enrichment
    Map<String, EnrichmentResult> enrichments = map.getDataSet(LegacySupport.DATASET1).getEnrichments().getEnrichments();
    assertEquals(74, enrichments.size());
    //check p-values
    assertEquals(0.0010354, ((GenericResult) enrichments.get("NUCLEOLAR PART")).getPvalue(), 0.0);
    //check fdr value
    assertEquals(0.047796, ((GenericResult) enrichments.get("NUCLEOLAR PART")).getFdrqvalue(), 0.0);
    //check geneset siz
    assertEquals(5, ((GenericResult) enrichments.get("NUCLEOLAR PART")).getGsSize());
    //check p-values
    assertEquals(0.0000000000016209, ((GenericResult) enrichments.get("NUCLEOLUS")).getPvalue(), 0.0);
    //check fdr value
    assertEquals(0.0000000042203, ((GenericResult) enrichments.get("NUCLEOLUS")).getFdrqvalue(), 0.0);
    //check geneset siz
    assertEquals(43, ((GenericResult) enrichments.get("NUCLEOLUS")).getGsSize());
}
Also used : EnrichmentResult(org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult) 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)

Aggregations

DataSetFiles (org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)11 EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)11 Method (org.baderlab.csplugins.enrichmentmap.model.EMDataSet.Method)11 EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)11 EnrichmentMapParameters (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapParameters)11 Test (org.junit.Test)10 EnrichmentResult (org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult)5 Inject (com.google.inject.Inject)1 File (java.io.File)1 InputStream (java.io.InputStream)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Scanner (java.util.Scanner)1 Set (java.util.Set)1 CyActivator (org.baderlab.csplugins.enrichmentmap.CyActivator)1 EMSignatureDataSet (org.baderlab.csplugins.enrichmentmap.model.EMSignatureDataSet)1