From: Jim Procter Date: Sun, 12 Feb 2012 14:49:42 +0000 (+0000) Subject: JAL-1025 JAL-1022 use File based equivalence to map between jalview X-Git-Tag: Archived_Release_2_7~11 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=11a49ff3022aff104f294e3365659ef388b38015;p=jalview.git JAL-1025 JAL-1022 use File based equivalence to map between jalview string pdb handles and Jmol filenames --- diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 0640b8c..38e58d8 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -871,6 +871,7 @@ public abstract class JalviewJmolBinding implements StructureListener, // recover PDB filename for the model hovered over. pdbfilename = viewer .getModelFileName(new Integer(mdlId).intValue() - 1); + } catch (Exception e) { } @@ -1130,7 +1131,8 @@ public abstract class JalviewJmolBinding implements StructureListener, } else { - if (matches = pdbentry[pe].getFile().equals(fileName)) + File fl; + if (matches = (fl=new File(pdbentry[pe].getFile())).equals(new File(fileName))) { foundEntry = true; // TODO: Jmol can in principle retrieve from CLASSLOADER but @@ -1141,7 +1143,6 @@ public abstract class JalviewJmolBinding implements StructureListener, String protocol = AppletFormatAdapter.URL; try { - File fl = new java.io.File(pdbentry[pe].getFile()); if (fl.exists()) { protocol = AppletFormatAdapter.FILE; @@ -1151,9 +1152,10 @@ public abstract class JalviewJmolBinding implements StructureListener, } catch (Error e) { } - ; + //Explicitly map to the filename used by Jmol ; pdb = ssm.setMapping(sequence[pe], chains[pe], - pdbentry[pe].getFile(), protocol); + fileName, protocol); + //pdbentry[pe].getFile(), protocol); } } @@ -1164,7 +1166,7 @@ public abstract class JalviewJmolBinding implements StructureListener, { String chid = new String(pdb.id + ":" + ((MCview.PDBChain) pdb.chains.elementAt(i)).id); - chainFile.put(chid, pdbentry[pe].getFile()); + chainFile.put(chid, fileName); chainNames.addElement(chid); } notifyLoaded = true; diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index 8d9d9f0..bd86275 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -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 + "\""); } } }