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