Author: scooter
Date: 2011-04-11 15:28:50 -0700 (Mon, 11 Apr 2011)
New Revision: 24742

Modified:
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/EdgeAttributeHandler.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/AutoSOMECluster.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/HierarchicalCluster.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KMeansCluster.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/commands/VizCommandHandler.java
   csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/ClusterViz.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/HeatMapView.java
   csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/KnnView.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/NestedNetworkView.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/NewNetworkView.java
   csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/TreeView.java
Log:
Fix stupid bug introduced right before release.


Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/EdgeAttributeHandler.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/EdgeAttributeHandler.java
     2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/EdgeAttributeHandler.java
     2011-04-11 22:28:50 UTC (rev 24742)
@@ -191,8 +191,6 @@
                        adjustLoops = ((Boolean) t.getValue()).booleanValue();
 
                t = clusterProperties.get("attribute");
-               attributeArray = getAllAttributes();
-               t.setLowerBound((Object)attributeArray);
                if ((t != null) && (t.valueChanged() || force)) {
                        if (attributeArray.length == 1) {
                                dataAttribute = attributeArray[0];

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
   2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
   2011-04-11 22:28:50 UTC (rev 24742)
@@ -200,9 +200,11 @@
                                    clusteringThresh, maxResidual, maxThreads, 
logger);
 
                runMCL.setDebug(debug);
+               if (canceled) return;
 
                // results = runMCL.run(monitor);
                List<NodeCluster> clusters = runMCL.run(monitor);
+               if (clusters == null) return; // Canceled?
 
                logger.info("Removing groups");
 
@@ -223,6 +225,7 @@
        }
 
        public void halt() {
+               canceled = true;
                runMCL.halt();
        }
 }

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/AutoSOMECluster.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/AutoSOMECluster.java
 2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/autosome/AutoSOMECluster.java
 2011-04-11 22:28:50 UTC (rev 24742)
@@ -455,8 +455,10 @@
 
 
                 t = clusterProperties.get("attributeList");
-                attributeArray = getAllAttributes();
-                t.setLowerBound(attributeArray);
+                if (force) {
+                        attributeArray = getAllAttributes();
+                        t.setLowerBound(attributeArray);
+                }
                 if ((t != null) && (t.valueChanged() || force)) {
                         dataAttribute = (String) t.getValue();
                 }

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/HierarchicalCluster.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/HierarchicalCluster.java
 2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/HierarchicalCluster.java
 2011-04-11 22:28:50 UTC (rev 24742)
@@ -202,8 +202,6 @@
                        distanceMetric = distanceTypes[((Integer) 
t.getValue()).intValue()];
 
                t = clusterProperties.get("clusterAttributes");
-               attributeArray = EisenCluster.getAllAttributes();
-               t.setLowerBound((Object)attributeArray);
                if ((t != null) && (t.valueChanged() || force))
                        clusterAttributes = ((Boolean) 
t.getValue()).booleanValue();
 

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KMeansCluster.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KMeansCluster.java
     2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KMeansCluster.java
     2011-04-11 22:28:50 UTC (rev 24742)
@@ -202,8 +202,6 @@
                        distanceMetric = distanceTypes[((Integer) 
t.getValue()).intValue()];
 
                t = clusterProperties.get("clusterAttributes");
-               attributeArray = EisenCluster.getAllAttributes();
-               t.setLowerBound(attributeArray);
                if ((t != null) && (t.valueChanged() || force))
                        clusterAttributes = ((Boolean) 
t.getValue()).booleanValue();
 

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/commands/VizCommandHandler.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/commands/VizCommandHandler.java
  2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/commands/VizCommandHandler.java
  2011-04-11 22:28:50 UTC (rev 24742)
@@ -82,6 +82,7 @@
                        if (command.equalsIgnoreCase(vizname)) {
                                // Get the algorithm
                                ClusterViz viz = vizMap.get(vizname);
+                               viz.initializeProperties();
                                ClusterProperties props = viz.getSettings();
        
                                viz.updateSettings(true);

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/ClusterViz.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/ClusterViz.java   
    2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/ClusterViz.java   
    2011-04-11 22:28:50 UTC (rev 24742)
@@ -92,6 +92,13 @@
        public ClusterProperties getSettings();
 
        /**
+        * This method is used to re-initialize the properties for an 
algorithm.  This
+        * might be used, for example, by an external command, or when a new 
network
+        * is loaded.
+        */
+       public void initializeProperties();
+
+       /**
         * This is the main interface to trigger a ui to display
         *
         * @param monitor a TaskMonitor

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/HeatMapView.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/HeatMapView.java  
    2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/HeatMapView.java  
    2011-04-11 22:28:50 UTC (rev 24742)
@@ -312,8 +312,6 @@
                clusterProperties.updateValues();
 
                Tunable t = clusterProperties.get("attributeList");
-               attributeArray = getAllAttributes();
-               t.setLowerBound(attributeArray);
                if ((t != null) && (t.valueChanged() || force)) {
                        dataAttributes = (String) t.getValue();
                }

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/KnnView.java
===================================================================
--- csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/KnnView.java  
2011-04-11 20:22:31 UTC (rev 24741)
+++ csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/KnnView.java  
2011-04-11 22:28:50 UTC (rev 24742)
@@ -118,6 +118,8 @@
 
        public ClusterResults getResults() { return null; }
 
+       public void initializeProperties() {}
+
        public boolean isAvailable() {
                CyNetwork network = Cytoscape.getCurrentNetwork();
                CyAttributes networkAttributes = 
Cytoscape.getNetworkAttributes();

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/NestedNetworkView.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/NestedNetworkView.java
        2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/NestedNetworkView.java
        2011-04-11 22:28:50 UTC (rev 24742)
@@ -213,9 +213,6 @@
                clusterProperties.updateValues();
 
                Tunable t = clusterProperties.get("attribute");
-               // Make sure to update the tunable while we're at it...
-               attributeArray = getAllAttributes();
-               t.setLowerBound(attributeArray);
                if ((t != null) && (t.valueChanged() || force)) {
                        int val = ((Integer) t.getValue()).intValue();
                        clusterAttribute = attributeArray[val];

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/NewNetworkView.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/NewNetworkView.java
   2011-04-11 20:22:31 UTC (rev 24741)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/NewNetworkView.java
   2011-04-11 22:28:50 UTC (rev 24742)
@@ -211,9 +211,6 @@
                clusterProperties.updateValues();
 
                Tunable t = clusterProperties.get("attribute");
-               // Make sure to update the tunable while we're at it...
-               attributeArray = getAllAttributes();
-               t.setLowerBound(attributeArray);
                if ((t != null) && (t.valueChanged() || force)) {
                        int val = ((Integer) t.getValue()).intValue();
                        clusterAttribute = attributeArray[val];
@@ -270,22 +267,33 @@
                CyNetwork net = 
Cytoscape.createNetwork(currentNetwork.getTitle()+"--clustered",currentNetwork,false);
 
                // Create the cluster Map
-               HashMap<Integer, List<CyNode>> clusterMap = new HashMap();
+               HashMap<Object, List<CyNode>> clusterMap = new HashMap<Object, 
List<CyNode>>();
                for (CyNode node: (List<CyNode>)currentNetwork.nodesList()) {
                        // For each node -- see if it's in a cluster.  If so, 
add it to our map
                        if (nodeAttributes.hasAttribute(node.getIdentifier(), 
clusterAttribute)) {
-                               Integer cluster = 
nodeAttributes.getIntegerAttribute(node.getIdentifier(), clusterAttribute);
+                               Object cluster = 
nodeAttributes.getAttribute(node.getIdentifier(), clusterAttribute);
+                               switch 
(nodeAttributes.getType(clusterAttribute)) {
+                               case CyAttributes.TYPE_SIMPLE_LIST:
+                                       // As a convenience, take the first 
element of the list
+                                       List lObj = 
nodeAttributes.getListAttribute(node.getIdentifier(), clusterAttribute);
+                                       if (lObj != null && lObj.size() > 0)
+                                               cluster = lObj.get(0);
+                                       else
+                                               continue;
+                               }
                                if (!clusterMap.containsKey(cluster)) {
-                                       clusterMap.put(cluster, new 
ArrayList());
+                                       System.out.println("Creating new entry 
for: "+cluster.toString());
+                                       clusterMap.put(cluster, new 
ArrayList<CyNode>());
                                }
+                               System.out.println("Adding node "+node+" to 
"+cluster.toString());
                                clusterMap.get(cluster).add(node);
                                net.addNode(node);
                        }
                }
 
-               HashMap<CyEdge,CyEdge> edgeMap = new HashMap();
+               HashMap<CyEdge,CyEdge> edgeMap = new HashMap<CyEdge,CyEdge>();
 
-               for (Integer cluster: clusterMap.keySet()) {
+               for (Object cluster: clusterMap.keySet()) {
                        // Get the list of nodes
                        List<CyNode> nodeList = clusterMap.get(cluster); 
                        // Get the list of edges
@@ -386,7 +394,10 @@
                String[] names = attributes.getAttributeNames();
                for (int i = 0; i < names.length; i++) {
                        if (attributes.getType(names[i]) == 
CyAttributes.TYPE_FLOATING ||
-                           attributes.getType(names[i]) == 
CyAttributes.TYPE_INTEGER) {
+                           attributes.getType(names[i]) == 
CyAttributes.TYPE_INTEGER ||
+                           attributes.getType(names[i]) == 
CyAttributes.TYPE_BOOLEAN ||
+                           attributes.getType(names[i]) == 
CyAttributes.TYPE_STRING ||
+                           attributes.getType(names[i]) == 
CyAttributes.TYPE_SIMPLE_LIST) {
                                attributeList.add(prefix+names[i]);
                        }
                }

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/TreeView.java
===================================================================
--- csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/TreeView.java 
2011-04-11 20:22:31 UTC (rev 24741)
+++ csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/ui/TreeView.java 
2011-04-11 22:28:50 UTC (rev 24742)
@@ -148,6 +148,8 @@
 
        public void updateSettings() {}
 
+       public void initializeProperties() {}
+
        public void updateSettings(boolean force) {}
 
        public ClusterProperties getSettings() { return null; }

-- 
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.

Reply via email to