JAL-1025 JAL-1022 use File based equivalence to map between jalview
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Sun, 12 Feb 2012 14:49:42 +0000 (14:49 +0000)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Sun, 12 Feb 2012 14:49:42 +0000 (14:49 +0000)
string pdb handles and Jmol filenames

src/jalview/ext/jmol/JalviewJmolBinding.java
src/jalview/gui/AppJmol.java

index 0640b8c..38e58d8 100644 (file)
@@ -871,6 +871,7 @@ public abstract class JalviewJmolBinding implements StructureListener,
         // recover PDB filename for the model hovered over.\r
         pdbfilename = viewer\r
                 .getModelFileName(new Integer(mdlId).intValue() - 1);\r
+        \r
       } catch (Exception e)\r
       {\r
       }\r
@@ -1130,7 +1131,8 @@ public abstract class JalviewJmolBinding implements StructureListener,
           }\r
           else\r
           {\r
-            if (matches = pdbentry[pe].getFile().equals(fileName))\r
+            File fl;\r
+            if (matches = (fl=new File(pdbentry[pe].getFile())).equals(new File(fileName)))\r
             {\r
               foundEntry = true;\r
               // TODO: Jmol can in principle retrieve from CLASSLOADER but\r
@@ -1141,7 +1143,6 @@ public abstract class JalviewJmolBinding implements StructureListener,
               String protocol = AppletFormatAdapter.URL;\r
               try\r
               {\r
-                File fl = new java.io.File(pdbentry[pe].getFile());\r
                 if (fl.exists())\r
                 {\r
                   protocol = AppletFormatAdapter.FILE;\r
@@ -1151,9 +1152,10 @@ public abstract class JalviewJmolBinding implements StructureListener,
               } catch (Error e)\r
               {\r
               }\r
-              ;\r
+              //Explicitly map to the filename used by Jmol ;\r
               pdb = ssm.setMapping(sequence[pe], chains[pe],\r
-                      pdbentry[pe].getFile(), protocol);\r
+                      fileName, protocol);\r
+                      //pdbentry[pe].getFile(), protocol);\r
 \r
             }\r
           }\r
@@ -1164,7 +1166,7 @@ public abstract class JalviewJmolBinding implements StructureListener,
             {\r
               String chid = new String(pdb.id + ":"\r
                       + ((MCview.PDBChain) pdb.chains.elementAt(i)).id);\r
-              chainFile.put(chid, pdbentry[pe].getFile());\r
+              chainFile.put(chid, fileName);\r
               chainNames.addElement(chid);\r
             }\r
             notifyLoaded = true;\r
index 8d9d9f0..bd86275 100644 (file)
@@ -722,10 +722,11 @@ public class AppJmol extends GStructureViewer implements Runnable,
           {
             // just transfer the file name from the first sequence's first
             // PDBEntry
-            jmb.pdbentry[pi].setFile(file = ((PDBEntry) pdbseq
-                    .getSequenceAt(0).getPDBId().elementAt(0)).getFile());
+            file = new File(((PDBEntry) pdbseq
+                    .getSequenceAt(0).getPDBId().elementAt(0)).getFile()).toURI().getPath().substring(1);
+            jmb.pdbentry[pi].setFile(file);
             
-            files.append(" \"" + jalview.util.Platform.escapeString(file) + "\"");
+            files.append(" \"" + file + "\"");
           }
           else
           {
@@ -748,7 +749,7 @@ public class AppJmol extends GStructureViewer implements Runnable,
           }
           if (file != null)
           {
-            files.append(" \"" + jalview.util.Platform.escapeString(file) + "\"");
+            files.append(" \"" + file + "\"");
           }
         }
       }