use of org.baderlab.csplugins.enrichmentmap.parsers.ClassFileReaderTask in project EnrichmentMapApp by BaderLab.
the class CreateEnrichmentMapTaskFactory method createTaskIterator.
@Override
public TaskIterator createTaskIterator() {
TaskIterator tasks = new TaskIterator();
if (dataSets.isEmpty())
return tasks;
tasks.append(new TitleTask("Building EnrichmentMap"));
EnrichmentMap map = new EnrichmentMap(params, serviceRegistrar);
for (DataSetParameters dataSetParameters : dataSets) {
String datasetName = dataSetParameters.getName();
Method method = dataSetParameters.getMethod();
DataSetFiles files = dataSetParameters.getFiles();
EMDataSet dataset = map.createDataSet(datasetName, method, files);
// Load GMT File
if (!Strings.isNullOrEmpty(dataset.getSetOfGeneSets().getFilename())) {
tasks.append(new GMTFileReaderTask(dataset));
}
// Load the enrichments
tasks.append(new DetermineEnrichmentResultFileReader(dataset).getParsers());
// If there is no expression file then create a dummy file to associate with this dataset so we can still use the expression viewer (heat map)
if (Strings.isNullOrEmpty(dataset.getDataSetFiles().getExpressionFileName())) {
tasks.append(new CreateDummyExpressionTask(dataset));
} else {
tasks.append(new ExpressionFileReaderTask(dataset));
}
// Load ranks if present
String ranksName = dataset.getMethod() == Method.GSEA ? Ranking.GSEARanking : datasetName;
if (dataset.getExpressionSets().getRanksByName(ranksName) != null) {
String filename = dataset.getExpressionSets().getRanksByName(ranksName).getFilename();
tasks.append(new RanksFileReaderTask(filename, dataset, ranksName, false));
}
if (!Strings.isNullOrEmpty(dataset.getDataSetFiles().getClassFile())) {
tasks.append(new ClassFileReaderTask(dataset));
}
}
// NOTE: First filter out genesets that don't pass the thresholds,
// Then filter the remaining genesets of interest to only contain genes from the expression file.
// Filter out genesets that don't pass the p-value and q-value thresholds
InitializeGenesetsOfInterestTask genesetsTask = new InitializeGenesetsOfInterestTask(map);
// genesetsTask.setThrowIfMissing(false); // TEMPORARY
tasks.append(genesetsTask);
// Trim the genesets to only contain the genes that are in the data file.
tasks.append(new FilterGenesetsByDatasetGenes(map));
// Link the ComputeSimilarityTask to the MasterMapNetworkTask by a "pipe"
Baton<Map<SimilarityKey, GenesetSimilarity>> pipe = new Baton<>();
// Compute the geneset similarities
tasks.append(new ComputeSimilarityTaskParallel(map, pipe.consumer()));
// Create the network
tasks.append(createEMNetworkTaskFactory.create(map, pipe.supplier()));
// Create style and layout
if (!headless) {
tasks.append(createEMViewTaskFactory.create(map));
}
return tasks;
}
Aggregations