Merge branch 'features/JAL-2039_Offer_cached_structurefiles_immediately' into develop
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 11 Oct 2016 12:03:24 +0000 (13:03 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 11 Oct 2016 12:03:24 +0000 (13:03 +0100)
src/jalview/appletgui/AppletJmol.java
src/jalview/ext/jmol/JalviewJmolBinding.java
src/jalview/ext/jmol/JmolParser.java
src/jalview/gui/AppJmol.java
src/jalview/gui/Desktop.java
src/jalview/gui/Jalview2XML.java
src/jalview/ws/sifts/SiftsClient.java

index 264ac14..8374721 100644 (file)
@@ -64,8 +64,6 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.Vector;
 
-import org.jmol.util.Logger;
-
 public class AppletJmol extends EmbmenuFrame implements
 // StructureListener,
         KeyListener, ActionListener, ItemListener
@@ -271,7 +269,6 @@ public class AppletJmol extends EmbmenuFrame implements
       jmb.allocateViewer(renderPanel, true, ap.av.applet.getName()
               + "_jmol_", ap.av.applet.getDocumentBase(),
               ap.av.applet.getCodeBase(), "-applet", scriptWindow, null);
-      Logger.setLogLevel(Logger.LEVEL_WARN);
     } catch (Exception e)
     {
       System.err
index 2f3464b..a577559 100644 (file)
@@ -307,6 +307,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
        * 'matched' array will hold 'true' for visible alignment columns where
        * all sequences have a residue with a mapping to the PDB structure
        */
+      // TODO could use a BitSet for matched
       boolean matched[] = new boolean[alignment.getWidth()];
       for (int m = 0; m < matched.length; m++)
       {
@@ -352,6 +353,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
        * generate select statements to select regions to superimpose structures
        */
       {
+        // TODO extract method to construct selection statements
         for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
         {
           String chainCd = ":" + structures[pdbfnum].chain;
@@ -449,6 +451,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
       }
       if (selectioncom.length() > 0)
       {
+        // TODO is performing selectioncom redundant here? is done later on
         // System.out.println("Select regions:\n" + selectioncom.toString());
         evalStateCommand("select *; cartoons off; backbone; select ("
                 + selectioncom.toString() + "); cartoons; ");
index c73657f..5866d51 100644 (file)
@@ -124,12 +124,11 @@ public class JmolParser extends StructureFile implements JmolStatusListener
       try
       {
         /*
-         * params -o (output to sysout) -i (no info logging, less verbose)
-         * -n (nodisplay) -x (exit when finished)
+         * params -o (output to sysout) -n (nodisplay) -x (exit when finished)
          * see http://wiki.jmol.org/index.php/Jmol_Application
          */
         viewer = (Viewer) JmolViewer.allocateViewer(null, null, null, null,
-                null, "-x -o -n -i", this);
+                null, "-x -o -n", this);
         // ensure the 'new' (DSSP) not 'old' (Ramachandran) SS method is used
         viewer.setBooleanProperty("defaultStructureDSSP", true);
       } catch (ClassCastException x)
index 24604ed..021a004 100644 (file)
@@ -381,10 +381,7 @@ public class AppJmol extends StructureViewerBase
       scriptWindow.setVisible(false);
     }
 
-    /*
-     * -i for no info logging (less verbose)
-     */
-    jmb.allocateViewer(renderPanel, true, "", null, null, "-i",
+    jmb.allocateViewer(renderPanel, true, "", null, null, "",
             scriptWindow, null);
     // jmb.newJmolPopup("Jmol");
     if (command == null)
index f99af34..1d76f27 100644 (file)
@@ -941,6 +941,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   public void drop(DropTargetDropEvent evt)
   {
     boolean success = true;
+    // JAL-1552 - acceptDrop required before getTransferable call for
+    // Java's Transferable for native dnd
+    evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
     Transferable t = evt.getTransferable();
     java.util.List<String> files = new ArrayList<String>();
     java.util.List<String> protocols = new ArrayList<String>();
index 9a8e5f6..a4e5785 100644 (file)
@@ -3018,7 +3018,8 @@ public class Jalview2XML
                 entry.setType(PDBEntry.Type.FILE);
               }
             }
-            if (ids[p].getFile() != null)
+            // jprovider is null when executing 'New View'
+            if (ids[p].getFile() != null && jprovider != null)
             {
               if (!pdbloaded.containsKey(ids[p].getFile()))
               {
index fb59071..e85edd2 100644 (file)
@@ -390,8 +390,8 @@ public class SiftsClient implements SiftsClientI
           String pdbFile, String chain) throws SiftsException
   {
     structId = (chain == null) ? pdbId : pdbId + "|" + chain;
-    System.out.println("Getting mapping for: " + pdbId + "|" + chain
-            + " : seq- " + seq.getName());
+    System.out.println("Getting SIFTS mapping for " + structId + ": seq "
+            + seq.getName());
 
     final StringBuilder mappingDetails = new StringBuilder(128);
     PrintStream ps = new PrintStream(System.out)
@@ -470,12 +470,14 @@ public class SiftsClient implements SiftsClientI
     int pdbStart = UNASSIGNED;
     int pdbEnd = UNASSIGNED;
 
-    Integer[] keys = mapping.keySet().toArray(new Integer[0]);
-    Arrays.sort(keys);
-    if (keys.length < 1)
+    if (mapping.isEmpty())
     {
-      throw new SiftsException(">>> Empty SIFTS mapping generated!!");
+      throw new SiftsException(
+              "SIFTS mapping failed - falling back on Needleman-Wunsch");
     }
+
+    Integer[] keys = mapping.keySet().toArray(new Integer[0]);
+    Arrays.sort(keys);
     seqStart = keys[0];
     seqEnd = keys[keys.length - 1];