use of org.baderlab.csplugins.enrichmentmap.SerialTestTaskManager in project EnrichmentMapApp by BaderLab.
the class BaseNetworkTest method buildEnrichmentMap.
protected void buildEnrichmentMap(EMCreationParameters params, DataSetFiles datasetFiles, Method method, String datasetName) {
List<DataSetParameters> dataSets = Arrays.asList(new DataSetParameters(datasetName, method, datasetFiles));
CreateEnrichmentMapTaskFactory taskFactory = masterMapTaskFactoryFactory.create(params, dataSets);
TaskIterator taskIterator = taskFactory.createTaskIterator();
// make sure the task iterator completes
TaskObserver observer = new TaskObserver() {
public void taskFinished(ObservableTask task) {
}
public void allFinished(FinishStatus finishStatus) {
if (finishStatus == null)
fail();
if (finishStatus.getType() != FinishStatus.Type.SUCCEEDED)
throw new AssertionError("TaskIterator Failed", finishStatus.getException());
}
};
SerialTestTaskManager testTaskManager = new SerialTestTaskManager();
testTaskManager.ignoreTask(CreateEMViewTask.class);
testTaskManager.execute(taskIterator, observer);
}
use of org.baderlab.csplugins.enrichmentmap.SerialTestTaskManager in project EnrichmentMapApp by BaderLab.
the class BaseNetworkTest method runPostAnalysis.
protected void runPostAnalysis(CyNetwork emNetwork, PostAnalysisParameters.Builder builder, String dataSetName) throws Exception {
// Set up mocks
when(applicationManager.getCurrentNetwork()).thenReturn(emNetwork);
CyNetworkView networkViewMock = mock(CyNetworkView.class);
when(applicationManager.getCurrentNetworkView()).thenReturn(networkViewMock);
when(networkViewManager.getNetworkViews(emNetwork)).thenReturn(Arrays.asList(networkViewMock));
@SuppressWarnings("unchecked") View<CyNode> nodeViewMock = Mockito.mock(View.class);
when(networkViewMock.getNodeView(Matchers.<CyNode>anyObject())).thenReturn(nodeViewMock);
when(nodeViewMock.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).thenReturn(Double.valueOf(0.0));
EnrichmentMap map = emManager.getEnrichmentMap(emNetwork.getSUID());
assertNotNull(map);
// Load the gene-sets from the file
SerialTestTaskManager testTaskManager = new SerialTestTaskManager();
File file = new File(builder.getSignatureGMTFileName());
LoadSignatureSetsActionListener loader = loadSignatureSetsActionListenerFactory.create(file, new FilterMetric.None(), map);
loader.setTaskManager(testTaskManager);
loader.setGeneSetCallback(builder::setLoadedGMTGeneSets);
loader.setFilteredSignatureSetsCallback(builder::addSelectedGeneSetNames);
loader.actionPerformed(null);
PostAnalysisParameters paParams = builder.build();
// Run post-analysis
EMDataSet dataSet = map.getDataSet(dataSetName);
CreateDiseaseSignatureTaskParallel signatureTask = buildDiseaseSignatureTaskFactory.create(paParams, map, Arrays.asList(dataSet));
testTaskManager = new SerialTestTaskManager();
testTaskManager.execute(new TaskIterator(signatureTask));
}
Aggregations