JAL-1025 JAL-1022 use File based equivalence to map between jalview
[jalview.git] / src / jalview / gui / AppJmol.java
index 5c5e3e8..bd86275 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -236,7 +236,7 @@ public class AppJmol extends GStructureViewer implements Runnable,
    * @param ap
    */
   public AppJmol(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
-          AlignmentPanel ap)
+          final AlignmentPanel ap)
   {
     progressBar = ap.alignFrame;
     // ////////////////////////////////
@@ -271,7 +271,7 @@ public class AppJmol extends GStructureViewer implements Runnable,
         {
           if (frames[i] instanceof AppJmol)
           {
-            AppJmol topJmol = ((AppJmol) frames[i]);
+            final AppJmol topJmol = ((AppJmol) frames[i]);
             // JBPNOTE: this looks like a binding routine, rather than a gui
             // routine
             for (int pe = 0; pe < topJmol.jmb.pdbentry.length; pe++)
@@ -280,7 +280,10 @@ public class AppJmol extends GStructureViewer implements Runnable,
               {
                 topJmol.jmb.addSequence(pe, seq);
                 topJmol.addAlignmentPanel(ap);
+                // add it to the set used for colouring
+                topJmol.useAlignmentPanelForColourbyseq(ap);
                 topJmol.buildJmolActionMenu();
+                ap.getStructureSelectionManager().sequenceColoursChanged(ap);
                 break;
               }
             }
@@ -318,7 +321,6 @@ public class AppJmol extends GStructureViewer implements Runnable,
     openNewJmol(ap, new PDBEntry[] { pdbentry }, new SequenceI[][] { seq });
   }
   private void openNewJmol(AlignmentPanel ap, PDBEntry[] pdbentrys, SequenceI[][] seqs) {
-    boolean promptUser=pdbentrys.length==1;
     progressBar = ap.alignFrame;
     jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(), pdbentrys, seqs, null, null);
     addAlignmentPanel(ap);
@@ -332,24 +334,11 @@ public class AppJmol extends GStructureViewer implements Runnable,
     setSize(400, 400); // probably should be a configurable/dynamic default here
     initMenus();
     worker=null;
-    String filelist="";
-//    for (PDBEntry pe: pdbentrys)
-//    {
-//      if (pe.getFile()==null)
       {
         addingStructures = false;
         worker = new Thread(this);
         worker.start();
-//        break;
       }
-//      filelist+=" \""+pe.getFile()+"\"";
-              
-/*    }
-    if (worker==null)
-    {
-      initJmol("load"+(pdbentrys.length>1 ? " APPEND" : "") + filelist);
-    }
-*/
     this.addInternalFrameListener(new InternalFrameAdapter()
     {
       public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
@@ -733,8 +722,10 @@ 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(" \"" + file + "\"");
           }
           else