use of edu.ucsf.rbvi.clusterMaker2.internal.api.Matrix in project clusterMaker2 by RBVI.
the class SimpleMatrix method like.
public Matrix like(Matrix initial) {
Matrix newMat = like();
newMat.initialize(initial.nRows(), initial.nColumns(), initial.toArray());
return newMat;
}
use of edu.ucsf.rbvi.clusterMaker2.internal.api.Matrix in project clusterMaker2 by RBVI.
the class SimpleMatrix method like.
public Matrix like(int rows, int columns, double[][] initial) {
Matrix newMat = like();
newMat.initialize(rows, columns, initial);
return newMat;
}
use of edu.ucsf.rbvi.clusterMaker2.internal.api.Matrix in project clusterMaker2 by RBVI.
the class SimpleOps method wrap.
private Matrix wrap(DoubleMatrix2D mat) {
Matrix result = new SimpleMatrix();
result.initialize(mat.rows(), mat.columns(), mat.toArray());
return result;
}
use of edu.ucsf.rbvi.clusterMaker2.internal.api.Matrix in project clusterMaker2 by RBVI.
the class APCluster method run.
public void run(TaskMonitor monitor) {
monitor.setTitle("Performing AP cluster");
this.monitor = monitor;
if (network == null)
network = clusterManager.getNetwork();
// Make sure to update the context
context.setNetwork(network);
NodeCluster.init();
CyMatrix 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
runAP = new RunAP(matrix, context.lambda, context.preference, context.rNumber, monitor, debug);
if (canceled)
return;
monitor.showMessage(TaskMonitor.Level.INFO, "Clustering...");
List<NodeCluster> clusters = runAP.run(network, monitor);
// Canceled?
if (clusters == null)
return;
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);
setParams(params);
List<List<CyNode>> nodeClusters = createGroups(network, clusters, GROUP_ATTRIBUTE);
results = new AbstractClusterResults(network, clusters);
monitor.showMessage(TaskMonitor.Level.INFO, "Done. AP results:\n" + results);
if (context.vizProperties.showUI) {
monitor.showMessage(TaskMonitor.Level.INFO, "Creating network");
insertTasksAfterCurrentTask(new NewNetworkView(network, clusterManager, true, context.vizProperties.restoreEdges, !context.edgeAttributeHandler.selectedOnly));
}
}
use of edu.ucsf.rbvi.clusterMaker2.internal.api.Matrix in project clusterMaker2 by RBVI.
the class MCLCluster method run.
public void run(TaskMonitor monitor) {
monitor.setTitle("Performing MCL cluster");
this.monitor = monitor;
if (network == null)
network = clusterManager.getNetwork();
context.setNetwork(network);
NodeCluster.init();
CyMatrix 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, context.forceDecliningResidual, monitor);
runMCL.setDebug(false);
if (canceled)
return;
monitor.showMessage(TaskMonitor.Level.INFO, "Clustering...");
// results = runMCL.run(monitor);
List<NodeCluster> clusters = runMCL.run(network, monitor);
// Canceled?
if (clusters == null)
return;
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, clusters);
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, !context.edgeAttributeHandler.selectedOnly));
}
}
Aggregations