use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.AbstractClusterResults in project clusterMaker2 by RBVI.
the class AutoSOMECluster method run.
public void run(TaskMonitor monitor) {
this.monitor = monitor;
monitor.setTitle("Performing " + getName());
String networkID = ModelUtils.getNetworkName(network);
// Update settings from our context
settings = context.getSettings();
// got back to parent to cluster again
if (networkID.contains("--AutoSOME")) {
String[] tokens = networkID.split("--AutoSOME");
networkID = tokens[0];
network = ModelUtils.getNetworkWithName(clusterManager, networkID);
}
List<String> dataAttributes = context.attributeList.getNodeAttributeList();
// Cluster the nodes
runAutoSOME = new RunAutoSOME(clusterManager, dataAttributes, network, settings, monitor);
runAutoSOME.setIgnoreMissing(context.ignoreMissing);
runAutoSOME.setSelectedOnly(context.selectedOnly);
runAutoSOME.setDebug(debug);
monitor.setStatusMessage("Running AutoSOME" + ((settings.distMatrix) ? " Fuzzy Clustering" : ""));
nodeCluster = runAutoSOME.run(monitor);
if (nodeCluster == null) {
monitor.setStatusMessage("Clustering failed!");
return;
}
if (nodeCluster.size() > 0)
finishedClustering = true;
monitor.setStatusMessage("Removing groups");
// Remove any leftover groups from previous runs
removeGroups(network, getShortName());
monitor.setStatusMessage("Creating groups");
if (settings.distMatrix)
runAutoSOME.getEdges(context.maxEdges);
attrList = runAutoSOME.attrList;
attrOrderList = runAutoSOME.attrOrderList;
nodeOrderList = runAutoSOME.nodeOrderList;
ModelUtils.createAndSetLocal(network, network, ClusterManager.CLUSTER_NODE_ATTRIBUTE, attrList, List.class, String.class);
ModelUtils.createAndSetLocal(network, network, ClusterManager.ARRAY_ORDER_ATTRIBUTE, attrOrderList, List.class, String.class);
ModelUtils.createAndSetLocal(network, network, ClusterManager.NODE_ORDER_ATTRIBUTE, nodeOrderList, List.class, String.class);
ModelUtils.createAndSetLocal(network, network, ClusterManager.CLUSTER_TYPE_ATTRIBUTE, getShortName(), String.class, null);
List<List<CyNode>> nodeClusters;
if (!settings.distMatrix) {
nodeClusters = createGroups(network, nodeCluster, GROUP_ATTRIBUTE);
results = new AbstractClusterResults(network, nodeCluster);
monitor.setStatusMessage("Done. AutoSOME results:\n" + results);
} else {
nodeClusters = new ArrayList<List<CyNode>>();
/*
for (NodeCluster cluster: clusters) {
List<CyNode>nodeList = new ArrayList();
for (CyNode node: cluster) {
nodeList.add(node);
}
nodeClusters.add(nodeList);
}
*/
monitor.setStatusMessage("Done. AutoSOME results:\n" + nodeCluster.size() + " clusters found.");
}
if (context.showViz) {
if (heatmap)
insertTasksAfterCurrentTask(new KnnView(clusterManager));
else
insertTasksAfterCurrentTask(new NewNetworkView(network, clusterManager, true, false, !context.selectedOnly));
}
}
use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.AbstractClusterResults in project clusterMaker2 by RBVI.
the class HyperlinkInducedTopicSearch method run.
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setProgress(0.0);
taskMonitor.setTitle("Hyperlink-Induced Topic Search ranking of clusters");
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Fetching clusters...");
taskMonitor.setProgress(0.1);
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, "Performing HITS algorithm");
HITS<PRNode, PREdge> hyperlinkInducedTopicSearchPriors = performHITS(graph);
taskMonitor.setProgress(0.8);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting cluster scores");
insertScores(clusters, graph, hyperlinkInducedTopicSearchPriors);
taskMonitor.setProgress(0.9);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Insert cluster information in tables");
ClusterUtils.insertResultsInColumns(network, clusters, SHORTNAME);
results = new AbstractClusterResults(network, clusters);
taskMonitor.setProgress(1.0);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Done...");
}
use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.AbstractClusterResults in project clusterMaker2 by RBVI.
the class MultipleAttributeAddition method run.
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setProgress(0.0);
taskMonitor.setTitle("Multiple Node Edge Additive ranking of clusters");
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Fetching clusters...");
taskMonitor.setProgress(0.1);
List<NodeCluster> clusters = ClusterUtils.fetchClusters(network);
taskMonitor.setProgress(0.5);
String clusterColumnName = ClusterUtils.getClusterAttribute(network);
List<String> nodeAttributes = context.getSelectedNodeAttributes();
List<String> edgeAttributes = context.getSelectedEdgeAttributes();
taskMonitor.setProgress(0.6);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting node scores in clusters");
clusters = ClusterUtils.setNodeScoresInCluster(network, clusters, nodeAttributes, clusterColumnName, false);
taskMonitor.setProgress(0.75);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting edge scores in clusters");
clusters = ClusterUtils.setEdgeScoresInCluster(network, clusters, edgeAttributes, clusterColumnName, false);
taskMonitor.setProgress(0.80);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Sorting and ranking clusters");
ClusterUtils.ascendingSort(clusters);
NodeCluster.setClusterRanks(clusters);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Insert cluster information in tables");
ClusterUtils.insertResultsInColumns(network, clusters, SHORTNAME);
results = new AbstractClusterResults(network, clusters);
taskMonitor.setProgress(1.0);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Done...");
}
use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.AbstractClusterResults in project clusterMaker2 by RBVI.
the class MultipleAttributeMultiplicative method run.
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setProgress(0.0);
taskMonitor.setTitle("Multiple Node Edge Multiplum ranking of clusters");
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Fetching clusters...");
taskMonitor.setProgress(0.1);
List<NodeCluster> clusters = ClusterUtils.fetchClusters(network);
taskMonitor.setProgress(0.5);
String clusterColumnName = ClusterUtils.getClusterAttribute(network);
List<String> nodeAttributes = context.getSelectedNodeAttributes();
List<String> edgeAttributes = context.getSelectedEdgeAttributes();
taskMonitor.setProgress(0.6);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting node scores in clusters");
clusters = ClusterUtils.setNodeScoresInCluster(network, clusters, nodeAttributes, clusterColumnName, true);
taskMonitor.setProgress(0.75);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting edge scores in clusters");
clusters = ClusterUtils.setEdgeScoresInCluster(network, clusters, edgeAttributes, clusterColumnName, true);
taskMonitor.setProgress(0.80);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Sorting and ranking clusters");
ClusterUtils.ascendingSort(clusters);
NodeCluster.setClusterRanks(clusters);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Insert cluster information in tables");
ClusterUtils.insertResultsInColumns(network, clusters, SHORTNAME);
results = new AbstractClusterResults(network, clusters);
taskMonitor.setProgress(1.0);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Done...");
}
use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.AbstractClusterResults in project clusterMaker2 by RBVI.
the class PR method run.
@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);
results = new AbstractClusterResults(network, clusters);
taskMonitor.setProgress(1.0);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Done...");
}
Aggregations