Author: scooter
Date: 2012-11-25 16:47:18 -0800 (Sun, 25 Nov 2012)
New Revision: 30838

Modified:
   csplugins/trunk/ucsf/scooter/chemViz/src/chemViz/model/Compound.java
   
csplugins/trunk/ucsf/scooter/chemViz/src/chemViz/tasks/TanimotoScorerTask.java
Log:
Improve performance of network creation


Modified: csplugins/trunk/ucsf/scooter/chemViz/src/chemViz/model/Compound.java
===================================================================
--- csplugins/trunk/ucsf/scooter/chemViz/src/chemViz/model/Compound.java        
2012-11-23 22:07:50 UTC (rev 30837)
+++ csplugins/trunk/ucsf/scooter/chemViz/src/chemViz/model/Compound.java        
2012-11-26 00:47:18 UTC (rev 30838)
@@ -155,10 +155,10 @@
                HBONDDONOR ("HBond Donors", "donors", Integer.class),
                LOBMAX ("Length over Breadth Max", "lobmax", Double.class),
                LOBMIN ("Length over Breadth Min", "lobmin", Double.class),
+               RULEOFFIVE ("Lipinski's Rule of Five Failures", "roff", 
Double.class),
                AMR ("Molar refractivity", "refractivity", Double.class),
                RINGCOUNT ("Ring count", "nrings", Integer.class),
                RBONDS ("Rotatable Bonds Count", "rotbonds", Integer.class),
-               RULEOFFIVE ("Rule of Five Failures", "roff", Double.class),
                TPSA ("Topological Polar Surface Area", "polarsurface", 
Double.class),
                WEINERPATH ("Wiener Path", "wienerpath", Double.class),
                WEINERPOL ("Wiener Polarity", "weinerpolarity", Double.class),
@@ -186,17 +186,26 @@
        static private CyLogger logger = CyLogger.getLogger(Compound.class);
        static private Fingerprinter fingerprinter = Fingerprinter.PUBCHEM;
        static private DescriptorType[] descriptorTypes = {
-               DescriptorType.IMAGE, DescriptorType.ATTRIBUTE, 
DescriptorType.IDENTIFIER, DescriptorType.WEIGHT,
+               DescriptorType.IMAGE, DescriptorType.ATTRIBUTE, 
DescriptorType.IDENTIFIER, 
+               DescriptorType.LIPINSKI, DescriptorType.SDF,
+               DescriptorType.ALOGP,
+               DescriptorType.ALOGP2,
+               DescriptorType.AROMATICRINGSCOUNT,
                DescriptorType.MASS,
-               DescriptorType.ALOGP,DescriptorType.ALOGP2,DescriptorType.AMR,
-               DescriptorType.HBONDACCEPTOR,DescriptorType.HBONDDONOR,
-               DescriptorType.LIPINSKI,
-               // Exclude the LengthOverBreadth Descriptors until CDK gets 
better ring templates
-               DescriptorType.LOBMAX,DescriptorType.LOBMIN,
-               DescriptorType.RBONDS,DescriptorType.RULEOFFIVE,
-               DescriptorType.SDF, DescriptorType.TPSA,
-               DescriptorType.RINGCOUNT, DescriptorType.AROMATICRINGSCOUNT,
-               DescriptorType.WEINERPATH,DescriptorType.WEINERPOL
+               DescriptorType.HEAVYATOMCOUNT,
+               DescriptorType.HBONDACCEPTOR,
+               DescriptorType.HBONDDONOR,
+               DescriptorType.LOBMAX,
+               DescriptorType.LOBMIN,
+               DescriptorType.RULEOFFIVE,
+               DescriptorType.AMR,
+               DescriptorType.WEIGHT, 
+               DescriptorType.RINGCOUNT,
+               DescriptorType.RBONDS,
+               DescriptorType.TPSA,
+               DescriptorType.WEINERPATH,
+               DescriptorType.WEINERPOL,
+               DescriptorType.XLOGP
        };
 
        static private DescriptorType[] SDFTypes = {

Modified: 
csplugins/trunk/ucsf/scooter/chemViz/src/chemViz/tasks/TanimotoScorerTask.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/chemViz/src/chemViz/tasks/TanimotoScorerTask.java  
    2012-11-23 22:07:50 UTC (rev 30837)
+++ 
csplugins/trunk/ucsf/scooter/chemViz/src/chemViz/tasks/TanimotoScorerTask.java  
    2012-11-26 00:47:18 UTC (rev 30838)
@@ -108,17 +108,10 @@
 
                objectCount = 0;
                totalObjects = selection.size();
+               List<CyEdge> edgeList = new ArrayList<CyEdge>();
 
                updateMonitor();
 
-               if (createNewNetwork) {
-               // Create a new network if we're supposed to
-                       newNet = Cytoscape.createNetwork(selection, new 
ArrayList(), origNetwork.getTitle()+" copy",
-                                                                               
                                                 origNetwork, true); 
-                       newNetworkView = 
Cytoscape.getNetworkView(newNet.getIdentifier());
-                       vs = 
Cytoscape.getVisualMappingManager().getVisualStyle();
-               }
-
                for (int index1 = 0; index1 < totalObjects; index1++) {
                        CyNode node1 = (CyNode)selection.get(index1);
                        if (canceled) break;
@@ -171,7 +164,7 @@
                                        // System.out.print("   Creating and 
edge between "+node1.getIdentifier()+" and "+node2.getIdentifier());
                                        edge = Cytoscape.getCyEdge(node1, 
node2, "interaction", "similarity", true, true);
                                        // Add it to our new network
-                                       newNet.addEdge(edge);
+                                       edgeList.add(edge);
                                        // System.out.println("...done");
                                } else {
                                        // Otherwise, get the edges connecting 
these nodes (if any)
@@ -190,17 +183,24 @@
                                }
                        }
 
-                       if (createNewNetwork) {
-                               NodeView orig = 
origNetworkView.getNodeView(node1);
-                               NodeView newv = 
newNetworkView.getNodeView(node1);
+                       updateMonitor();
+               }
+
+               if (createNewNetwork) {
+               // Create a new network if we're supposed to
+                       newNet = Cytoscape.createNetwork(selection, edgeList, 
origNetwork.getTitle()+" copy",
+                                                                               
                                                 origNetwork, true); 
+                       newNetworkView = 
Cytoscape.getNetworkView(newNet.getIdentifier());
+                       vs = 
Cytoscape.getVisualMappingManager().getVisualStyle();
+
+                       for (GraphObject go: selection) {
+                               CyNode node = (CyNode)go;
+                               NodeView orig = 
origNetworkView.getNodeView(node);
+                               NodeView newv = 
newNetworkView.getNodeView(node);
                                newv.setXPosition(orig.getXPosition());
                                newv.setYPosition(orig.getYPosition());
                        }
 
-                       updateMonitor();
-               }
-
-               if (createNewNetwork) {
                        // All done -- create and update the view
                        newNetworkView.fitContent();
                        newNetworkView.setVisualStyle(vs.getName());

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