Author: ruschein
Date: 2010-02-12 15:11:38 -0800 (Fri, 12 Feb 2010)
New Revision: 19331
Modified:
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/ModFinder/HCSearch2.java
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/NestedNetworkCreator.java
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/SearchTask.java
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/VisualStyleBuilder.java
Log:
Added a visual progress indicator.
Modified:
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/ModFinder/HCSearch2.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/ModFinder/HCSearch2.java
2010-02-12 22:43:56 UTC (rev 19330)
+++
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/ModFinder/HCSearch2.java
2010-02-12 23:11:38 UTC (rev 19331)
@@ -10,6 +10,8 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import cytoscape.task.TaskMonitor;
+
import org.idekerlab.ModFindPlugin.networks.SFEdge;
import org.idekerlab.ModFindPlugin.networks.SFNetwork;
import org.idekerlab.ModFindPlugin.networks.linkedNetworks.TypedLinkEdge;
@@ -23,15 +25,20 @@
public class HCSearch2 {
+ /**
+ * @param percentAllocated up to what point to advance the task
monitor progress bar
+ */
public static TypedLinkNetwork<TypedLinkNodeModule<String, BFEdge>,
BFEdge> search(
- SFNetwork pnet, SFNetwork gnet, HCScoringFunction
sfunc) {
+ SFNetwork pnet, SFNetwork gnet, HCScoringFunction sfunc, final
TaskMonitor taskMonitor,
+ final float percentAllocated)
+ {
// The scoring function needs to load several lookup matricies
for the
// network data.
System.gc();
MemoryReporter.reportMemoryUsage();
// Need to construct the ONetwork<HyperModule<String>,BFEdge>
object.
- System.out.println("1. Building merged network.");
+ taskMonitor.setStatus("1. Building merged network.");
TypedLinkNetwork<TypedLinkNodeModule<String, BFEdge>, BFEdge>
results = constructBaseNetwork(
pnet, gnet);
@@ -40,14 +47,14 @@
MemoryReporter.reportMemoryUsage();
// Get the first-pass scores
- System.out.println("2. Obtaining primary scores.");
+ taskMonitor.setStatus("2. Obtaining primary scores.");
computePrimaryScores(results, sfunc);
System.gc();
MemoryReporter.reportMemoryUsage();
// Merge best tree-pairs together
- System.out.println("3. Forming clusters...");
+ taskMonitor.setStatus("3. Forming clusters...");
// MemoryReporter.reportMemoryUsage();
@@ -59,6 +66,8 @@
System.gc();
int iter = 0;
+ final float INITIAL_NODE_COUNT = results.numNodes();
+ final float MAX_PERCENTAGE = 70.0f;
while (results.numEdges() > 0 && max > 0) {
if (iter % 1000 == 0) {
System.gc();
@@ -98,8 +107,6 @@
if (max <= 0)
break;
- // System.out.println(best+",
c:"+best.value().complexMerge()+" + l:"+best.value().linkMerge()+" =
"+best.value().global());
-
// Merge the best pair
TypedLinkNode<TypedLinkNodeModule<String, BFEdge>,
BFEdge> mergedNode = mergeNodes(
results, best.source(), best.target(),
sfunc);
@@ -141,20 +148,23 @@
DoubleVector csizes = new
DoubleVector(results.numNodes());
- Set<TypedLinkNodeModule<String, BFEdge>> allc =
results
- .getNodeValues();
+ Set<TypedLinkNodeModule<String, BFEdge>> allc =
results.getNodeValues();
for (TypedLinkNodeModule<String, BFEdge> m :
allc)
csizes.add(m.size());
-
- System.out.println("Number of clusters: " +
results.numNodes()
- + ", Largest cluster size: " +
csizes.max(false));
+ final int percentCompleted =
+ Math.round((INITIAL_NODE_COUNT -
results.numNodes())
+ * percentAllocated /
INITIAL_NODE_COUNT);
+
taskMonitor.setPercentCompleted(percentCompleted);
+ taskMonitor.setStatus("3. Forming clusters (#
of clusters: "
+ + results.numNodes() + ",
largest cluster size: "
+ + csizes.max(false) +
")");
}
iter++;
}
- // global_scores.plot();
+ taskMonitor.setPercentCompleted(Math.round(percentAllocated));
System.out.println("Best score: " + global_scores.max(true));
System.out.println("Best score index: " + global_scores.maxI());
Modified:
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/NestedNetworkCreator.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/NestedNetworkCreator.java
2010-02-12 22:43:56 UTC (rev 19330)
+++
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/NestedNetworkCreator.java
2010-02-12 23:11:38 UTC (rev 19331)
@@ -20,6 +20,7 @@
import cytoscape.data.CyAttributes;
import cytoscape.data.Semantics;
import cytoscape.layout.CyLayouts;
+import cytoscape.task.TaskMonitor;
import cytoscape.util.PropUtil;
import cytoscape.view.CyNetworkView;
import cytoscape.visual.VisualStyle;
@@ -95,12 +96,15 @@
* a representation of the "overview" network
* @param originalNetwork
* the network that the overview network was generated from
+ * @param taskMonitor progress indicator floating dialog
+ * @param remainingPercentage 100 - this is where to start with the
percent-completed progress bar
*/
NestedNetworkCreator(
final TypedLinkNetwork<TypedLinkNodeModule<String, BFEdge>,
BFEdge> networkOfModules,
final CyNetwork originalNetwork,
final TypedLinkNetwork<String, Float> physicalNetwork,
- final TypedLinkNetwork<String, Float> geneticNetwork, final
double cutoff)
+ final TypedLinkNetwork<String, Float> geneticNetwork, final
double cutoff,
+ final TaskMonitor taskMonitor, final float remainingPercentage)
{
moduleToCyNodeMap = new HashMap<TypedLinkNodeModule<String,
BFEdge>, CyNode>();
@@ -115,6 +119,7 @@
final CyAttributes nodeAttribs = Cytoscape.getNodeAttributes();
final CyAttributes edgeAttribs = Cytoscape.getEdgeAttributes();
+ taskMonitor.setStatus("4. Generating networks");
int nodeIndex = 1;
double maxScore = Double.NEGATIVE_INFINITY;
maxSize = 0;
@@ -193,8 +198,12 @@
overviewNetwork.setSelectedEdgeState(selectedEdges, true);
overviewNetwork.setSelectedNodeState(selectedNodes, true);
+ taskMonitor.setStatus("5. Generating network views");
int networkViewCount = 0;
NetworkAndScore network;
+ final float percentIncrement =
+ remainingPercentage / networksOrderedByScores.size();
+ float percentCompleted = 100.0f - remainingPercentage;
while ((network = networksOrderedByScores.poll()) != null) {
final boolean createView = networkViewCount++ <
MAX_NETWORK_VIEWS;
final CyNetwork nestedNetwork =
@@ -203,6 +212,9 @@
final CyNode node =
Cytoscape.getCyNode(network.getNodeName(), /*
create = */false);
node.setNestedNetwork(nestedNetwork);
+
+ percentCompleted += percentIncrement;
+
taskMonitor.setPercentCompleted(Math.round(percentCompleted));
}
}
Modified:
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/SearchTask.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/SearchTask.java
2010-02-12 22:43:56 UTC (rev 19330)
+++
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/SearchTask.java
2010-02-12 23:11:38 UTC (rev 19331)
@@ -32,9 +32,11 @@
}
public void run() {
- setPercentCompleted(0);
- setStatus("Searching for complexes...");
+ final float SEARCH_PERCENTAGE = 70.0f; // Progress bar should
go up to here for the search part.
+ taskMonitor.setPercentCompleted(1);
+ taskMonitor.setStatus("Searching for complexes...");
+
final CyNetwork inputNetwork = parameters.getNetwork();
final ConvertCyNetworkToSFNetworks converter = new
ConvertCyNetworkToSFNetworks(
@@ -50,13 +52,16 @@
hcScoringFunction.Initialize(physicalNetwork, geneticNetwork);
final TypedLinkNetwork<TypedLinkNodeModule<String, BFEdge>,
BFEdge> results =
- HCSearch2.search(physicalNetwork, geneticNetwork,
hcScoringFunction);
+ HCSearch2.search(physicalNetwork, geneticNetwork,
hcScoringFunction,
+ taskMonitor, SEARCH_PERCENTAGE);
final TypedLinkNetwork<String, Float> pNet =
physicalNetwork.asTypedLinkNetwork();
final TypedLinkNetwork<String, Float> gNet =
geneticNetwork.asTypedLinkNetwork();
final NestedNetworkCreator nnCreator =
- new NestedNetworkCreator(results, inputNetwork, pNet,
gNet, parameters.getEdgeCutoff());
+ new NestedNetworkCreator(results, inputNetwork, pNet,
gNet,
+ parameters.getEdgeCutoff(),
taskMonitor,
+ 100.0f - SEARCH_PERCENTAGE);
setStatus("Search finished!\n\n" + "Number of complexes = "
+ nnCreator.getOverviewNetwork().getNodeCount() +
"\n\n"
@@ -74,7 +79,7 @@
}
public String getTitle() {
- return "Denovo PG Network Alignment";
+ return "ModFind";
}
private void setPercentCompleted(int percent) {
Modified:
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/VisualStyleBuilder.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/VisualStyleBuilder.java
2010-02-12 22:43:56 UTC (rev 19330)
+++
csplugins/trunk/ucsd/ruschein/ModFind/src/org/idekerlab/ModFindPlugin/VisualStyleBuilder.java
2010-02-12 23:11:38 UTC (rev 19331)
@@ -38,7 +38,7 @@
private static ContinuousMapping nodeSizeMapping;
private static final String OVERVIEW_VS_NAME = "Complex Overview Style";
- private static final String MODULE_VS_NAME = "Denovo Module Style";
+ private static final String MODULE_VS_NAME = "ModFind Module Style";
// This is a Singleton.
private static VisualStyleBuilder builder = new VisualStyleBuilder();
--
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.