use of org.cytoscape.work.TaskIterator in project cytoscape-api by cytoscape.
the class AbstractWebServiceClientTest method testCreateTaskIterator.
@Test
public void testCreateTaskIterator() {
final TaskIterator itr = client.createTaskIterator(queryObject);
assertNotNull(itr);
assertFalse(itr.getNumTasks() == 0);
}
use of org.cytoscape.work.TaskIterator in project EnrichmentMapApp by BaderLab.
the class BaseIntegrationTest method importNetworkFromFile.
protected CyNetwork importNetworkFromFile(String path, String fileName) throws IOException {
Set<CyNetwork> existingNetworks = networkManager.getNetworkSet();
// import the network
File file = TestUtils.createTempFile(path, fileName);
TaskIterator taskIterator = loadNetworkFileTaskFactory.createTaskIterator(file);
SerialTestTaskManager taskManager = new SerialTestTaskManager();
taskManager.execute(taskIterator);
// get a reference to the imported network
Set<CyNetwork> networksAfterImport = networkManager.getNetworkSet();
networksAfterImport.removeAll(existingNetworks);
assertEquals(1, networksAfterImport.size());
return networksAfterImport.iterator().next();
}
use of org.cytoscape.work.TaskIterator in project EnrichmentMapApp by BaderLab.
the class MasterDetailDialogPage method finish.
@Override
public void finish() {
if (!validateInput())
return;
String prefix = legacySupport.getNextAttributePrefix();
SimilarityMetric similarityMetric = cutoffPanel.getSimilarityMetric();
double pvalue = cutoffPanel.getPValue();
double qvalue = cutoffPanel.getQValue();
NESFilter nesFilter = cutoffPanel.getNESFilter();
double cutoff = cutoffPanel.getCutoff();
double combined = cutoffPanel.getCombinedConstant();
Optional<Integer> minExperiments = cutoffPanel.getMinimumExperiments();
EMCreationParameters params = new EMCreationParameters(prefix, pvalue, qvalue, nesFilter, minExperiments, similarityMetric, cutoff, combined);
params.setCreateDistinctEdges(distinctEdgesCheckbox.isSelected());
List<DataSetParameters> dataSets = dataSetListModel.toList().stream().map(DataSetListItem::getDetailPanel).map(DetailPanel::createDataSetParameters).filter(x -> x != null).collect(Collectors.toList());
// Overwrite all the expression files if the common file has been provided
String exprPath = commonPanel.getExpressionFile();
if (!isNullOrEmpty(exprPath)) {
for (DataSetParameters dsp : dataSets) {
dsp.getFiles().setExpressionFileName(exprPath);
}
}
// Overwrite all the gmt files if a common file has been provided
String gmtPath = commonPanel.getGmtFile();
if (!isNullOrEmpty(gmtPath)) {
for (DataSetParameters dsp : dataSets) {
dsp.getFiles().setGMTFileName(gmtPath);
}
}
CreateEnrichmentMapTaskFactory taskFactory = taskFactoryFactory.create(params, dataSets);
TaskIterator tasks = taskFactory.createTaskIterator();
// Close this dialog after the progress dialog finishes normally
tasks.append(new AbstractTask() {
public void run(TaskMonitor taskMonitor) {
callback.close();
}
});
dialogTaskManager.execute(tasks);
}
use of org.cytoscape.work.TaskIterator 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.TaskIterator 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();
}
});
}
Aggregations