resolve pdb id/chain to pdb file/model number and chain
authorjprocter <Jim Procter>
Sun, 19 Sep 2010 22:37:25 +0000 (22:37 +0000)
committerjprocter <Jim Procter>
Sun, 19 Sep 2010 22:37:25 +0000 (22:37 +0000)
src/jalview/ext/jmol/JalviewJmolBinding.java

index 09303c7..916579f 100644 (file)
@@ -79,6 +79,7 @@ public abstract class JalviewJmolBinding implements StructureListener,
   Vector atomsPicked = new Vector();
 
   public Vector chainNames;
+  Hashtable chainFile;
 
   /**
    * array of target chains for seuqences - tied to pdbentry and sequence[]
@@ -210,8 +211,9 @@ public abstract class JalviewJmolBinding implements StructureListener,
         p = mlength;
         mlength = lbl.indexOf(":", p);
       } while (p < mlength && mlength < (lbl.length() - 2));
-      cmd.append(":" + lbl.substring(mlength + 1) + " /"
-              + getModelNum(lbl.substring(0, mlength)) + " or ");
+      // TODO: lookup each pdb id and recover proper model number for it.
+      cmd.append(":" +  lbl.substring(mlength + 1) + " /"
+              + (1+getModelNum((String)chainFile.get(lbl))) + " or ");
     }
     if (cmd.length() > 0)
       cmd.setLength(cmd.length() - 4);
@@ -543,7 +545,7 @@ public abstract class JalviewJmolBinding implements StructureListener,
 
               Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);
 
-              if (showFeatures)
+              if (showFeatures && fr!=null)
                 col = fr.findFeatureColour(col, sequence[pdbfnum][s], r);
               String newSelcom = (mapping[m].getChain() != " " ? ":"
                       + mapping[m].getChain() : "")
@@ -1051,6 +1053,7 @@ public abstract class JalviewJmolBinding implements StructureListener,
     String[] oldmodels = modelFileNames;
     modelFileNames = null;
     chainNames = new Vector();
+    chainFile = new Hashtable();
     boolean notifyLoaded = false;
     String[] modelfilenames = getPdbFile();
     ssm = StructureSelectionManager.getStructureSelectionManager();
@@ -1160,8 +1163,10 @@ public abstract class JalviewJmolBinding implements StructureListener,
             // add an entry for every chain in the model
             for (int i = 0; i < pdb.chains.size(); i++)
             {
-              chainNames.addElement(new String(pdb.id + ":"
-                      + ((MCview.PDBChain) pdb.chains.elementAt(i)).id));
+              String chid = new String(pdb.id + ":"
+                      + ((MCview.PDBChain) pdb.chains.elementAt(i)).id);
+              chainFile.put(chid, pdbentry[pe].getFile());
+              chainNames.addElement(chid);
             }
             notifyLoaded = true;
           }