Author: scooter
Date: 2009-07-25 19:28:41 -0700 (Sat, 25 Jul 2009)
New Revision: 17575
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/RunMCL.java
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/EisenCluster.java
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KCluster.java
Log:
Fixed bug in edge cutoff handling
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
2009-07-25 00:17:08 UTC (rev 17574)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/MCLCluster.java
2009-07-26 02:28:41 UTC (rev 17575)
@@ -436,6 +436,9 @@
if (edgeCutOff != null)
runMCL.setEdgeCutOff(edgeCutOff);
+ if (takeNegLOG)
+ runMCL.setTakeNegLog(true);
+
runMCL.run(monitor);
// Tell any listeners that we're done
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/RunMCL.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/RunMCL.java
2009-07-25 00:17:08 UTC (rev 17574)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/MCL/RunMCL.java
2009-07-26 02:28:41 UTC (rev 17575)
@@ -64,7 +64,7 @@
this.number_iterations = num_iterations;
this.clusteringThresh = clusteringThresh;
this.maxResidual = maxResidual;
- this.takeNegLOG = takeNegLOG;
+ this.takeNegLOG = false;
this.logger = logger;
this.createNewNetwork = false;
this.selectedOnly = false;
@@ -84,6 +84,7 @@
public void setDirectedEdges() { directedEdges = true; }
public void setAdjustLoops() { adjustLoops = true; }
public void setEdgeCutOff(Double e) { edgeCutoff = e; }
+ public void setTakeNegLog(boolean t) { takeNegLOG = t; }
public void run(TaskMonitor monitor)
{
@@ -131,7 +132,7 @@
else
continue;
-
+
/*Take -LOG of edge weight (E-Value) if so specified*/
if(takeNegLOG)
if(edgeWeight != 0.0)
@@ -139,8 +140,9 @@
else
edgeWeight = 500; // Assume 1e-500 as a
reasonble upper bound
- if (edgeCutoff != null && edgeWeight <
edgeCutoff.doubleValue())
+ if (edgeCutoff != null && edgeWeight <
edgeCutoff.doubleValue()) {
continue;
+ }
if(edgeWeight < minEdgeWeight)
minEdgeWeight = edgeWeight;
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/EisenCluster.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/EisenCluster.java
2009-07-25 00:17:08 UTC (rev 17574)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/hierarchical/EisenCluster.java
2009-07-26 02:28:41 UTC (rev 17575)
@@ -77,6 +77,69 @@
boolean adjustDiagonals = false;
boolean zeroMissing = false;
+ public static void updateAttributes(Matrix matrix,
List<String>attrList,
+ String[] weightAttributes,
Integer[] order,
+ String cluster_type,
+ boolean adjustDiagonals, boolean
zeroMissing) {
+ // Update the network attribute "HierarchicalCluster" and make
it hidden
+ CyAttributes netAttr = Cytoscape.getNetworkAttributes();
+ String netID = Cytoscape.getCurrentNetwork().getIdentifier();
+ List<String>params = new ArrayList();
+
+ if (zeroMissing)
+ params.add("zeroMissing");
+
+ netAttr.setAttribute(netID, CLUSTER_TYPE_ATTRIBUTE,
cluster_type);
+
+ if (matrix.isTransposed()) {
+ netAttr.setListAttribute(netID, CLUSTER_ATTR_ATTRIBUTE,
attrList);
+ } else {
+ netAttr.setListAttribute(netID, CLUSTER_NODE_ATTRIBUTE,
attrList);
+ if (matrix.isSymmetrical()) {
+ netAttr.setListAttribute(netID,
CLUSTER_ATTR_ATTRIBUTE, attrList);
+ netAttr.setAttribute(netID,
CLUSTER_EDGE_ATTRIBUTE, weightAttributes[0]);
+ if (adjustDiagonals) {
+
params.add("diagonals="+matrix.getValue(0,0));
+ }
+ }
+ }
+ netAttr.setListAttribute(netID, CLUSTER_PARAMS_ATTRIBUTE,
params);
+
+ String[] rowArray = matrix.getRowLabels();
+ ArrayList<String> orderList = new ArrayList();
+
+ String[] columnArray = matrix.getColLabels();
+ ArrayList<String>columnList = new ArrayList(columnArray.length);
+
+ for (int i = 0; i < order.length; i++) {
+ orderList.add(rowArray[order[i]]);
+ if (matrix.isSymmetrical())
+ columnList.add(rowArray[order[i]]);
+ }
+
+ if (!matrix.isSymmetrical()) {
+ for (int col = 0; col < columnArray.length; col++) {
+ columnList.add(columnArray[col]);
+ }
+ }
+
+ if (matrix.isTransposed()) {
+ // We did an Array cluster -- output the calculated
array order
+ // and the actual node order
+ netAttr.setListAttribute(netID, ARRAY_ORDER_ATTRIBUTE,
orderList);
+
+ // Don't override the columnlist if a node order
already exists
+ if (!netAttr.hasAttribute(netID, NODE_ORDER_ATTRIBUTE))
+ netAttr.setListAttribute(netID,
NODE_ORDER_ATTRIBUTE, columnList);
+ } else {
+ netAttr.setListAttribute(netID, NODE_ORDER_ATTRIBUTE,
orderList);
+ // Don't override the columnlist if a node order
already exists
+ if (!netAttr.hasAttribute(netID, ARRAY_ORDER_ATTRIBUTE))
+ netAttr.setListAttribute(netID,
ARRAY_ORDER_ATTRIBUTE, columnList);
+ }
+
+ }
+
public EisenCluster(String weightAttributes[], DistanceMetric metric,
ClusterMethod clusterMethod, CyLogger log,
TaskMonitor monitor) {
this.logger = log;
@@ -199,7 +262,7 @@
// Now sort based on tree structure
Integer order[] = TreeSort(matrix, nodeList.length, nodeOrder,
nodeCounts, nodeList);
- updateAttributes(matrix, attrList, weightAttributes, order,
"hierarchical");
+ updateAttributes(matrix, attrList, weightAttributes, order,
"hierarchical", adjustDiagonals, zeroMissing);
// Finally, create the group hierarchy
// The root is the last entry in our nodeList
@@ -220,68 +283,6 @@
return "Complete";
}
- public void updateAttributes(Matrix matrix, List<String>attrList,
- String[] weightAttributes, Integer[] order,
- String cluster_type) {
- // Update the network attribute "HierarchicalCluster" and make
it hidden
- CyAttributes netAttr = Cytoscape.getNetworkAttributes();
- String netID = Cytoscape.getCurrentNetwork().getIdentifier();
- List<String>params = new ArrayList();
-
- if (zeroMissing)
- params.add("zeroMissing");
-
- netAttr.setAttribute(netID, CLUSTER_TYPE_ATTRIBUTE,
cluster_type);
-
- if (matrix.isTransposed()) {
- netAttr.setListAttribute(netID, CLUSTER_ATTR_ATTRIBUTE,
attrList);
- } else {
- netAttr.setListAttribute(netID, CLUSTER_NODE_ATTRIBUTE,
attrList);
- if (matrix.isSymmetrical()) {
- netAttr.setListAttribute(netID,
CLUSTER_ATTR_ATTRIBUTE, attrList);
- netAttr.setAttribute(netID,
CLUSTER_EDGE_ATTRIBUTE, weightAttributes[0]);
- if (adjustDiagonals) {
-
params.add("diagonals="+matrix.getValue(0,0));
- }
- }
- }
- netAttr.setListAttribute(netID, CLUSTER_PARAMS_ATTRIBUTE,
params);
-
- String[] rowArray = matrix.getRowLabels();
- ArrayList<String> orderList = new ArrayList();
-
- String[] columnArray = matrix.getColLabels();
- ArrayList<String>columnList = new ArrayList(columnArray.length);
-
- for (int i = 0; i < order.length; i++) {
- orderList.add(rowArray[order[i]]);
- if (matrix.isSymmetrical())
- columnList.add(rowArray[order[i]]);
- }
-
- if (!matrix.isSymmetrical()) {
- for (int col = 0; col < columnArray.length; col++) {
- columnList.add(columnArray[col]);
- }
- }
-
- if (matrix.isTransposed()) {
- // We did an Array cluster -- output the calculated
array order
- // and the actual node order
- netAttr.setListAttribute(netID, ARRAY_ORDER_ATTRIBUTE,
orderList);
-
- // Don't override the columnlist if a node order
already exists
- if (!netAttr.hasAttribute(netID, NODE_ORDER_ATTRIBUTE))
- netAttr.setListAttribute(netID,
NODE_ORDER_ATTRIBUTE, columnList);
- } else {
- netAttr.setListAttribute(netID, NODE_ORDER_ATTRIBUTE,
orderList);
- // Don't override the columnlist if a node order
already exists
- if (!netAttr.hasAttribute(netID, ARRAY_ORDER_ATTRIBUTE))
- netAttr.setListAttribute(netID,
ARRAY_ORDER_ATTRIBUTE, columnList);
- }
-
- }
-
public void resetAttributes() {
// Update the network attribute "HierarchicalCluster" and make
it hidden
CyAttributes netAttr = Cytoscape.getNetworkAttributes();
Modified:
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KCluster.java
===================================================================
---
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KCluster.java
2009-07-25 00:17:08 UTC (rev 17574)
+++
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/kmeans/KCluster.java
2009-07-26 02:28:41 UTC (rev 17575)
@@ -137,7 +137,7 @@
}
// Update the network attributes
- EisenCluster.updateAttributes(matrix, attrList,
weightAttributes, rowOrder, "kmeans");
+ EisenCluster.updateAttributes(matrix, attrList,
weightAttributes, rowOrder, "kmeans", false, false);
return "Complete";
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---