Author: scooter
Date: 2009-03-30 18:03:15 -0700 (Mon, 30 Mar 2009)
New Revision: 16363
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
Log:
Fix bug in MCL attributes not getting updated properly
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
2009-03-31 00:16:28 UTC (rev 16362)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
2009-03-31 01:03:15 UTC (rev 16363)
@@ -61,6 +61,7 @@
boolean createNewNetwork = false;
boolean selectedOnly = false;
double maxResidual = 0.001;
+ String[] attributeArray = new String[1];
String dataAttribute = null;
TaskMonitor monitor = null;
@@ -77,6 +78,11 @@
public String getName() {return "MCL cluster";};
public JPanel getSettingsPanel() {
+ // Everytime we ask for the panel, we want to update our
attributes
+ Tunable attributeTunable =
clusterProperties.get("attributeList");
+ attributeArray = getAllAttributes();
+ attributeTunable.setLowerBound((Object)attributeArray);
+
return clusterProperties.getTunablePanel();
}
@@ -130,12 +136,12 @@
"Source for array data",
Tunable.GROUP, new
Integer(1)));
-
// The attribute to use to get the weights
+ attributeArray = getAllAttributes();
clusterProperties.add(new Tunable("attributeList",
"Array sources",
- Tunable.EDGEATTRIBUTE, "",
- (Object)null, (Object)null,
Tunable.NUMERICATTRIBUTE));
+ Tunable.LIST, 0,
+ (Object)attributeArray,
(Object)null, 0));
@@ -181,10 +187,31 @@
t = clusterProperties.get("attributeList");
if ((t != null) && (t.valueChanged() || force)) {
- dataAttribute = (String) t.getValue();
+ dataAttribute = attributeArray[((Integer)
t.getValue()).intValue()];
}
}
+ private void getAttributesList(List<String>attributeList, CyAttributes
attributes) {
+ 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) {
+ attributeList.add(names[i]);
+ }
+ }
+ }
+
+ private String[] getAllAttributes() {
+ attributeArray = new String[1];
+ // Create the list by combining node and edge attributes into a
single list
+ List<String> attributeList = new ArrayList<String>();
+ getAttributesList(attributeList, Cytoscape.getEdgeAttributes());
+ String[] attrArray = attributeList.toArray(attributeArray);
+ if (attrArray.length > 1)
+ Arrays.sort(attrArray);
+ return attrArray;
+ }
+
public void doCluster(TaskMonitor monitor) {
this.monitor = monitor;
// Sanity check all of our settings
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---