Author: scooter
Date: 2011-09-15 15:34:18 -0700 (Thu, 15 Sep 2011)
New Revision: 26829

Modified:
   csplugins/trunk/ucsf/scooter/structureViz/build.xml
   csplugins/trunk/ucsf/scooter/structureViz/resources/plugin.props
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/StructureCommands.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraChain.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraModel.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraResidue.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ActionPopupMenu.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/StructureVizMenuHandler.java
Log:
Changes to Structure to allow multiple graph objects to be associated
with a single Chimera Model.


Modified: csplugins/trunk/ucsf/scooter/structureViz/build.xml
===================================================================
--- csplugins/trunk/ucsf/scooter/structureViz/build.xml 2011-09-15 22:12:59 UTC 
(rev 26828)
+++ csplugins/trunk/ucsf/scooter/structureViz/build.xml 2011-09-15 22:34:18 UTC 
(rev 26829)
@@ -8,6 +8,7 @@
    <property name = "lib" location = "../../../../cytoscape"/>
    <property name = "jar"  location = "jar"/>
    <property name = "doc" location = "doc"/>
+   <property name="java.target_version" value="1.6" />
 
    <property name="cytoscape.plugin" value="${lib}/plugins"/>
 

Modified: csplugins/trunk/ucsf/scooter/structureViz/resources/plugin.props
===================================================================
--- csplugins/trunk/ucsf/scooter/structureViz/resources/plugin.props    
2011-09-15 22:12:59 UTC (rev 26828)
+++ csplugins/trunk/ucsf/scooter/structureViz/resources/plugin.props    
2011-09-15 22:34:18 UTC (rev 26829)
@@ -13,7 +13,7 @@
 pluginDescription=This plugin provides an interface to UCSF Chimera from 
within Cytoscape, providing a linkage between the network view and the 
structural view.
 
 # Plugin version number, this must be two numbers separated by a decimlal.  
Ex. 0.2, 14.03
-pluginVersion=1.9
+pluginVersion=1.10
 
 # Compatible Cytoscape version
 cytoscapeVersion=2.8

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
   2011-09-15 22:12:59 UTC (rev 26828)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
   2011-09-15 22:34:18 UTC (rev 26829)
@@ -41,6 +41,10 @@
 import java.util.Properties;
 
 // giny imports
+import giny.model.Edge;
+import giny.model.GraphObject;
+import giny.model.Node;
+import giny.view.EdgeView;
 import giny.view.NodeView;
 
 // Cytoscape imports
@@ -57,7 +61,9 @@
 import structureViz.actions.Chimera;
 import structureViz.model.Structure;
 import structureViz.model.Sequence;
+import structureViz.model.ChimeraChain;
 import structureViz.model.ChimeraModel;
+import structureViz.model.ChimeraResidue;
 
 
 /**
@@ -76,7 +82,7 @@
        private static CyAttributes cyAttributes;
        private static CyLogger logger = null;
 
-       static List<NodeView> selectedList = null;
+       static List<GraphObject> selectedList = null;
 
   static { 
                String structureAttribute = getProperty("structureAttribute");
@@ -261,7 +267,7 @@
                        if (sList != null && sList.size() > 0)
                                return sList.get(0);
                }
-               Structure s =  new Structure(name, null, 
Structure.StructureType.PDB_MODEL);
+               Structure s =  Structure.getStructure(name, (CyNode)null, 
Structure.StructureType.PDB_MODEL);
                pdbStructureMap.put(name, s);
                return s;
        }
@@ -339,14 +345,40 @@
         * with ChimeraModels as the keys
         * @param chimeraModels the list of ChimeraModels we currently have open
         */
-       public static void selectCytoscapeNodes(CyNetworkView networkView, 
Map<ChimeraModel,ChimeraModel> modelsToSelect,
+       public static void selectCytoscapeNodes(CyNetworkView networkView, 
+                                               Map<ChimeraModel,ChimeraModel> 
modelsToSelect,
                                                                                
                                                                                
        List<ChimeraModel> chimeraModels) {
                CyNetwork network = networkView.getNetwork();
 
-               if (selectedList == null) selectedList = new 
ArrayList<NodeView>();
+               if (selectedList == null) selectedList = new 
ArrayList<GraphObject>();
 
+               // We need to do this in two passes since some parts of a 
structure might be
+               // selected and some might not.  Our selection model 
(unfortunately) only tells
+               // us that something has changed, not what...
+               List<GraphObject> graphObjectList = new 
ArrayList<GraphObject>();
                for (ChimeraModel model: chimeraModels) {
                        if (model == null) continue;
+                       Structure st = model.getStructure();
+                       if (!modelsToSelect.containsKey(model)) {
+                               // Deselect everything in this structure
+                               graphObjectList.addAll(st.getGraphObjectList());
+                       }
+               }
+               setSelectedState(networkView, graphObjectList, false);
+               graphObjectList.clear();
+
+               for (ChimeraModel model: chimeraModels) {
+                       if (model == null) continue;
+                       Structure st = model.getStructure();
+                       if (modelsToSelect.containsKey(model)) {
+                               // Select the appropriate things
+                               List<ChimeraResidue>residueList = 
model.getSelectedResidues();
+                               
graphObjectList.addAll(st.getGraphObjectList(residueList));
+                       }
+               }
+               setSelectedState(networkView, graphObjectList, true);
+
+/*
                        CyNode node = model.getStructure().node();
                        if (node == null) continue;
                        NodeView nodeView = networkView.getNodeView(node);
@@ -371,6 +403,7 @@
                                }
                        }
                }
+*/
 
                networkView.updateView();
        }
@@ -416,7 +449,8 @@
                return structure;
        }
 
-       private static List<Structure> getStructures(CyNode node, 
List<Structure> structureList, String matchName) {
+       private static List<Structure> getStructures(CyNode node, 
+                                                    List<Structure> 
structureList, String matchName) {
                if (structureList == null) {
                        structureList = new ArrayList<Structure>();
                }
@@ -425,7 +459,8 @@
                if (chemStruct != null && chemStruct.length() > 0) {
                                String[] structList = chemStruct.split(",");
                                for (int i = 0; i < structList.length; i++) {
-                                       Structure s = new 
Structure(structList[i].trim() ,node , Structure.StructureType.SMILES);
+                                       Structure s = 
Structure.getStructure(structList[i].trim(), node, 
+                                                                            
Structure.StructureType.SMILES);
                                        
smilesStructureMap.put(structList[i].trim(), s);
                                        structureList.add(s);
                                }
@@ -444,10 +479,11 @@
                if (sList != null && sList.length > 0) {
                        // It does, so add them all
                        for (int i = 0; i < sList.length; i++) {
-                               Structure s = new 
Structure(sList[i].trim(),node, Structure.StructureType.PDB_MODEL);
+                               Structure s = 
Structure.getStructure(sList[i].trim(),node, 
+                                                                    
Structure.StructureType.PDB_MODEL);
                                pdbStructureMap.put(sList[i].trim(), s);
                                // System.out.println("Setting residue list for 
"+s);
-                               s.setResidueList(residues);
+                               s.setResidueList(node, residues);
                                if (matchName != null && 
matchName.equals(sList[i].trim())) {
                                        structureList.add(s);
                                        return structureList;
@@ -455,12 +491,25 @@
                                        structureList.add(s);
                        }
                } else if (structure != null) {
-                       Structure s = new Structure(structure,node, 
Structure.StructureType.PDB_MODEL);
+                       Structure s = Structure.getStructure(structure,node, 
Structure.StructureType.PDB_MODEL);
                        pdbStructureMap.put(structure, s);
-                       s.setResidueList(residues);
+                       s.setResidueList(node, residues);
                        if (matchName != null && matchName.equals(structure))
        structureList.add(s);
                }
                return structureList;
        }
+
+       private static void setSelectedState(CyNetworkView view, 
List<GraphObject> goList, boolean state) {
+               for (GraphObject obj: goList) {
+                       if (obj instanceof Node) {
+                               // Handle secondary paint??
+                               view.getNodeView((Node)obj).setSelected(state);
+                       } else if (obj instanceof Edge) {
+                               view.getEdgeView((Edge)obj).setSelected(state);
+                       }
+                       if (selectedList.contains(obj))
+                               selectedList.remove(obj);
+               }
+       }
 }

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/StructureCommands.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/StructureCommands.java
  2011-09-15 22:12:59 UTC (rev 26828)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/StructureCommands.java
  2011-09-15 22:34:18 UTC (rev 26829)
@@ -121,7 +121,7 @@
                        structureType = Structure.StructureType.SMILES;
                }
 
-               Structure st = new Structure(name, null, structureType);
+               Structure st = Structure.getStructure(name, (CyNode)null, 
structureType);
                chimera.open(st);
 
                // To make sure, see if we can get the Chimera model

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraChain.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraChain.java
  2011-09-15 22:12:59 UTC (rev 26828)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraChain.java
  2011-09-15 22:34:18 UTC (rev 26829)
@@ -114,6 +114,24 @@
        public boolean isSelected() { return selected; }
 
        /**
+        * Return the list of selected residues
+        *
+        * @return all selected residues
+        */
+       public List<ChimeraResidue> getSelectedResidues() {
+               List<ChimeraResidue>residueList =  new 
ArrayList<ChimeraResidue>();
+               if (selected) {
+                       residueList.addAll(getResidues());
+               } else {
+                       for (ChimeraResidue residue: getResidues()) {
+                               if (residue.isSelected())
+                                       residueList.add(residue);
+                       }
+               }
+               return residueList;
+       }
+
+       /**
         * Add a residue to the chain.
         *
         * @param residue the ChimeraResidue to add to the chain.

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraModel.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraModel.java
  2011-09-15 22:12:59 UTC (rev 26828)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraModel.java
  2011-09-15 22:34:18 UTC (rev 26829)
@@ -77,9 +77,9 @@
                        this.modelNumber = structure.modelNumber();
                        this.subModelNumber = structure.subModelNumber();
                }
-               this.chains = new TreeMap();
-               this.residues = new TreeMap();
-               this.residueMap = new HashMap();
+               this.chains = new TreeMap<String,ChimeraChain>();
+               this.residues = new TreeMap<String,ChimeraResidue>();
+               this.residueMap = new HashMap<String,ChimeraResidue>();
                this.structure = structure;
                this.modelColor = color;
        }
@@ -114,9 +114,9 @@
                        this.structure = 
structure.makeSubModel(this.subModelNumber);
 
                this.structure.setModelNumber(this.modelNumber, 
this.subModelNumber);
-               this.chains = new TreeMap();
-               this.residues = new TreeMap();
-               this.residueMap = new HashMap();
+               this.chains = new TreeMap<String,ChimeraChain>();
+               this.residues = new TreeMap<String,ChimeraResidue>();
+               this.residueMap = new HashMap<String,ChimeraResidue>();
        }
 
        /**
@@ -136,6 +136,23 @@
        public boolean isSelected() { return selected; }
 
        /**
+        * Return the list of selected residues
+        *
+        * @return all selected residues
+        */
+       public List<ChimeraResidue> getSelectedResidues() {
+               List<ChimeraResidue>residueList =  new 
ArrayList<ChimeraResidue>();
+               if (selected) {
+                       residueList.addAll(getResidues());
+               } else {
+                       for (ChimeraChain chain: getChains())
+                               residueList.addAll(chain.getSelectedResidues());
+               }
+               return residueList;
+               
+       }
+
+       /**
         * Get the list of chain names associated with this model
         *
         * @return return the list of chain names for this model

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraResidue.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraResidue.java
        2011-09-15 22:12:59 UTC (rev 26828)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraResidue.java
        2011-09-15 22:34:18 UTC (rev 26829)
@@ -213,6 +213,56 @@
        }
 
        /**
+        * Return true if this residue is included in the atom
+        * spec passed to it...
+        *
+        * @param atomSpec the Chimera atom spec
+        * @return true if this residue is addressed by this atom spec
+        */
+       public boolean matchesAtomSpec(String atomSpec) {
+               // We need to parse the atom spec to see if it includes this 
residue
+               // Possibilities:
+               //      1) Atom spec is just a residue -- compare and return 
result
+               //      2) Atom spec is a range, need to see if this residue is 
in that range
+               //      3) Atom spec is a chain -- see if this residue is part 
of that chain
+               if (atomSpec.charAt(0) == '.') {
+                       // System.out.println("Chain match: chainId = 
"+chainId+" atomSpec = "+atomSpec);
+                       // We have a chain
+                       if (atomSpec.substring(1).equalsIgnoreCase(chainId))
+                               return true;
+               } else if (atomSpec.indexOf("-") > 0) {
+                       // We have a range
+                       String range[] = atomSpec.split("-");
+                       if (range[1].indexOf('.') > 0) {
+                               String chainSpec[] = range[1].split("\\.");
+                               if (!chainSpec[1].equalsIgnoreCase(chainId))
+                                       return false;
+                               range[1] = chainSpec[0];
+                       }
+                       // System.out.println("Residue match: index = "+index+" 
range = "+range[0]+"-"+range[1]);
+                       int thisResidue = Integer.parseInt(index);
+                       int rangeStart = Integer.parseInt(range[0]);
+                       int rangeEnd = Integer.parseInt(range[1]);
+                       if (rangeStart <= thisResidue && rangeEnd >= 
thisResidue)
+                               return true;
+               } else {
+                       // Residue
+                       if (atomSpec.indexOf('.') > 0) {
+                               // We've got a chain -- make sure it's our chain
+                               // System.out.println("Chain match: chainId = 
"+chainId+" atomSpec = "+atomSpec);
+                               String chainSpec[] = atomSpec.split("\\.");
+                               if (!chainSpec[1].equalsIgnoreCase(chainId))
+                                       return false;
+                               atomSpec = chainSpec[0];
+                       }
+                       // System.out.println("Residue match: index = "+index+" 
atomSpec = "+atomSpec);
+                       if (index.equals(atomSpec))
+                               return true;
+               }
+               return false;
+       }
+
+       /**
         * Get the index of this residue
         *
         * @return residue index

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java 
    2011-09-15 22:12:59 UTC (rev 26828)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java 
    2011-09-15 22:34:18 UTC (rev 26829)
@@ -32,21 +32,26 @@
  */
 package structureViz.model;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
-import java.util.ArrayList;
+import java.util.Map;
 
 import cytoscape.CyNode;
+import giny.model.GraphObject;
 
+import structureViz.model.ChimeraResidue;
+
 /**
  * The Structure class provides a link between the Chimera data
  * and the Cytoscape data.
  */
 public class Structure {
-       static int nStructures = 0;
        static int nextModel = 0;
+       static Map<String, Structure> structureMap = new HashMap<String, 
Structure>();
        String structureName;
-       List<String> residueList;
-       CyNode cytoscapeNode;
+       Map<GraphObject, List<String>> residueMap;
+       List<GraphObject> graphObjectList;
        int modelNumber;
        int subModelNumber;
        StructureType type;
@@ -60,24 +65,38 @@
         */
        public static int getNextModel() {return nextModel++;}
 
+       public static Structure getStructure(String name, CyNode node, 
StructureType type) {
+               if (structureMap.containsKey(name)) {
+                       Structure s = structureMap.get(name);
+                       s.addGraphObject(node);
+                       return s;
+               }
+               return new Structure(name, node, type);
+       }
+
        /**
         * Create a new Structure
         *
         * @param name the name of the structure
         * @param node the CyNode that this structure points to
         */
-       public Structure (String name, CyNode node, StructureType type) {
+       protected Structure (String name, CyNode node, StructureType type) {
+               this(name, new ArrayList<GraphObject>(), type);
+               if (node != null)
+                       this.setNode(node);
+       }
+
+       protected Structure (String name, List<GraphObject> nodeList, 
StructureType type) {
                this.structureName = name;
-               this.cytoscapeNode = node;
                this.modelNumber = nextModel;
                this.subModelNumber = 0;
-               this.residueList = null;
+               this.residueMap = new HashMap<GraphObject, List<String>>();
                this.type = type;
+               this.graphObjectList = nodeList;
        }
 
        public Structure makeSubModel(int subModelNumber) {
-               System.out.println("Makeing sub-model");
-               Structure st = new Structure(this.structureName, 
this.cytoscapeNode, this.type);
+               Structure st = new Structure(this.structureName, 
this.graphObjectList, this.type);
                st.setModelNumber(this.modelNumber, subModelNumber);
                return st;
        }
@@ -94,16 +113,65 @@
         *
         * @return the CyNode this structure is an attribute of
         */
-       public CyNode node() {return this.cytoscapeNode;}
+       public CyNode node() {
+               if (graphObjectList.get(0) instanceof CyNode)
+                       return (CyNode)graphObjectList.get(0);
+               return null;
+       }
 
        /**
         * Set the CyNode this structure is associated with
         *
         * @param node the CyNode this structure is an attribute of
         */
-       public void setNode(CyNode node) {this.cytoscapeNode = node;}
+       public void setNode(CyNode node) {this.graphObjectList.add(0,node);}
 
        /**
+        * Add a CyNode or CyEdge to the list of graph objects this structure 
is associated with
+        *
+        * @param node the GraphObject this structure is an attribute of
+        */
+       public void addGraphObject(GraphObject go) 
{this.graphObjectList.add(go);}
+
+       /**
+        * Remove a Graph Object from the list of objects this structure is 
associated with
+        *
+        * @param node the Graph Object to remove from this structure's list
+        */
+       public void removeGraphObject(GraphObject go) {
+               if (graphObjectList.contains(go))
+                       graphObjectList.remove(go);
+       }
+
+       /**
+        * Get the list of GraphObjects for this structure
+        *
+        * @return objList the GraphObjects this structure is an attribute of
+        */
+       public List<GraphObject> getGraphObjectList() {return 
this.graphObjectList;}
+
+       /**
+        * Get the list of GraphObjects for this structure that match a list
+        * of residues.
+        *
+        * @param residueList the list of residues we're matching
+        * @return objList the GraphObjects this structure is an attribute of
+        */
+       public List<GraphObject> getGraphObjectList(List<ChimeraResidue> 
residueList) {
+               List<GraphObject>goList = new ArrayList<GraphObject>();
+               if (residueList == null || residueList.size() == 0)
+                       return goList;
+
+               for (GraphObject obj: graphObjectList) {
+                       if (residuesMatch(obj, residueList)) {
+                               // System.out.println("Found match for 
"+obj.getIdentifier());
+                               goList.add(obj);
+                       }
+               }
+               return goList;
+       }
+
+       /**
         * Get the modelNumber for this structure
         *
         * @return the model number as an int
@@ -132,12 +200,15 @@
         * Get the identifier of the cytoscape node this structure
         * is an attribute of.
         *
-        * @return identifier of the CyNode as a String
+        * @return identifier of the Graph Object as a String
         */
        public String getIdentifier() {
-               if (cytoscapeNode == null)
+               if (graphObjectList == null || graphObjectList.size() == 0)
                        return "(none)";
-               return cytoscapeNode.getIdentifier();
+               else if (graphObjectList.size() == 1)
+                       return graphObjectList.get(0).getIdentifier();
+               else
+                       return constructListOfGraphObjects(graphObjectList);
        }
 
        /**
@@ -159,11 +230,27 @@
        }
 
        /**
-        * Return the "active site" or "special" residues
+        * Return the "active site" or "special" residues for a single node or 
edge
         *
+        * @param graphObject the Graph Object this list applies to
         * @return String representation of the residues (comma separated)
         */
+       public List<String> getResidueList(GraphObject obj) {
+               if (residueMap.containsKey(obj))
+                       return residueMap.get(obj);
+               return null;
+       }
+
+       /**
+        * Return the "active site" or "special" residues for all nodes or edges
+        *
+        * @return String representation of the residues (comma separated)
+        */
        public List<String> getResidueList() {
+               List<String> residueList = new ArrayList<String>();
+               for (GraphObject obj: residueMap.keySet()) {
+                       residueList.addAll(getResidueList(obj));
+               }
                return residueList;
        }
 
@@ -172,8 +259,8 @@
         *
         * @param residues String representation of the residues (comma 
separated)
         */
-       public void setResidueList(String residues) {
-               this.residueList = new ArrayList<String>();
+       public void setResidueList(GraphObject obj, String residues) {
+               List<String> residueList = new ArrayList<String>();
                if (residues == null) {
                        return;
                }
@@ -194,21 +281,59 @@
                        if (residue == null || residue.equals("") || 
residue.length() == 0)
                                continue;
                        String[] range = residue.split("-",2);
+                       String chain = null;
                        for (int res = 0; res < range.length; res++) {
-                               if (res == 1) resRange = resRange.concat("-");
+                               if (res == 1) {
+                                       resRange = resRange.concat("-");
+                                       if (chain != null && 
range[res].indexOf('.') == -1)
+                                               range[res] = 
range[res].concat("."+chain);
+                               }
+
+                               if (res == 0 && range.length >= 2 && 
range[res].indexOf('.') > 0) {
+                                       // This is a range spec with the 
leading residue containing a chain spec
+                                       String[] resChain = 
range[res].split("\\.");
+                                       chain = resChain[1];
+                                       range[res] = resChain[0];
+                               }
                                // Convert to legal atom-spec
-                               if (Character.isDigit(residue.charAt(0))) {
+                               if (Character.isDigit(range[res].charAt(0))) {
                                        resRange = resRange.concat(range[res]);
-                               } else if 
(Character.isDigit(residue.charAt(1))) {
+                               } else if 
(Character.isDigit(range[res].charAt(1))) {
                                        resRange = 
resRange.concat(range[res].substring(1));
-                               } else if (residue.charAt(0) == '.') {
+                               } else if (range[res].charAt(0) == '.') {
                                        // Do we have a chain spec?
                                        resRange = resRange.concat(range[res]);
                                } else {
                                        resRange = 
resRange.concat(range[res].substring(3));
                                }
                        }
-                       this.residueList.add(resRange);
+                       residueList.add(resRange);
                }
+               residueMap.put(obj, residueList);
        }
+
+       private String constructListOfGraphObjects(List<GraphObject> objList) {
+               String list = null;
+               for (GraphObject obj: objList) {
+                       if (list == null)
+                               list = ""+obj.getIdentifier();
+                       else
+                               list += ";"+obj.getIdentifier();
+               }
+               return list;
+       }
+
+       private boolean residuesMatch(GraphObject obj, 
List<ChimeraResidue>residueList) {
+               if (!residueMap.containsKey(obj))
+                       return true;
+
+               List<String>residues = residueMap.get(obj);
+               for (ChimeraResidue res: residueList) {
+                       for (String atomSpec: residues) {
+                               if (res.matchesAtomSpec(atomSpec))
+                                       return true;
+                       }
+               }
+               return false;
+       }
 }

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ActionPopupMenu.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ActionPopupMenu.java
  2011-09-15 22:12:59 UTC (rev 26828)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ActionPopupMenu.java
  2011-09-15 22:34:18 UTC (rev 26829)
@@ -434,7 +434,7 @@
                                        ChimeraModel model = 
obj.getChimeraModel();
                                        List<String> residueL = 
model.getStructure().getResidueList();
                                        if (residueL == null) return;
-                                       // The residue list is of the form 
RRRnnn,RRRnnn.  We want
+                                       // The residue list may be of the form 
RRRnnn,RRRnnn.  We want
                                        // to reformat this to nnn,nnn
                                        String residues = new String();
                                        for (String residue: residueL) {

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
     2011-09-15 22:12:59 UTC (rev 26828)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
     2011-09-15 22:34:18 UTC (rev 26829)
@@ -125,8 +125,8 @@
         * this dialog
         */
        protected ModelNavigatorDialog (Frame parent, Chimera object) {
-               // super(parent, false);
-               super(Cytoscape.getDesktop(), "Cytoscape Molecular Structure 
Navigator");
+               // super(Cytoscape.getDesktop(), "Cytoscape Molecular Structure 
Navigator");
+               super((Frame)null, "Cytoscape Molecular Structure Navigator");
                chimeraObject = object;
                initComponents();
                status = false;

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/StructureVizMenuHandler.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/StructureVizMenuHandler.java
  2011-09-15 22:12:59 UTC (rev 26828)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/StructureVizMenuHandler.java
  2011-09-15 22:34:18 UTC (rev 26829)
@@ -185,7 +185,7 @@
                String ident = node.getIdentifier();
                if (ident.startsWith("gi"))
                        ident = ident.substring(2);
-               Structure struct = new Structure(ident, node, 
Structure.StructureType.MODBASE_MODEL);
+               Structure struct = Structure.getStructure(ident, node, 
Structure.StructureType.MODBASE_MODEL);
                userData = struct;
                openAction(ident, null, false);
        }

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