本文整理汇总了Java中org.cytoscape.work.TaskIterator类的典型用法代码示例。如果您正苦于以下问题:Java TaskIterator类的具体用法?Java TaskIterator怎么用?Java TaskIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TaskIterator类属于org.cytoscape.work包,在下文中一共展示了TaskIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTaskIterator
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
public TaskIterator createTaskIterator(Class<? extends DataSeries<?, ?>> preferredClass) {
ImportDataSeriesTask importTask = new ImportDataSeriesTask(registrar);
if(preferredClass != null)
{
importTask.setPreferredProvider(preferredClass);
}
BiFunction<File, StringBuilder, ValidationState> fileValidator = (file, msg) ->
{
if(file.length() > MAX_SAFE_FILE_SIZE)
{
msg.append("The file you have chosen is large, and may cause Cytoscape to run out of memory.\nDue to a bug in Cytoscape this may render the program unusable and you may loose data.\nAre you sure you want to continue?");
return ValidationState.REQUEST_CONFIRMATION;
}
return ValidationState.OK;
};
AskForInputFileTask inputFileTask = new AskForInputFileTask("Choose input file",
file -> importTask.importParameters.setFile(file)
, fileValidator
);
return new TaskIterator(inputFileTask, importTask);
}
示例2: expandAllClusters
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
/**
* This is a huge hack to get around a bug in cytoscape.
* All groups must be expanded before the session is saved.
*/
private void expandAllClusters() {
Collection<CyNetworkView> networkViews =
modelManagerProvider.get()
.getNetworkViewSets()
.stream()
.map(NetworkViewSet::getNetworkView)
.collect(Collectors.toSet());
if(networkViews.isEmpty())
return;
TaskIterator tasks = getExpandTasks(networkViews);
Semaphore semaphore = new Semaphore(0);
dialogTaskManager.execute(tasks, TaskTools.allFinishedObserver(() -> semaphore.release()));
// We need to block while the groups are expanding because this must happen before the session is saved.
semaphore.acquireUninterruptibly();
}
示例3: createAnnotations
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
private void createAnnotations() {
if(networkView == null)
return;
TabPanel tabPanel = (TabPanel)tabPane.getSelectedComponent();
AnnotationSetTaskParamters params = tabPanel.createAnnotationSetTaskParameters();
TaskIterator tasks = new TaskIterator();
tasks.append(TaskTools.taskMessage("Generating Clusters"));
// clusterMaker does not like it when there are collapsed groups
CollapseAllTaskFactory collapseAllTaskFactory = collapseTaskFactoryFactory.create(Grouping.EXPAND, params.getNetworkView());
tasks.append(collapseAllTaskFactory.createTaskIterator());
CreateAnnotationSetTask createTask = createTaskFactory.create(params);
tasks.append(createTask);
dialogTaskManager.execute(tasks);
}
示例4: runSelectAnnotationSetTasks
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
private void runSelectAnnotationSetTasks(NetworkViewSet networkViewSet, AnnotationSet toSelect) {
// Disable the combo so the user can't somehow start a new task while this one is still running
annotationSetCombo.setEnabled(false);
TaskIterator tasks = new TaskIterator();
// Expand all the groups
CollapseAllTaskFactory collapseAllTaskFactory = collapseTaskFactoryFactory.create(Grouping.EXPAND, networkViewSet);
tasks.append(collapseAllTaskFactory.createTaskIterator());
// Select the annotation set (fires event that redraws annotations)
tasks.append(taskOf(() -> networkViewSet.select(toSelect)));
// Enable the combo box
TaskObserver observer = allFinishedObserver(() -> annotationSetCombo.setEnabled(true));
dialogTaskManager.execute(tasks, observer);
}
示例5: actionPerformed
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
boolean doIt = true;
if(warn) {
WarnDialog warnDialog = warnDialogProvider.get();
doIt = warnDialog.warnUser(jFrameProvider.get());
}
if(doIt) {
AnnotationSet annotationSet = getClusters().iterator().next().getParent();
LabelMakerManager labelManager = labelManagerProvider.get();
LabelMaker labelMaker = labelManager.getLabelMaker(annotationSet);
TaskIterator tasks =
getClusters()
.stream()
.map(cluster -> relabelTaskProvider.get().init(cluster, labelMaker))
.collect(TaskTools.taskIterator());
if(tasks.getNumTasks() > 0) {
dialogTaskManager.execute(tasks);
}
}
}
示例6: runClusterMaker
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
private Map<String,Collection<CyNode>> runClusterMaker(Optional<Double> cutoff) {
CyNetworkView networkView = params.getNetworkView();
CyNetwork network = networkView.getModel();
boolean hasHidden = hasHiddenNodes(networkView);
if(hasHidden) {
Collection<CyNode> visibleNodes = getVisibleNodes(networkView);
CreateSubnetworkTask subnetworkTask = subnetworkTaskFactory.create(network, visibleNodes);
ResultObserver<CyNetwork> observer = new ResultObserver<>(subnetworkTask, CyNetwork.class);
syncTaskManager.execute(new TaskIterator(subnetworkTask), observer);
network = observer.getResults().get();
networkManager.addNetwork(network, false);
}
RunClusterMakerTaskFactory clusterMakerTaskFactory =
clusterMakerFactoryFactory.create(network, params.getClusterAlgorithm(), params.getClusterMakerEdgeAttribute(), cutoff.orElse(null));
RunClusterMakerResultObserver clusterResultObserver = new RunClusterMakerResultObserver();
TaskIterator tasks = clusterMakerTaskFactory.createTaskIterator(clusterResultObserver);
syncTaskManager.execute(tasks);
Map<String,Collection<CyNode>> result = clusterResultObserver.getResult();
if(hasHidden) {
networkManager.destroyNetwork(network);
}
return result;
}
示例7: createTaskIterator
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
@Override
public TaskIterator createTaskIterator() {
TaskIterator tasks = new TaskIterator();
CyLayoutAlgorithm attributeCircle = layoutManager.getLayout("attributes-layout");
TaskIterator attributeLayoutTasks = attributeCircle.createTaskIterator(view, attributeCircle.createLayoutContext(), CyLayoutAlgorithm.ALL_NODE_VIEWS, layoutAttribute);
tasks.append(attributeLayoutTasks);
CyLayoutAlgorithm force_directed = layoutManager.getLayout("force-directed");
for(Collection<CyNode> cluster : clusters) {
Set<View<CyNode>> nodeViewSet = new HashSet<>();
for(CyNode node : cluster) {
nodeViewSet.add(view.getNodeView(node));
}
// Only apply layout to nodes of size greater than 4
if (nodeViewSet.size() > 4) {
TaskIterator forceTasks = force_directed.createTaskIterator(view, force_directed.createLayoutContext(), nodeViewSet, null);
tasks.append(forceTasks);
}
}
return tasks;
}
示例8: createTaskIterator
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
public TaskIterator createTaskIterator(TaskObserver taskObserver) {
List<String> commands = new ArrayList<>(clusters.size());
for(Map.Entry<?,Collection<CyNode>> entry : clusters.entrySet()) {
Object key = entry.getKey();
Collection<CyNode> nodes = entry.getValue();
StringBuilder names = new StringBuilder();
for(CyNode node : nodes) {
names.append("SUID:" + network.getRow(node).get(CyNetwork.SUID, Long.class) + ",");
}
String command =
String.format("wordcloud create wordColumnName=\"%s\" cloudName=\"%s\" nodeList=\"%s\" create=false",
labelColumn, String.valueOf(key), names);
commands.add(command);
}
return commandTaskFactory.createTaskIterator(commands, taskObserver);
}
示例9: isWordcloudRequiredVersionInstalled
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
public boolean isWordcloudRequiredVersionInstalled() {
if(!availableCommands.getNamespaces().contains("wordcloud"))
return false;
if(!availableCommands.getCommands("wordcloud").contains("version"))
return false;
String command = "wordcloud version";
VersionTaskObserver observer = new VersionTaskObserver();
TaskIterator taskIterator = commandTaskFactory.createTaskIterator(observer, command);
syncTaskManager.execute(taskIterator);
if(!observer.hasResult())
return false;
int major = observer.version[0];
int minor = observer.version[1];
int micro = observer.version[2];
Version actual = new Version(major, minor, micro);
return actual.compareTo(WORDCLOUD_MINIMUM) >= 0;
}
示例10: updateView
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
public static void updateView(CyNetworkView view, String layoutAlgorName){
CyAppAdapter appAdapter = CyActivator.getCyAppAdapter();
CyLayoutAlgorithmManager alMan = appAdapter.getCyLayoutAlgorithmManager();
CyLayoutAlgorithm algor = null;
if (layoutAlgorName == null) {
algor = alMan.getDefaultLayout(); // default grid layout
} else{
algor = alMan.getLayout(layoutAlgorName);
}
if(algor == null){
algor = alMan.getDefaultLayout();
throw new IllegalArgumentException ("No such algorithm found '" + layoutAlgorName + "'.");
}
TaskIterator itr = algor.createTaskIterator(view,algor.createLayoutContext(),CyLayoutAlgorithm.ALL_NODE_VIEWS,null);
appAdapter.getTaskManager().execute(itr);// We use the synchronous task manager otherwise the visual style and updateView() may occur before the view is relayed out:
SynchronousTaskManager<?> synTaskMan = appAdapter.getCyServiceRegistrar().getService(SynchronousTaskManager.class);
synTaskMan.execute(itr);
view.updateView(); // update view layout part
appAdapter.getVisualMappingManager().getVisualStyle(view).apply(view); // update view style part
}
示例11: start
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
CyApplicationManager applicationManager = getService(context, CyApplicationManager.class);
CySwingApplication swingApplication = getService(context, CySwingApplication.class);
CyServiceRegistrar serviceRegistrar = getService(context, CyServiceRegistrar.class);
VisualMappingManager visualMappingManager = getService(context, VisualMappingManager.class);
VizmapReaderManager vizmapReaderManager = getService(context, VizmapReaderManager.class);
TaskManager taskManager = getService(context, TaskManager.class);
CySwing.init(swingApplication, serviceRegistrar);
NetworkController.init(applicationManager, visualMappingManager);
// UI controls
MenuAction menuAction = new MenuAction(taskManager);
registerService(context, menuAction, CyAction.class, new Properties());
taskManager.execute(new TaskIterator(new ImportGFDNetVisualStylesTask(visualMappingManager, vizmapReaderManager)));
serviceRegistrar.registerService(new ClickOnViewListener(), RowsSetListener.class, new Properties());
serviceRegistrar.registerService(new NetworkClosedListener(), NetworkAboutToBeDestroyedListener.class, new Properties());
}
示例12: analyzeButtonPressed
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
private void analyzeButtonPressed() {
Integer inputValidation = validateInput();
if (inputValidation == 1) { // Use fulfills basic input requirements
InputTask inputTask = createInputTask();
clusterFactory = new SupervisedComplexTaskFactory(inputTask, appManager);
DialogTaskManager dialogTaskManager = registrar.getService(DialogTaskManager.class);
TaskIterator taskIter = clusterFactory.createTaskIterator();
dialogTaskManager.execute(taskIter);
Component[] evalComponents = evaluatePanel.getComponents();
for(int i = 0; i < evalComponents.length; i++) {
evalComponents[i].setVisible(true);
}
evaluatePanel.setVisible(true);
evaluateButton.setVisible(true);
TitledBorder eval = BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.blue), "Evaluate Results");
eval.setTitleColor(Color.blue);
evaluatePanel.setBorder(eval);
} else if (inputValidation == 2) {
JOptionPane.showMessageDialog(this, "Please select a training option");
} else if (inputValidation == 3) {
JOptionPane.showMessageDialog(this, "Please load a positive training file");
} else if (inputValidation == 4) {
JOptionPane.showMessageDialog(this, "Please select a scoring option");
} else if (inputValidation == 5) {
JOptionPane.showMessageDialog(this, "Please load a seed file, or uncheck 'Use Starting Seeds From File' under the advanced search parameters.");
} else if (inputValidation == 6) {
JOptionPane.showMessageDialog(this, "Please select the protein graph under 'Search'");
}
}
示例13: syncDown
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
@Override
public void syncDown(boolean mergeInCurrent) {
TaskIterator it = new SyncDownTaskFactory(getPlugin().getCyNetworkManager(),
mergeInCurrent,
getPlugin().getCyNetworkFactory(),
getInstanceLocation(),
getCypherURL(),
getAuth(),
getPlugin().getCyNetViewMgr(),
getPlugin().getCyNetworkViewFactory(),
getPlugin().getCyLayoutAlgorithmManager(),
getPlugin().getVisualMappingManager()
).createTaskIterator();
plugin.getDialogTaskManager().execute(it);
}
示例14: actionPerformed
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Extension forceAtlas2LayoutExt = getPlugin().getInteractor().supportsExtension("forceatlas2");
ForceAtlas2LayoutExtExec exec = new ForceAtlas2LayoutExtExec();
exec.setPlugin(plugin);
exec.setExtension(forceAtlas2LayoutExt);
ForceAtlas2ExecutionTaskFactory factory = new ForceAtlas2ExecutionTaskFactory(exec);
do{
if(!exec.collectParameters()){
JOptionPane.showMessageDialog(plugin.getCySwingApplication().getJFrame(), "Failed to collect parameters for " + forceAtlas2LayoutExt.getName());
return;
}
TaskIterator it = factory.createTaskIterator();
plugin.getDialogTaskManager().execute(it);
} while(exec.doContinue());
}
示例15: createDetailsHtmlTextPane
import org.cytoscape.work.TaskIterator; //导入依赖的package包/类
private JTextPane createDetailsHtmlTextPane() {
final JTextPane textPane = new JTextPane();
textPane.setEditable(false);
textPane.setBorder(new EmptyBorder(7,7,7,7));
textPane.setContentType("text/html");
textPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
textPane.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
//import/create a network (parent pathways) if the link is clicked
String uri = hyperlinkEvent.getURL().toString();
final CPathGetQuery query = App.client.createGetQuery().sources(Collections.singleton(uri));
App.cyServices.taskManager.execute(new TaskIterator(
new NetworkAndViewTask(query, current.toString())));
}
}
});
style(textPane);
return textPane;
}