本文整理汇总了Java中org.cytoscape.work.TaskMonitor类的典型用法代码示例。如果您正苦于以下问题:Java TaskMonitor类的具体用法?Java TaskMonitor怎么用?Java TaskMonitor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TaskMonitor类属于org.cytoscape.work包,在下文中一共展示了TaskMonitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
SmoothingService smoothingService = registrar.getService(SmoothingService.class);
TimeSeries smoothedSeries = smoothingService.smooth(sourceTimeSeries, estimateX, provider, parameter, outputParameters.resultName, rowGrouping);
registrar.getService(DataSeriesManager.class).registerDataSeries(smoothedSeries);
if(outputParameters.mapResult)
{
MappingManipulationService manipulationService = registrar.getService(MappingManipulationService.class);
if(outputParameters.replaceMapping)
{
manipulationService.replaceMapping(sourceTimeSeries, smoothedSeries, rowGrouping);
}
else
{
manipulationService.copyMapping(sourceTimeSeries, smoothedSeries, rowGrouping, outputParameters.mappingSuffix);
}
}
registrar.unregisterAllServices(sourcePanel);
}
示例2: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
SwingUtilities.invokeLater( () -> {
final JFrame parent = registrar.getService(CySwingApplication.class).getJFrame();
final JDialog frm = new JDialog(parent, "Manage data series mappings");
frm.setLayout(new BorderLayout());
frm.add(new MappingManagerPanel(registrar), BorderLayout.CENTER);
JButton closeButton = new JButton("Close");
closeButton.addActionListener(e -> frm.setVisible(false));
frm.add(closeButton, BorderLayout.SOUTH);
frm.pack();
frm.setModal(true);
int x = (parent.getWidth() - frm.getWidth()) / 2;
int y = (parent.getHeight() - frm.getHeight()) / 2;
frm.setLocation(parent.getX() + x, parent.getY() + y);
frm.setVisible(true);
});
}
示例3: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor tm) throws Exception {
//DS is loaded during validation to let the user modify the options immediately after an import failure
if(importedDS == null)
{
throw new DataSeriesException("Invalid import task state: series was not imported, although validation passed.");
}
dataSeriesManager.registerDataSeries(importedDS);
if(mapAfterImport)
{
MapColumnTask mapColumnTask = new MapColumnTask(registrar);
mapColumnTask.dataSeries.setSelectedValue(importedDS);
mapColumnTask.newColumnName = importedDS.getName();
insertTasksAfterCurrentTask(mapColumnTask);
}
}
示例4: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor tm) throws Exception {
tm.setTitle(TITLE);
List<Cluster> clusters = new ArrayList<>(as.getClusters());
clusters.sort(Comparator.comparing(Cluster::getNodeCount).thenComparing(Cluster::getLabel).reversed());
try(BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
writer.append("Cluster").append("\t").append("Nodes");
writer.newLine();
for(Cluster cluster : clusters) {
writer.append(cluster.getLabel()).append("\t").append(String.valueOf(cluster.getNodeCount()));
writer.newLine();
}
}
}
示例5: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
taskMonitor.setTitle(BuildProperties.APP_NAME);
taskMonitor.setStatusMessage("Removing Clusters");
ShapeAnnotation shape = annotationRenderer.removeShapeAnnoation(cluster);
TextAnnotation text = annotationRenderer.removeTextAnnotation(cluster);
// invokeAndWait forces the shape to update on the current thread
if(shape != null) {
if(SwingUtilities.isEventDispatchThread()) {
shape.removeAnnotation();
} else {
SwingUtilities.invokeAndWait(shape::removeAnnotation);
}
}
if(text != null) {
if(SwingUtilities.isEventDispatchThread()) {
text.removeAnnotation();
} else {
SwingUtilities.invokeAndWait(text::removeAnnotation);
}
}
}
示例6: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setTitle(BuildProperties.APP_NAME);
taskMonitor.setStatusMessage("Removing Annotations");
CyNetworkView networkView = networkViewSet.getNetworkView();
List<Annotation> annotations = annotationManager.getAnnotations(networkView);
if(annotations != null) { // seriously?
for(Annotation annotation : annotations) {
try {
SwingUtilities.invokeAndWait(annotation::removeAnnotation);
} catch (Exception e) {}
}
}
for(Cluster cluster : networkViewSet.getAllClusters()) {
annotationRenderer.removeShapeAnnoation(cluster);
annotationRenderer.removeTextAnnotation(cluster);
}
}
示例7: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setTitle(BuildProperties.APP_NAME);
taskMonitor.setStatusMessage("Drawing Annotations");
try {
// So basically the task does nothing if the cluster is collapsed.
// This just saves us from having to put an if-statement in the renderer.
if(!cluster.isCollapsed()) {
drawShape();
drawLabel();
}
} catch(Exception e) {
e.printStackTrace();
}
}
示例8: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
/**
* This is fast because no events are fired while the summary network is being built.
* The summary network and view are registered at the end.
*/
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setTitle(BuildProperties.APP_NAME);
taskMonitor.setStatusMessage(SummaryNetworkAction.TITLE);
CyNetwork originNetwork = annotationSet.getParent().getNetwork();
List<SummaryCluster> summaryClusters = getSummaryClusters();
// create summary network
SummaryNetwork summaryNetwork = createSummaryNetwork(originNetwork, summaryClusters);
// create summary network view
CyNetworkView summaryNetworkView = createNetworkView(summaryNetwork);
// apply visual style
applyVisualStyle(annotationSet.getParent().getNetworkView(), summaryNetworkView, summaryNetwork);
// register
networkManager.addNetwork(summaryNetwork.network);
networkViewManager.addNetworkView(summaryNetworkView);
summaryNetworkView.fitContent();
resultNetwork = summaryNetwork.network;
}
示例9: createSifNodeAttr
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
private void createSifNodeAttr(Model model, CyNetwork cyNetwork,
TaskMonitor taskMonitor) throws IOException
{
taskMonitor.setStatusMessage("Updating SIF network node attributes from the BioPAX model...");
// Set the Quick Find Default Index
AttributeUtil.set(cyNetwork, cyNetwork, "quickfind.default_index", CyNetwork.NAME, String.class);
if (cancelled) return;
// Set node attributes from the Biopax Model
for (CyNode node : cyNetwork.getNodeList()) {
String uri = cyNetwork.getRow(node).get(CyNetwork.NAME, String.class);
BioPAXElement e = model.getByID(uri);
if(e instanceof EntityReference || e instanceof Entity)
{
BioPaxMapper.createAttributesFromProperties(e, model, node, cyNetwork);
} else if (e != null) {
log.warn("SIF network has an unexpected node: " + uri + " of type " + e.getModelInterface());
BioPaxMapper.createAttributesFromProperties(e, model, node, cyNetwork);
} else { //should never happen anymore...
log.error("(BUG) the biopax model does not have an object with URI=" + uri);
}
}
}
示例10: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor tm) throws Exception {
tm.setTitle("Adjacency Matrix import");
tm.setStatusMessage("Adjacency Matrix import");
CyNetwork n = readAdjFormat(inputStream, tm);
this.networks = new CyNetwork[]{n};
networkMgr.addNetwork(n);
// GraphsWithValidation gv = checkSchema(inputStream, graphReader);
// Graph[] graphs = gv.getGraphs();
// tm.setProgress(0.50);
//
// tm.setStatusMessage(format("Creating %d networks from \"%s\".", graphs.length, inputName));
// this.networks = mapNetworks(graphs);
// for (CyNetwork n : this.networks)
// networkMgr.addNetwork(n);
//
// // set up evidence table if we have cytoscape networks
// if (this.networks.length > 0) {
// CyTable table = getOrCreateEvidenceTable();
// mapGraphsToEvidenceTable(graphs, table);
// tableMgr.addTable(table);
// }
// m.setProgress(1.0);
}
示例11: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(final TaskMonitor taskMonitor) throws Exception {
for (VisualStyle style : visualMappingManager.getAllVisualStyles()) {
if (style.getTitle().equals(GFDNET_VIZMAP_FILE)) {
return;
}
}
URL url = this.getClass().getClassLoader().getResource(GFDNET_VIZMAP_FILE);
VizmapReader reader = vizmapReaderManager.getReader(url.toURI(), url.getPath());
if (reader == null) {
throw new NullPointerException("Failed to find Default Vizmap loader.");
}
insertTasksAfterCurrentTask(reader, new AddVisualStylesTask(reader));
}
示例12: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void run(TaskMonitor m) throws Exception {
m.setTitle("Import BEL JSON Graph");
m.setStatusMessage(format("Read and validate \"%s\" against the BEL JSON Graph schema.", inputName));
GraphsWithValidation gv = checkSchema(inputStream, graphReader);
Graph[] graphs = gv.getGraphs();
m.setProgress(0.50);
m.setStatusMessage(format("Creating %d networks from \"%s\".", graphs.length, inputName));
this.networks = mapNetworks(graphs);
for (CyNetwork n : this.networks)
networkMgr.addNetwork(n);
// set up evidence table if we have cytoscape networks
if (this.networks.length > 0) {
CyTable table = getOrCreateEvidenceTable();
mapGraphsToEvidenceTable(graphs, table);
tableMgr.addTable(table);
}
m.setProgress(1.0);
}
示例13: execute
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
public List<Cluster> execute(InputTask input, TaskMonitor progress) throws Exception {
List<Cluster> results = new ArrayList<Cluster>();
int cores = Runtime.getRuntime().availableProcessors() * 2;
List<List<Cluster>> jobs = ClusterUtil.divideWork(candidates, cores);
executor = Executors.newFixedThreadPool(cores);
Phaser phaser = new Phaser();
for (List<Cluster> job: jobs) {
Runnable searchThread = new SeedSearch(model, job, phaser, input, candidates);
phaser.register();
executor.execute(searchThread);
}
executor.shutdown();
while (!executor.isTerminated()) {}
//Filter out clusters that are too small or too low-scoring and copy good ones to results
for (Cluster complex: candidates) {
if ((complex.getNodes().size() >= input.minSize) && (ClusterScore.score(complex, model) >= input.minScoreThreshold))
results.add(complex);
else
complex.destroy();
}
return results;
}
示例14: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor arg0) throws Exception {
// TODO Auto-generated method stub
synchronized (this) {
MyControlPanel mainPanel = null;
// First we must make sure that the app is not already open
if (!isOpen()) {
mainPanel = new MyControlPanel(swingApplication, registrar, appManager);
registrar.registerService(mainPanel, CytoPanelComponent.class, new Properties());
} else {
mainPanel = getMainPanel();
}
if (mainPanel != null) {
CytoPanel cytoPanel = swingApplication.getCytoPanel(CytoPanelName.WEST);;
int index = cytoPanel.indexOfComponent(mainPanel);
cytoPanel.setSelectedIndex(index);
}
}
}
示例15: run
import org.cytoscape.work.TaskMonitor; //导入依赖的package包/类
@Override
public void run(TaskMonitor monitor) throws Exception {
monitor.setStatusMessage("Executing ForceAtlas2 layout");
List<ExtensionCall> calls = exec.buildExtensionCalls();
double progress = 0.0;
for(ExtensionCall call : calls){
Object callRetValue = plugin.getInteractor().executeExtensionCall(call,false);
exec.processCallResponse(call,callRetValue);
++progress;
monitor.setProgress(progress / ((double)calls.size()));
}
}