Author: scooter
Date: 2011-01-31 17:40:10 -0800 (Mon, 31 Jan 2011)
New Revision: 23986
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/KCluster.java
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/RunSCPS.java
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/SCPSCluster.java
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/AutoSOMECluster.java
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/cluststruct/clusterValidity.java
Log:
Bug fixes to autosome and latest SCPS code
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/KCluster.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/KCluster.java
2011-02-01 00:11:03 UTC (rev 23985)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/KCluster.java
2011-02-01 01:40:10 UTC (rev 23986)
@@ -88,7 +88,7 @@
double error = Double.MAX_VALUE;
- // This matrix will store the centroid data. KxK matrix
+ // This matrix will store the KxK centroid data.matrix
SparseDoubleMatrix2D cData = new
SparseDoubleMatrix2D(nClusters, nClusters);
// Outer initialization
@@ -103,16 +103,21 @@
}
int iteration = 0;
+ boolean firstIteration = true;
+
+
+
do {
double total = Double.MAX_VALUE;
int counter = 0;
int period = 10;
+
+
- System.out.println(iteration + " Iterations");
-
// Randomly assign elements to clusters
if (nIterations != 0) randomAssign(nClusters,
nelements, tclusterid);
+ //boolean firstIteration = true;
// Initialize
for (int i = 0; i < nClusters; i++) counts[i] = 0;
@@ -120,7 +125,7 @@
while (true) {
- System.out.println("Total " + total);
+
double previous = total;
total = 0.0;
@@ -134,14 +139,17 @@
counter++;
//assign centroids as to maximize orthogonality
on first iteration of kmeans
- if(iteration == 0)
+ if(firstIteration){
+
selectCentroidsOrthogonally(nClusters,
matrix, cData);
-
+ firstIteration = false;
+ }
+
// Find the centeroids based on cluster means
on all other iterations
else
getClusterMeans(nClusters, matrix, cData,
tclusterid);
- System.out.println("Reached this part of Loop");
+
for (int i = 0; i < nelements; i++) {
// Calculate the distances
@@ -203,7 +211,7 @@
{
ifound = 1;
error = total;
- // System.out.println("Mapping
tclusterid to clusterid");
+
for (int i = 0; i < nelements;
i++) clusterID[i] = tclusterid[i];
}
break;
@@ -218,6 +226,47 @@
}
+
+ //Assign centroids to rows at random
+ private static void selectCentroidsRandom(int nClusters,
DoubleMatrix2D data, DoubleMatrix2D cdata){
+
+ System.out.println("Assigning centroids randomly");
+
+ //number of centroids allready set
+ int centroid_count = 0;
+
+ //centroid assigned element == 1 if centroid assigned, zero
otherwise
+ int[] centroid_assigned = new int[data.rows()];
+ for(int i = 0; i < nClusters; i++){centroid_assigned[i] = 0;}
+
+ //randomly select first centroid
+ Random generator = new Random();
+ int centroid_id = generator.nextInt(data.rows());
+
+ for(int i = 0; i < nClusters; i++){
+
+ System.out.println("Centroid selection iteration " + i + "
Centroid id " + centroid_id);
+
+ //update centroid assinged array
+ centroid_assigned[centroid_id] = 1;
+
+ DoubleMatrix1D centroid = data.viewRow(centroid_id);
+
+ //copy newly selected centroid from data matrix
+ for(int j = 0; j < centroid.size(); j++)
+ cdata.set(centroid_count,j,centroid.get(j));
+
+ centroid_count++;
+
+ if(centroid_count == nClusters)
+ break;
+
+ while(centroid_assigned[centroid_id] == 1){
+ centroid_id = generator.nextInt(data.rows());
+ }
+
+ }
+ }
//Assign centroids to rows with maximal orthogonality
private static void selectCentroidsOrthogonally(int nClusters,
DoubleMatrix2D data, DoubleMatrix2D cdata){
@@ -229,16 +278,19 @@
//centroid assigned element == 1 if centroid assigned, zero
otherwise
int[] centroid_assigned = new int[data.rows()];
- for(int i = 0; i < nClusters; i++){System.out.println(i);
centroid_assigned[i] = 0;}
+ for(int i = 0; i < nClusters; i++){centroid_assigned[i] = 0;}
+ //array of cosine sums to centroids allreay chosen
+ double[] cosines = new double[data.rows()];
+ for(int i = 0; i < data.rows(); i++){cosines[i] = 0;}
+
//randomly select first centroid
- //int centroid_id =
binomial(nClusters-1,1.0/(double)(nClusters-1));
Random generator = new Random();
- int centroid_id = generator.nextInt(nClusters);
+ int centroid_id = generator.nextInt(data.rows());
for(int i = 0; i < nClusters; i++){
- System.out.println("Centroid selection iteration " + i);
+ System.out.println("Centroid selection iteration " + i + "
Centroid id " + centroid_id);
//update centroid assinged array
centroid_assigned[centroid_id] = 1;
@@ -254,22 +306,22 @@
if(centroid_count == nClusters)
break;
- int min_cosine = 10000;
+ double min_cosine = 10000;
int new_centroid_id = -1;
- //loop through rows of data matrix, seach for next centroid,
which will minimize the cosine angle (dot product) with current centroid
+ //loop through rows of data matrix, seach for next centroid,
which will minimize the cosine angle (dot product) with all current centroids
for(int j = 0; j < data.rows(); j++){
//ignore centroids that allready have been set
if(centroid_assigned[j] == 1)
continue;
- double cosine = centroid.zDotProduct(data.viewRow(j));
+ cosines[j] += centroid.zDotProduct(data.viewRow(j));
- //if new cosine value < min cosine value, update min_cosine
and new_centroid_id to reflect taht
- if(min_cosine > cosine){
+ //if new cosine sum value < min cosine value, update
min_cosine and new_centroid_id to reflect that
+ if(min_cosine > cosines[j]){
- cosine = min_cosine;
+ min_cosine = cosines[j];
new_centroid_id = j;
}
}
@@ -285,23 +337,22 @@
private static void getClusterMeans(int nClusters, DoubleMatrix2D data,
DoubleMatrix2D cdata, int[] clusterid) {
- double[][]cmask = new double[nClusters][nClusters];
+ double[][]cmask = new double[nClusters][cdata.rows()];
for (int i = 0; i < nClusters; i++) {
- for (int j = 0; j < data.columns(); j++) {
- //cdata.setValue(i, j, null);
+ for (int j = 0; j < cdata.rows(); j++) {
+ cdata.set(j, i, 0);
cmask[i][j] = 0.0;
}
}
for (int k = 0; k < data.rows(); k++) {
- //cetroid id
+ //centroid id
int i = clusterid[k];
-
for (int j = 0; j < data.columns(); j++) {
@@ -318,7 +369,7 @@
}
}
for (int i = 0; i < nClusters; i++) {
- for (int j = 0; j < data.columns(); j++) {
+ for (int j = 0; j < cdata.rows(); j++) {
if (cmask[i][j] > 0.0) {
double cData = cdata.get(i,j) / cmask[i][j];
cdata.set(i,j,cData);
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/RunSCPS.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/RunSCPS.java
2011-02-01 00:11:03 UTC (rev 23985)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/RunSCPS.java
2011-02-01 01:40:10 UTC (rev 23986)
@@ -91,7 +91,7 @@
private int kvalue;
private int rnumber;
private DoubleMatrix2D LMat;
-
+ private int numComponents;
private HashMap<Integer, NodeCluster> clusterMap;
@@ -131,20 +131,32 @@
monitor.setStatus("Formatting Matrix Data");
DoubleMatrix2D sMat = getSMat(this.distanceMatrix);
DoubleMatrix2D LMat = getLMat(sMat);
+
+ monitor.setStatus("Calculating Eigenvalues");
+ EigenvalueDecomposition decomp = new EigenvalueDecomposition(LMat);
+ DoubleMatrix2D eigenVect = decomp.getV();
+ DoubleMatrix1D eigenVal = decomp.getRealEigenvalues();
+
monitor.setStatus("Calculating K value");
if(this.kvalue > -1)
k = this.kvalue;
else
- k = getK(sMat);
+ k = getK(eigenVal,.3);
System.out.println("K is " + k);
- monitor.setStatus("Calculating Eigenvalues");
- DoubleMatrix2D uMat = getUMat(LMat,k);
+ if(numComponents > k){
+
+ doComponentClustering();
+ return new ArrayList(this.clusterMap.values());
+ }
+
+ monitor.setStatus("Creating uMatrix for kMeans");
+ DoubleMatrix2D uMat = getUMat(eigenVect,k);
monitor.setStatus("Running kmeans clustering");
- doKMeansClustering(uMat);
+ doKMeansClustering(uMat,sMat);
//clusterMap calculated in getSMat and doKMeansClustering steps.
Simply return the results
return new ArrayList(this.clusterMap.values());
@@ -196,23 +208,26 @@
DoubleArrayList valueList = new DoubleArrayList();
//Iterate through connected components
- Iterator it = cMap.entrySet().iterator();
-
+ Iterator it = cMap.values().iterator();
+
+ int component_size_sum = 0;
+
while(it.hasNext()){
- Map.Entry entry = (Map.Entry)it.next();
- List<CyNode> component = (List<CyNode>)entry.getValue();
+
+ List<CyNode> component = (List<CyNode>)it.next();
+ numComponents += 1;
//Size <= 5. Automatically create cluster and increment
clusterCount.
if(component.size() <= 5){
NodeCluster iCluster = new NodeCluster(component);
+ iCluster.setClusterNumber(this.clusterCount);
//iCluster.add(component,this.clusterCount);
this.clusterMap.put(new Integer(clusterCount),iCluster);
- System.out.println("Component Size " + component.size() + "
ClusterCount " + clusterCount);
this.clusterCount++;
-
+
}
@@ -220,16 +235,19 @@
//iterate through components and assign them index mappings in
new uMatrix
else{
+ component_size_sum += component.size();
+
+ System.out.println("Normal Component size " +
component.size() + " Total Sum " + component_size_sum);
+
for(int i = 0; i < component.size(); i++){
CyNode n = component.get(i);
-
-
-
+ int node_id = this.nodes.indexOf(n);
+
//set mapping of new matrix index to old index
- setMap(this.nodes.indexOf(n), sMat_rows);
-
+ setMap(node_id, sMat_rows);
sMat_rows++;
+
}
}
@@ -255,8 +273,7 @@
int new_column_id = getMap_new(column_id);
double value = valueList.get(i);
- if(new_row_id == 37)
- System.out.println("!!! 37 ROW::" + row_id + " Column:" +
column_id + " Value:"+value);
+
//Set symmetrically the values in new matrix
if(new_row_id > -1 && new_column_id > -1)
@@ -320,7 +337,7 @@
}
- //D is Diagnol Matrix formed of vertex degree Dii = Sum Columns j over
row Si
+ //D is Diagonal Matrix formed of vertex degree Dii = Sum Columns j over
row Si
public DoubleMatrix2D getDMat(DoubleMatrix2D sMat){
@@ -330,9 +347,6 @@
//set the Diagnal (i,i) to sum of columns over row i
dMat.set(i,i, sMat.viewRow(i).zSum());
-
- if(dMat.get(i,i) <= 5)
- System.out.println("DMat row "+ i + " value " +
dMat.get(i,i));
}
@@ -343,28 +357,25 @@
//Get K using eigenvetors of S Matrix
- public int getK(DoubleMatrix2D sMat){
+ public int getK(DoubleMatrix1D eigenVal, double minLambda){
double prevLamb;
double nextLamb;
int k;
-
- EigenvalueDecomposition decomp = new
EigenvalueDecomposition(sMat);
-
- //eigenvectors
- DoubleMatrix2D eigenVect = decomp.getV();
-
- //eigenvalues
- DoubleMatrix1D eigenVal = decomp.getRealEigenvalues();
-
+
+
//set K to smallest integer such that LambdaK/LambdaK+1 >
epsilon
- prevLamb = eigenVal.get(0);
-
+ prevLamb = round(eigenVal.get(eigenVal.size()-1));
+
for(k = 1; k < eigenVal.size(); k++){
- nextLamb = eigenVal.get(k);
+
+ nextLamb = round(eigenVal.get(eigenVal.size()-k-1));
+
+ System.out.println("k " + k + " PrevLamb " + prevLamb + "
nextLamb " + nextLamb + " prevLamb/nextLamb " + prevLamb/nextLamb);
- System.out.println("k " + k + " PrevLamb " + prevLamb + "
nextLamb " + nextLamb + "prevLamb/nextLamb " + prevLamb/nextLamb);
+ if(nextLamb < minLambda)
+ break;
if(prevLamb/nextLamb > this.epsilon)
break;
@@ -376,22 +387,19 @@
}
//U constructed from top K Eigenvectors of L. After construction, each
row of U is normalized to unit length.
- public DoubleMatrix2D getUMat(DoubleMatrix2D LMat, int k){
+ public DoubleMatrix2D getUMat(DoubleMatrix2D eigenVect, int k){
DoubleMatrix2D uMat;
IntArrayList indexList = new IntArrayList();
DoubleArrayList valueList = new DoubleArrayList();
- EigenvalueDecomposition decomp = new
EigenvalueDecomposition(LMat);
-
- //eigenvectors
- DoubleMatrix2D eigenVect = decomp.getV();
-
- //construct matrix U from first K eigenvectors
- uMat = eigenVect.viewPart(0,0,eigenVect.rows(),k);
+
+
+ //construct matrix U from first K eigenvectors (ordered in
ascending value by eigenvalue in eigenVect so start with the k-to-last column)
+ uMat =
eigenVect.viewPart(0,eigenVect.columns()-k,eigenVect.rows(),k);
-
+
//Normalize each row of matrix U to have unit length
for(int i = 0; i < uMat.columns(); i++){
@@ -415,7 +423,7 @@
return uMat;
}
- public void doKMeansClustering(DoubleMatrix2D uMat){
+ public void doKMeansClustering(DoubleMatrix2D uMat,DoubleMatrix2D
sMat){
int k = uMat.columns();
@@ -424,6 +432,9 @@
//do kmeans clustering
KCluster.kmeans(k,rnumber,uMat,clusters);
+ //redistribute cluster results
+ clusters = redistributeMaxCluster(clusters,sMat,k);
+
//Loop through clustering results, getting the clusters by order
for(int cluster_id = 0; cluster_id < k; cluster_id++){
@@ -439,9 +450,11 @@
}
iCluster = new NodeCluster(node_list);
+ iCluster.setClusterNumber(this.clusterCount);
+
this.clusterMap.put(new Integer(clusterCount),iCluster);
- System.out.println("clusterCount " + clusterCount);
+ System.out.println("Clustercount " + this.clusterCount + "
cluster_id " + cluster_id + " node_list_length " + node_list.size());
this.clusterCount++;
}
@@ -450,7 +463,174 @@
}
+ //Takes largest cluster obtained by Kmeans and redisributes some of
its elements across the other clusters via Kurucz Algorithm
+ public int[]redistributeMaxCluster(int[] clusters, DoubleMatrix2D
sMat, int k){
+ int maxClusterID = -1;
+ int maxClusterSize = -1;
+ int maxClusterConnection = -1;
+ double maxClusterConnectionSize = -1;
+
+ IntArrayList indexList = new IntArrayList();
+ DoubleArrayList valueList = new DoubleArrayList();
+
+ //Array of cluster sizes
+ int[] clusterSizeArray = new int[k];
+
+ //array of redistributed clusters
+ int[] redistribClusters = new int[clusters.length];
+
+ //array summing edge connections from node in largest cluster to
all other clusters
+ double[] clusterConnectionCount = new double[k];
+
+ for(int i = 0; i < clusterSizeArray.length; i++)
+ clusterSizeArray[i] = 0;
+
+
+ //compute size of each cluster
+ for(int i = 0; i < clusters.length; i++){
+
+ int clusterID = clusters[i];
+ clusterSizeArray[clusterID] += 1;
+ }
+
+ //find max cluster size and max cluster id
+ for(int i = 0; i < clusterSizeArray.length; i++){
+
+ int clusterSize = clusterSizeArray[i];
+
+ if(clusterSize > maxClusterSize){
+
+ maxClusterSize = clusterSize;
+ maxClusterID = i;
+ }
+ }
+
+ //run loop until no changes observed in cluster transfers
+ while(true) {
+
+ int transfer_count = 0;
+
+ //loop through SMat redistribute elements in largest cluster
based on edge weight connectivity
+ for(int i = 0; i < clusters.length; i++){
+
+ //node belongs to one of smaller clusters. Merely add
existing cluster value to redistributed cluster array
+ if(clusters[i] != maxClusterID){
+
+ redistribClusters[i] = clusters[i];
+ continue;
+ }
+
+ //index corresponds to element in main cluster. Count the
cluster connections from node
+ for(int j = 0; j < k; j++)
+ clusterConnectionCount[j] = 0;
+
+ maxClusterConnection = -1;
+ maxClusterConnectionSize = -1;
+
+
+ DoubleMatrix1D row = sMat.viewRow(i);
+ row.getNonZeros(indexList, valueList);
+
+ //loop through existing edges for node and record how many
times the connection bridges each cluster
+ for(int j = 0; j < indexList.size(); j++){
+
+ int connectingNode = indexList.get(j);
+ int connectingNodeCluster = clusters[connectingNode];
+ clusterConnectionCount[connectingNodeCluster] +=
valueList.get(j);
+ }
+
+ //loop through cluster connection counts and find cluster
with greatest number of avg edge connections
+ for(int j = 0; j<k; j++){
+
+ double avgConnectionSize = clusterConnectionCount[j] /
(double)(clusterSizeArray[j] + 1);
+
+ if(maxClusterConnectionSize < avgConnectionSize){
+
+ maxClusterConnectionSize = avgConnectionSize;
+ maxClusterConnection = j;
+ }
+ }
+
+ //update redistributed cluster array to reflect
maxClusterConnection
+ redistribClusters[i] = maxClusterConnection;
+
+ if(clusters[i] != redistribClusters[i]){
+
+ transfer_count++;
+ System.out.println("Node " + i + " moved from " +
clusters[i] + " to " + redistribClusters[i]);
+ }
+
+ }
+
+
+ //transfer has occured, update clusters to equal redistrib
clusters
+ if(transfer_count > 0){
+
+ for(int i = 0; i < clusters.length; i++)
+ if(clusters[i] != redistribClusters[i]){
+
+ int clusterID = redistribClusters[i];
+ clusterSizeArray[maxClusterID]--;
+ clusterSizeArray[clusterID]++;
+ clusters[i] = redistribClusters[i];
+
+ }
+
+ System.out.println("Transfer Count " + transfer_count + "
MaxClusterSize " + clusterSizeArray[maxClusterID]);
+
+ }
+
+ //No transfer occured. Break out of loop
+ else
+ break;
+
+ }
+
+ return redistribClusters;
+
+ }
+
+ //Store all components length greater then 5 in clusters, if number
components is greater then K
+ public void doComponentClustering(){
+
+
+ //Connected Componets
+ Map<Integer, List<CyNode>> cMap =
distanceMatrix.findConnectedComponents();
+
+
+
+ //Iterate through connected components
+ Iterator it = cMap.values().iterator();
+
+ int component_size_sum = 0;
+
+ while(it.hasNext()){
+
+
+ List<CyNode> component = (List<CyNode>)it.next();
+
+ if(component.size() > 5){
+
+ NodeCluster iCluster = new NodeCluster(component);
+ iCluster.setClusterNumber(this.clusterCount);
+ this.clusterMap.put(new Integer(clusterCount),iCluster);
+ this.clusterCount++;
+
+
+ }
+ }
+ }
+
+ //round double to two decimal points
+ public double round(double d){
+
+ int precision = 100;
+ return Math.floor(d*precision + .5)/precision;
+ }
+
+
+
/**
* Normalize normalizes a cell in the matrix
*/
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/SCPSCluster.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/SCPSCluster.java
2011-02-01 00:11:03 UTC (rev 23985)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/SCPS/SCPSCluster.java
2011-02-01 01:40:10 UTC (rev 23986)
@@ -67,8 +67,8 @@
public class SCPSCluster extends AbstractNetworkClusterer {
- double epsilon = 1.1;
- int rNumber = 8;
+ double epsilon = 1.02;
+ int rNumber = 50;
int knumber = -1;
EdgeAttributeHandler edgeAttributeHandler = null;
@@ -111,14 +111,14 @@
// Lambda Parameter
clusterProperties.add(new Tunable("epsilon",
"epsilon Parameter",
- Tunable.DOUBLE, new
Double(1.1),
+ Tunable.DOUBLE, new
Double(1.02),
(Object)null, (Object)null,
0));
// Number of iterations
clusterProperties.add(new Tunable("rNumber",
"Number of iterations",
- Tunable.INTEGER, new
Integer(10),
+ Tunable.INTEGER, new
Integer(50),
(Object)null, (Object)null,
0));
@@ -171,6 +171,7 @@
CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
DistanceMatrix matrix = edgeAttributeHandler.getMatrix();
+
//Cluster the nodes
runSCPS = new RunSCPS(matrix, epsilon, knumber, rNumber,
logger);
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/AutoSOMECluster.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/AutoSOMECluster.java
2011-02-01 00:11:03 UTC (rev 23985)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/AutoSOMECluster.java
2011-02-01 01:40:10 UTC (rev 23986)
@@ -494,21 +494,21 @@
//Cluster the nodes
runAutoSOME = new RunAutoSOME(dataAttribute,
attributeArray,settings,logger);
- runAutoSOME.setIgnoreMissing(ignoreMissing);
- runAutoSOME.setSelectedOnly(selectedNodes);
+ runAutoSOME.setIgnoreMissing(ignoreMissing);
+ runAutoSOME.setSelectedOnly(selectedNodes);
runAutoSOME.setDebug(debug);
- logger.info("Running AutoSOME"+((settings.distMatrix) ? "
Fuzzy Clustering" : ""));
+ logger.info("Running AutoSOME"+((settings.distMatrix) ? " Fuzzy
Clustering" : ""));
- nodeCluster = runAutoSOME.run(monitor);
+ nodeCluster = runAutoSOME.run(monitor);
- if(nodeCluster==null) {
- monitor.setStatus("Clustering failed!");
- return;
- }
+ if(nodeCluster==null) {
+ monitor.setStatus("Clustering failed!");
+ return;
+ }
- if(nodeCluster.size()>0) finishedClustering=true;
+ if(nodeCluster.size()>0) finishedClustering=true;
logger.info("Removing groups");
@@ -517,43 +517,40 @@
// Remove any leftover groups from previous runs
removeGroups(netAttributes, networkID);
- nodeAttributes.deleteAttribute(clusterAttributeName);
+ nodeAttributes.deleteAttribute(clusterAttributeName);
logger.info("Creating groups");
monitor.setStatus("Creating groups");
- if(settings.distMatrix) edges=runAutoSOME.getEdges(MAXEDGES);
+ if(settings.distMatrix) edges=runAutoSOME.getEdges(MAXEDGES);
- attrList = runAutoSOME.attrList;
- attrOrderList = runAutoSOME.attrOrderList;
- nodeOrderList = runAutoSOME.nodeOrderList;
+ attrList = runAutoSOME.attrList;
+ attrOrderList = runAutoSOME.attrOrderList;
+ nodeOrderList = runAutoSOME.nodeOrderList;
- List<List<CyNode>> nodeClusters;
+ List<List<CyNode>> nodeClusters;
- if(!settings.distMatrix){
+ if(!settings.distMatrix) {
- nodeClusters =
- createGroups(netAttributes, networkID, nodeAttributes,
clusters);
- ClusterResults results = new ClusterResults(network,
nodeClusters);
- monitor.setStatus("Done. AutoSOME results:\n"+results);
- } else {
- nodeClusters = new ArrayList<List<CyNode>>();
- /*
+ nodeClusters =
+ createGroups(netAttributes, networkID,
nodeAttributes, nodeCluster);
+ ClusterResults results = new ClusterResults(network,
nodeClusters);
+ monitor.setStatus("Done. AutoSOME results:\n"+results);
+ } else {
+ nodeClusters = new ArrayList<List<CyNode>>();
+ /*
+ for (NodeCluster cluster: clusters) {
+ List<CyNode>nodeList = new ArrayList();
- for (NodeCluster cluster: clusters) {
- List<CyNode>nodeList = new ArrayList();
+ for (CyNode node: cluster) {
+ nodeList.add(node);
+ }
+ nodeClusters.add(nodeList);
+ }
+ */
+ }
+ monitor.setStatus("Done. AutoSOME
results:\n"+nodeCluster.size()+" clusters found.");
- for (CyNode node: cluster) {
- nodeList.add(node);
- }
- nodeClusters.add(nodeList);
- }
- */
- }
- monitor.setStatus("Done. AutoSOME
results:\n"+clusters.size()+" clusters found.");
-
-
-
// Tell any listeners that we're done
pcs.firePropertyChange(ClusterAlgorithm.CLUSTER_COMPUTED, null,
this);
}
@@ -562,7 +559,7 @@
runAutoSOME.halt();
}
- private void getAttributesList(List<String>attributeList, CyAttributes
attributes,
+ private void getAttributesList(List<String>attributeList, CyAttributes
attributes,
String prefix) {
String[] names = attributes.getAttributeNames();
for (int i = 0; i < names.length; i++) {
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/cluststruct/clusterValidity.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/cluststruct/clusterValidity.java
2011-02-01 00:11:03 UTC (rev 23985)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/cluststruct/clusterValidity.java
2011-02-01 01:40:10 UTC (rev 23986)
@@ -22,10 +22,10 @@
ArrayList[] orig;
ArrayList[] clusters;
- ArrayList[] clustData;
+ List<Integer>[] clustData;
Settings s;
- public clusterValidity(ArrayList[] orig, ArrayList[] clusters,ArrayList[]
clustData, Settings s){
+ public clusterValidity(ArrayList[] orig, ArrayList[]
clusters,List<Integer>[] clustData, Settings s){
this.orig = orig;
this.clusters = clusters;
this.clustData = clustData;
@@ -39,7 +39,7 @@
this.s = s;
for(int i = 0; i < c.length; i++){
clusters[i] = new ArrayList();
- clustData[i] = new ArrayList();
+ clustData[i] = new ArrayList<Integer>();
clustData[i] = c[i].ids;
for(int j = 0; j < c[i].ids.size(); j++){
double[] d = new double[1];
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.