Author: scooter
Date: 2008-09-17 15:03:50 -0700 (Wed, 17 Sep 2008)
New Revision: 14923

Modified:
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/HierarchicalCluster.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KMeansCluster.java
Log:
Add some error checking


Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/HierarchicalCluster.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/HierarchicalCluster.java
 2008-09-17 21:47:01 UTC (rev 14922)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/HierarchicalCluster.java
 2008-09-17 22:03:50 UTC (rev 14923)
@@ -176,16 +176,29 @@
                if (debug)
                        logger.debug("Performing hierarchical cluster with 
method: "+clusterMethod+" using "+distanceMetric+" and attributes: 
"+dataAttributes);
                if (dataAttributes == null || dataAttributes.length() == 0) {
-                       logger.error("Must have an attribute list to use for 
cluster weighting");
-                       if (monitor != null)
+                       if (monitor != null) {
+                               logger.warning("Must have an attribute list to 
use for cluster weighting");
                                monitor.setException(null, "Error: no attribute 
list selected");
+                       } else
+                               logger.error("Must have an attribute list to 
use for cluster weighting");
                        return;
                }
+
                // Get our attributes we're going to use for the cluster
                String attributeArray[] = getAttributeArray(dataAttributes);
                // To make debugging easier, sort the attribute array
                Arrays.sort(attributeArray);
 
+               // If we've got node attributes, there must be at least two
+               if (attributeArray.length == 1 && 
attributeArray[0].startsWith("node.")) {
+                       if (monitor != null) {
+                               logger.warning("Must have at least two node 
attributes for cluster weighting");
+                               monitor.setException(null, "Error: not enough 
attributes selected");
+                       } else
+                               logger.error("Must have at least two node 
attributes for cluster weighting");
+                       return;
+               }
+
                // Start by cleaning up and resetting
                EisenCluster.resetAttributes();
 

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KMeansCluster.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KMeansCluster.java
     2008-09-17 21:47:01 UTC (rev 14922)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KMeansCluster.java
     2008-09-17 22:03:50 UTC (rev 14923)
@@ -185,9 +185,11 @@
                        logger.debug("Performing k-means cluster with 
k="+kNumber+" using "+distanceMetric+" and attributes: "+dataAttributes);
 
                if (dataAttributes == null || dataAttributes.length() == 0) {
-                       logger.error("Must have an attribute list to use for 
cluster weighting");
-                       if (monitor != null)
+                       if (monitor != null) {
                                monitor.setException(null, "Error: no attribute 
list selected");
+                               logger.warning("Must have an attribute list to 
use for cluster weighting");
+                       } else
+                               logger.error("Must have an attribute list to 
use for cluster weighting");
                        return;
                }
 


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