Author: kono
Date: 2010-01-12 11:38:46 -0800 (Tue, 12 Jan 2010)
New Revision: 18877

Modified:
   
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/networks/denovoPGNetworkAlignment/HCSearch2.java
   
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/org/cytoscape/DenovoPGNetworkAlignmentPlugin/NestedNetworkCreator.java
   
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/org/cytoscape/DenovoPGNetworkAlignmentPlugin/SearchTask.java
Log:
Overview network will be created after search.

Modified: 
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/networks/denovoPGNetworkAlignment/HCSearch2.java
===================================================================
--- 
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/networks/denovoPGNetworkAlignment/HCSearch2.java
 2010-01-12 19:24:23 UTC (rev 18876)
+++ 
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/networks/denovoPGNetworkAlignment/HCSearch2.java
 2010-01-12 19:38:46 UTC (rev 18877)
@@ -362,7 +362,7 @@
 
        public static String report(
                        TypedLinkNetwork<TypedLinkNodeModule<String, BFEdge>, 
BFEdge> results) {
-               
+
                final StringBuilder builder = new StringBuilder();
 
                DoubleVector cscores = new DoubleVector(results.numNodes());
@@ -377,7 +377,6 @@
                builder.append("Best cluster score: " + cscores.max(false) + 
"\n");
                builder.append("Worst cluster score: " + cscores.min(false) + 
"\n");
                builder.append("Largest cluster size: " + csizes.max(false) + 
"\n");
-               
 
                DoubleVector escores = new DoubleVector(results.numEdges());
                for (TypedLinkEdge<TypedLinkNodeModule<String, BFEdge>, BFEdge> 
ed : results
@@ -386,13 +385,13 @@
                        if (score != -1)
                                escores.add(score);
                }
-               
+
                builder.append("Best edge score: " + escores.max(false) + "\n");
 
                // csizes.plothist(30);
 
                System.out.println(builder.toString());
-               
+
                return builder.toString();
        }
 

Modified: 
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/org/cytoscape/DenovoPGNetworkAlignmentPlugin/NestedNetworkCreator.java
===================================================================
--- 
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/org/cytoscape/DenovoPGNetworkAlignmentPlugin/NestedNetworkCreator.java
   2010-01-12 19:24:23 UTC (rev 18876)
+++ 
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/org/cytoscape/DenovoPGNetworkAlignmentPlugin/NestedNetworkCreator.java
   2010-01-12 19:38:46 UTC (rev 18877)
@@ -1,52 +1,61 @@
 package org.cytoscape.DenovoPGNetworkAlignmentPlugin;
 
+import java.util.Set;
 
-import cytoscape.CyEdge;
-import cytoscape.CyNetwork;
-import cytoscape.CyNode;
-import cytoscape.Cytoscape;
-import cytoscape.data.CyAttributes;
-import java.util.Set;
 import networks.denovoPGNetworkAlignment.BFEdge;
-import networks.linkedNetworks.TypedLinkEdge;
 import networks.linkedNetworks.TypedLinkNetwork;
 import networks.linkedNetworks.TypedLinkNode;
 import networks.linkedNetworks.TypedLinkNodeModule;
+import cytoscape.CyNetwork;
+import cytoscape.CyNode;
+import cytoscape.Cytoscape;
 
-
-/** Creates an overview network for the detected complexes and nested networks 
for each complex.
+/**
+ * Creates an overview network for the detected complexes and nested networks
+ * for each complex.
  */
 class NestedNetworkCreator {
        CyNetwork overviewNetwork = null;
 
-
        /**
-        * Instantiates an overview network of complexes (modules) and one 
nested network for each node in the overview network.
+        * Instantiates an overview network of complexes (modules) and one 
nested
+        * network for each node in the overview network.
         */
-       NestedNetworkCreator(final TypedLinkNetwork<TypedLinkNodeModule<String, 
BFEdge>, BFEdge> networkOfModules) {
+       NestedNetworkCreator(
+                       final TypedLinkNetwork<TypedLinkNodeModule<String, 
BFEdge>, BFEdge> networkOfModules) {
                createOverviewNetwork(networkOfModules.nodes());
        }
 
-       CyNetwork getOverviewNetwork() { return overviewNetwork; }
+       CyNetwork getOverviewNetwork() {
+               return overviewNetwork;
+       }
 
-       private void createOverviewNetwork(final 
Set<TypedLinkNode<TypedLinkNodeModule<String, BFEdge>, BFEdge>> overviewNodes) {
-               overviewNetwork = 
Cytoscape.createNetwork(findNextAvailableNetworkName("Complexes"), /* 
create_view = */ true);
+       private void createOverviewNetwork(
+                       final Set<TypedLinkNode<TypedLinkNodeModule<String, 
BFEdge>, BFEdge>> overviewNodes) {
+               overviewNetwork = Cytoscape.createNetwork(
+                               findNextAvailableNetworkName("Complex Search 
Result: " + new java.util.Date()), /* create_view = */
+                               true);
 
                int nodeIndex = 1;
                for (final TypedLinkNode<TypedLinkNodeModule<String, BFEdge>, 
BFEdge> module : overviewNodes) {
-                       final String nodeName = 
findNextAvailableNodeName("Complex" + nodeIndex);
-                       final CyNode newNode = Cytoscape.getCyNode(nodeName, /* 
create = */ true);
+                       final String nodeName = 
findNextAvailableNodeName("Complex"
+                                       + nodeIndex);
+                       final CyNode newNode = Cytoscape.getCyNode(nodeName, /* 
create = */
+                                       true);
                        overviewNetwork.addNode(newNode);
 
                        ++nodeIndex;
                }
        }
 
-
        /**
-        * Finds an unused network name starting with a first choice.  If the 
first choice is not available, we will successively try to append -1
-        * -2, -3 and so on, until we indentify an unused name.
-        * @param initialPreference  The network name we'd like to use, if it 
is available.  If not we use it as a prefix instead.
+        * Finds an unused network name starting with a first choice. If the 
first
+        * choice is not available, we will successively try to append -1 -2, 
-3 and
+        * so on, until we indentify an unused name.
+        * 
+        * @param initialPreference
+        *            The network name we'd like to use, if it is available. If 
not
+        *            we use it as a prefix instead.
         */
        private String findNextAvailableNetworkName(final String 
initialPreference) {
                // Try the preferred choice first:
@@ -62,35 +71,40 @@
                }
        }
 
-
        /**
-        * Finds an unused node name starting with a first choice.  If the 
first choice is not available, we will successively try to append -1
-        * -2, -3 and so on, until we indentify an unused name.
-        * @param initialPreference  The node name we'd like to use, if it is 
available.  If not we use it as a prefix instead.
+        * Finds an unused node name starting with a first choice. If the first
+        * choice is not available, we will successively try to append -1 -2, 
-3 and
+        * so on, until we indentify an unused name.
+        * 
+        * @param initialPreference
+        *            The node name we'd like to use, if it is available. If 
not we
+        *            use it as a prefix instead.
         */
        private String findNextAvailableNodeName(final String 
initialPreference) {
                // Try the preferred choice first:
-               CyNode node = Cytoscape.getCyNode(initialPreference, /* create 
= */ false);
+               CyNode node = Cytoscape
+                               .getCyNode(initialPreference, /* create = 
*/false);
                if (node == null)
                        return initialPreference;
 
                for (int suffix = 1; true; ++suffix) {
                        final String titleCandidate = initialPreference + "-" + 
suffix;
-                       node = Cytoscape.getCyNode(titleCandidate, /* create = 
*/ false);
+                       node = Cytoscape.getCyNode(titleCandidate, /* create = 
*/false);
                        if (node == null)
                                return titleCandidate;
                }
        }
 
+       /**
+        * Returns the first network with title "networkTitle" or null, if 
there is
+        * no network w/ this title.
+        */
+       private CyNetwork getNetworkByTitle(final String networkTitle) {
+               for (final CyNetwork network : Cytoscape.getNetworkSet()) {
+                       if (network.getTitle().equals(networkTitle))
+                               return network;
+               }
 
-        /** Returns the first network with title "networkTitle" or null, if 
there is no network w/ this title.
-         */
-        private CyNetwork getNetworkByTitle(final String networkTitle) {
-                for (final CyNetwork network : Cytoscape.getNetworkSet()) {
-                        if (network.getTitle().equals(networkTitle))
-                                return network;
-                }
-
-                return null;
-        }
+               return null;
+       }
 }

Modified: 
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/org/cytoscape/DenovoPGNetworkAlignmentPlugin/SearchTask.java
===================================================================
--- 
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/org/cytoscape/DenovoPGNetworkAlignmentPlugin/SearchTask.java
     2010-01-12 19:24:23 UTC (rev 18876)
+++ 
csplugins/trunk/ucsd/ruschein/DenovoPGNetworkAlignment/src/org/cytoscape/DenovoPGNetworkAlignmentPlugin/SearchTask.java
     2010-01-12 19:38:46 UTC (rev 18877)
@@ -35,10 +35,15 @@
                hcScoringFunction.Initialize(converter.getPhysicalNetwork(), 
converter
                                .getGeneticNetwork());
                final TypedLinkNetwork<TypedLinkNodeModule<String, BFEdge>, 
BFEdge> results = HCSearch2
-                               .search(converter.getPhysicalNetwork(), 
converter.getGeneticNetwork(), hcScoringFunction);
-               
-               setStatus("Search finished!\n\n" + HCSearch2.report(results));
-               
+                               .search(converter.getPhysicalNetwork(), 
converter
+                                               .getGeneticNetwork(), 
hcScoringFunction);
+
+               final NestedNetworkCreator nnCreator = new 
NestedNetworkCreator(results);
+
+               setStatus("Search finished!\n\n" + "Number of Complexes = "
+                               + nnCreator.getOverviewNetwork().getNodeCount() 
+ "\n\n"
+                               + HCSearch2.report(results));
+
                setPercentCompleted(100);
 
        }

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