use of org.cytoscape.work.FinishStatus in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method applyVisualStyle.
private void applyVisualStyle(EMStyleOptions options, CyCustomGraphics2<?> chart, boolean updateChartOnly) {
ApplyEMStyleTask task = applyStyleTaskFactory.create(options, chart, updateChartOnly);
dialogTaskManager.execute(new TaskIterator(task), new TaskObserver() {
@Override
public void taskFinished(ObservableTask task) {
}
@Override
public void allFinished(FinishStatus finishStatus) {
EMViewControlPanel viewPanel = getControlPanel().getViewControlPanel(options.getNetworkView());
updateLegends(viewPanel);
}
});
}
use of org.cytoscape.work.FinishStatus in project EnrichmentMapApp by BaderLab.
the class MasterDetailDialogPage method scan.
private void scan() {
Optional<File> rootFolder = fileBrowser.browseForRootFolder(jframeProvider.get());
if (rootFolder.isPresent()) {
scanButton.setEnabled(false);
ResolverTask task = new ResolverTask(rootFolder.get());
dialogTaskManager.execute(new TaskIterator(task), new TaskObserver() {
@Override
public void taskFinished(ObservableTask task) {
@SuppressWarnings("unchecked") List<DataSetParameters> datasets = task.getResults(List.class);
if (!datasets.isEmpty()) {
datasets.forEach(MasterDetailDialogPage.this::addDataSetToList);
dataSetList.setSelectedValue(datasets.get(0), true);
}
}
@Override
public void allFinished(FinishStatus finishStatus) {
scanButton.setEnabled(true);
updateButtonEnablement();
}
});
}
}
use of org.cytoscape.work.FinishStatus in project EnrichmentMapApp by BaderLab.
the class AddRanksDialog method loadRanksAndClose.
private void loadRanksAndClose() {
String rankFileName = ranksFileText.getText();
String ranksName = getRanksName();
EMDataSet dataset = getDataSet();
RanksFileReaderTask task = new RanksFileReaderTask(rankFileName, dataset, ranksName, true);
dialogTaskManager.execute(new TaskIterator(task), new TaskObserver() {
@Override
public void taskFinished(ObservableTask task) {
}
@Override
public void allFinished(FinishStatus finishStatus) {
resultRanksName = ranksName;
dispose();
}
});
}
use of org.cytoscape.work.FinishStatus in project EnrichmentMapApp by BaderLab.
the class ClusterRankingOption method computeRanking.
@Override
public CompletableFuture<Optional<Map<Integer, RankValue>>> computeRanking(Collection<Integer> genes) {
if (genes.size() < 2) {
// The HierarchicalClusterTask requires at least 2 genes
return CompletableFuture.completedFuture(Optional.of(Collections.emptyMap()));
}
HierarchicalClusterTask task = new HierarchicalClusterTask(map, genes, distance.getMetric());
CompletableFuture<Optional<Map<Integer, RankValue>>> future = new CompletableFuture<>();
taskManager.execute(new TaskIterator(task), new TaskObserver() {
@Override
public void taskFinished(ObservableTask task) {
if (task instanceof HierarchicalClusterTask) {
HierarchicalClusterTask clusterTask = (HierarchicalClusterTask) task;
Optional<Map<Integer, RankValue>> ranking = clusterTask.getActualResults();
future.complete(ranking);
}
}
@Override
public void allFinished(FinishStatus finishStatus) {
// Don't see why this would ever happen
if (!future.isDone()) {
future.completeExceptionally(new RuntimeException("Failed"));
}
}
});
return future;
}
Aggregations