@Override public void run(TaskMonitor taskMonitor) throws Exception { if (network == null) network = appMgr.getCurrentNetwork(); views = new ArrayList<CyNetworkView>(viewMgr.getNetworkViews(network)); taskMonitor.showMessage( TaskMonitor.Level.INFO, "Views for network " + DataUtils.getNetworkTitle(network)); for (CyNetworkView view : views) { taskMonitor.showMessage(TaskMonitor.Level.INFO, " " + view); return; } }
@Override public void run(TaskMonitor taskMonitor) { taskMonitor.setProgress(0.0); taskMonitor.setTitle("PRWP with Priors ranking of clusters"); taskMonitor.showMessage(TaskMonitor.Level.INFO, "Fetching clusters..."); taskMonitor.setProgress(0.1); List<NodeCluster> clusters = ClusterUtils.fetchClusters(network); taskMonitor.setProgress(0.5); initVariables(); clusters.forEach(NodeCluster::initNodeScores); taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting node scores in clusters"); addNodes(); taskMonitor.setProgress(0.6); taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting edge scores in clusters"); addEdges(); taskMonitor.setProgress(0.7); taskMonitor.showMessage(TaskMonitor.Level.INFO, "Calculating PageRank scores"); PageRank<PRNode, PREdge> pageRank = performPageRank(); taskMonitor.setProgress(0.8); taskMonitor.showMessage(TaskMonitor.Level.INFO, "Inserting scores into clusters"); insertScores(clusters, pageRank); taskMonitor.setProgress(0.9); taskMonitor.showMessage(TaskMonitor.Level.INFO, "Insert cluster information in tables"); ClusterUtils.insertResultsInColumns(network, clusters, SHORTNAME); taskMonitor.setProgress(1.0); taskMonitor.showMessage(TaskMonitor.Level.INFO, "Done..."); }
@Override public void run(TaskMonitor tm) throws Exception { tm.setTitle("Loading network from table"); tm.setProgress(0.0); tm.setStatusMessage("Loading network..."); Workbook workbook = null; // Load Spreadsheet data for preview. if (fileType != null && (fileType.equalsIgnoreCase(SupportedFileType.EXCEL.getExtension()) || fileType.equalsIgnoreCase(SupportedFileType.OOXML.getExtension())) && workbook == null) { try { workbook = WorkbookFactory.create(is); } catch (InvalidFormatException e) { throw new IllegalArgumentException( "Could not read Excel file. Maybe the file is broken?", e); } finally { if (is != null) is.close(); } } try { if (this.fileType.equalsIgnoreCase(SupportedFileType.EXCEL.getExtension()) || this.fileType.equalsIgnoreCase(SupportedFileType.OOXML.getExtension())) { String networkName = ntmp.getName(); if (networkName == null) networkName = workbook.getSheetName(0); final Sheet sheet = workbook.getSheet(networkName); reader = new ExcelNetworkSheetReader( networkName, sheet, ntmp, nMap, rootNetwork, serviceRegistrar); } else { reader = new NetworkTableReader(inputName, is, ntmp, nMap, rootNetwork, serviceRegistrar); } } catch (Exception ioe) { tm.showMessage(TaskMonitor.Level.ERROR, "Unable to read table: " + ioe.getMessage()); return; } loadNetwork(tm); tm.setProgress(1.0); }
public void run(TaskMonitor monitor) { monitor.setTitle("Performing MCL cluster"); this.monitor = monitor; if (network == null) network = clusterManager.getNetwork(); context.setNetwork(network); NodeCluster.init(); DistanceMatrix matrix = context.edgeAttributeHandler.getMatrix(); if (matrix == null) { monitor.showMessage( TaskMonitor.Level.ERROR, "Can't get distance matrix: no attribute value?"); return; } // Update our tunable results clusterAttributeName = context.getClusterAttribute(); createGroups = context.advancedAttributes.createGroups; if (canceled) return; // Cluster the nodes runMCL = new RunMCL( matrix, context.inflation_parameter, context.iterations, context.clusteringThresh, context.maxResidual, context.maxThreads, monitor); runMCL.setDebug(debug); if (canceled) return; monitor.showMessage(TaskMonitor.Level.INFO, "Clustering..."); // results = runMCL.run(monitor); List<NodeCluster> clusters = runMCL.run(network, monitor); if (clusters == null) return; // Canceled? monitor.showMessage(TaskMonitor.Level.INFO, "Removing groups"); // Remove any leftover groups from previous runs removeGroups(network, GROUP_ATTRIBUTE); monitor.showMessage(TaskMonitor.Level.INFO, "Creating groups"); params = new ArrayList<String>(); context.edgeAttributeHandler.setParams(params); List<List<CyNode>> nodeClusters = createGroups(network, clusters, GROUP_ATTRIBUTE); results = new AbstractClusterResults(network, nodeClusters); monitor.showMessage(TaskMonitor.Level.INFO, "MCL results:\n" + results); if (context.vizProperties.showUI) { monitor.showMessage(TaskMonitor.Level.INFO, "Creating network"); insertTasksAfterCurrentTask( new NewNetworkView(network, clusterManager, true, context.vizProperties.restoreEdges)); } }