Author: scooter
Date: 2010-12-30 12:10:14 -0800 (Thu, 30 Dec 2010)
New Revision: 23284

Modified:
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraModel.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java
Log:
Submodels not working properly....


Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java 
    2010-12-30 19:18:28 UTC (rev 23283)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java 
    2010-12-30 20:10:14 UTC (rev 23284)
@@ -360,6 +360,7 @@
    * @param structure the Structure to open
    */
   public void open(Structure structure) {
+               // System.out.println("Opening "+structure);
                structure.setModelNumber(Structure.getNextModel(), 0);
                if (structure.getType() == 
Structure.StructureType.MODBASE_MODEL)
                        chimeraSend("listen stop models; listen stop selection; 
open "+structure.modelNumber()+" modbase:"+structure.name());
@@ -378,7 +379,7 @@
 
                        // Get our properties (default color scheme, etc.)
                        // Make the molecule look decent
-                       chimeraSend("repr stick "+newModel.toSpec());
+                       // chimeraSend("repr stick "+newModel.toSpec());
 
                        if (structure.getType() != 
Structure.StructureType.SMILES) {
                                // Create the information we need for the 
navigator
@@ -660,17 +661,24 @@
                String name = structure.name();
                int modelNumber = structure.modelNumber();
                int subModelNumber = structure.subModelNumber();
-               List<ChimeraModel>infoList = new ArrayList();
+               List<ChimeraModel>infoList = new ArrayList<ChimeraModel>();
 
-               for (String modelLine: commandReply("listm type molecule spec 
#"+modelNumber+"."+subModelNumber)) {
-                       // System.out.println("ModelList: "+modelLine);
-                       if (modelLine.contains("id 
#"+modelNumber+"."+subModelNumber)) {
-                               // System.out.println("Found: "+name);
+               List<String>replyList = null;
+
+               if (subModelNumber == 0)
+                       replyList = commandReply("listm type molecule spec 
#"+modelNumber);
+               else
+                       replyList = commandReply("listm type molecule spec 
#"+modelNumber+"."+subModelNumber);
+
+               for (String modelLine: replyList) {
+                       if (subModelNumber == 0 && modelLine.contains("id 
#"+modelNumber)) {
                                // got the right model, now get the model number
                                ChimeraModel chimeraModel = new 
ChimeraModel(structure, modelLine);
-                               
structure.setModelNumber(chimeraModel.getModelNumber(), 
chimeraModel.getSubModelNumber());
                                // System.out.println("Identified model as 
"+chimeraModel);
                                infoList.add(chimeraModel);
+                       } else if (modelLine.contains("id 
#"+modelNumber+"."+subModelNumber)) {
+                               ChimeraModel chimeraModel = new 
ChimeraModel(structure, modelLine);
+                               infoList.add(chimeraModel);
                        }
                }
                if (infoList.size() > 0)

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraModel.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraModel.java
  2010-12-30 19:18:28 UTC (rev 23283)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraModel.java
  2010-12-30 20:10:14 UTC (rev 23284)
@@ -106,8 +106,10 @@
         */
        public ChimeraModel (Structure structure, String inputLine) {
                this.name = structure.name();
-               this.structure = structure;
                this.modelNumber = parseModelNumber(inputLine);
+               // Do we need to create a submodel of the structure?
+               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();
@@ -369,8 +371,8 @@
                try {
                        subModelNumber = 0;
                        if (decimal > 0) {
-                               subModelNumber = 
Integer.parseInt(inputLine.substring(decimal+1, space));
-                               space = decimal;
+                               subModelNumber = 
Integer.parseInt(inputLine.substring(decimal+hash+2, space));
+                               space = decimal+hash+1;
                        }
                        modelNumber = 
Integer.parseInt(inputLine.substring(hash+1, space));
                        return modelNumber;

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java 
    2010-12-30 19:18:28 UTC (rev 23283)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java 
    2010-12-30 20:10:14 UTC (rev 23284)
@@ -75,6 +75,12 @@
                this.type = type;
        }
 
+       public Structure makeSubModel(int subModelNumber) {
+               Structure st = new Structure(this.structureName, 
this.cytoscapeNode, this.type);
+               st.setModelNumber(this.modelNumber, subModelNumber);
+               return st;
+       }
+
        /**
         * Get the name of the structure
         *

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