JAL-1528 Chimera Help doc + fixes to setting colours
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 14 Nov 2014 12:53:45 +0000 (12:53 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 17 Nov 2014 10:38:52 +0000 (10:38 +0000)
help/help.jhm
help/helpTOC.xml
help/html/features/chimera.html [new file with mode: 0644]
help/html/features/jmol.html
help/html/features/preferences.html
help/html/features/viewingpdbs.html
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
src/jalview/gui/ChimeraViewFrame.java
src/jalview/gui/JalviewChimeraBindingModel.java
src/jalview/jbgui/GStructureViewer.java

index 7750265..c6cc626 100755 (executable)
@@ -52,6 +52,7 @@
    <mapID target="viewingpdbs.reps" url="html/features/viewingpdbs.html#viewreps"/>
    <mapID target="pdbmcviewer" url="html/features/pdbviewer.html"/>
    <mapID target="pdbjmol" url="html/features/jmol.html"/>
+   <mapID target="chimera" url="html/features/chimera.html"/>
    <mapID target="varna" url="html/features/varna.html"/>
    <mapID target="preferences" url="html/features/preferences.html"/>     
    <mapID target="commandline" url="html/features/commandline.html"/>
index 4c09e8f..6ae5c78 100755 (executable)
         </tocitem>
        <tocitem text="Viewing PDB Files" target="viewingpdbs" expand="false">
          <tocitem text="Jmol Viewer" target="pdbjmol"/>
+         <tocitem text="Chimera Viewer" target="chimera"/>
          <tocitem text="Simple PDB Viewer" target="pdbmcviewer"/>
        </tocitem>
        <tocitem text="Viewing RNA structures" target="varna" expand="false">   </tocitem>
diff --git a/help/html/features/chimera.html b/help/html/features/chimera.html
new file mode 100644 (file)
index 0000000..e866597
--- /dev/null
@@ -0,0 +1,172 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>The Chimera PDB Viewer</title>
+</head>
+<body>
+<p><strong>The Chimera Viewer</strong></p>
+<p>Since Jalview 2.8.2, <a href="https://www.cgl.ucsf.edu/chimera/">Chimera</a>
+has been integrated into Jalview for interactively viewing structures
+opened by entries in the <strong>&quot;Structure&quot;</strong> submenu in the <a href="../menus/popupMenu.html">sequence
+id pop-up menu</a> (if you can't see this, then you need to <a
+       href="viewingpdbs.html">associate a PDB structure</a> with the
+sequence). Chimera is available from the Jalview desktop, provided Chimera has been separately installed.</p>
+<p>You can set a default choice of Jmol or Chimera structure viewer in <a href="preferences.html#structure"> Preferences</a>. 
+You can also optionally specify the path to the Chimera program here (if it differs from the standard paths searched by Jalview).
+<p>The following menu entries are provided for viewing structure data<br>
+  <ul>
+    <li>The <strong>&quot;Structure&#8594;View
+        Structure&#8594;</strong> submenu allows a single PDB structure to be chosen
+      for display from the available structures for a sequence.
+    </li>
+    <li>The <strong>&quot;Structure&#8594;View all <em>N</em>
+        structures
+    </strong> option will open a new window containing all structures associated
+      with the current selection.
+    </li>
+    <li>The <strong>&quot;Structure&#8594;View all <em>N</em>
+        representative structures
+    </strong> option will open a new window containing exactly one structure per
+      currently selected sequence.<br /></li>
+  </ul>
+  <br> 
+</p>
+<p><a name="align"><strong>Superposing structures based
+on their aligned sequences</strong></a><br>
+<p>If several structures are available on the alignment, you may add
+additional structures to an existing Chimera view by selecting their entry
+in the appropriate pop-up menu. Jalview will ask you if you wish to add
+the structure to the existing alignment, and if you do, it will import
+and superimpose the new PDB file using the corresponding positions from
+the alignment. If the alignment is subsequently edited, you can use the
+<a href="#sAlign"><em>Chimera&#8594;Align</em></a> menu option from the
+menu bar of the structure view window to superpose the structures using
+the updated alignment.<br>
+</p>
+<p><strong>Chimera Controls</strong><br>
+<p>The structure is by default rendered as a ribbon diagram. Moving the
+mouse over the structure brings up tooltips giving the residue name, PDB
+residue number and chain code
+([RES]Num:Chain). Moving the mouse over an
+associated residue in an alignment window highlights the associated
+atoms in the displayed structures. For comprehensive details of Chimera's commands, refer to the tool's Help menu.</p>
+<p>Basic screen operations (see <a href="https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/mouse.html">Chimera help</a> for full details).
+<table border="1">
+       <tr>
+               <td><strong>Action</strong></td>
+               <td><strong>Windows</strong></td>
+               <td><strong>Unix</strong></td>
+               <td><strong>Mac/OSX</strong></td>
+       </tr>
+       <tr>
+               <td>Rotate View</td>
+               <td>Left Click and Drag</td>
+               <td>Left Click and Drag</td>
+               <td>Left Click and Drag</td>
+       </tr>
+       <tr>
+               <td>Zoom</td><td>Right Click<br>
+               drag mouse up or down</td>
+               <td>Right Click<br>drag mouse up or down</td>
+               <td>cmd or Right + Click and drag mouse up or down, <br>or use mouse scroll button</td>
+       </tr>
+       <tr>
+               <td>Move Origin</td>
+               <td>Middle Button + Drag</td>
+               <td>Middle Button and drag</td>
+               <td>alt + Click<br>
+               and drag</td>
+       </tr>
+</table>
+</p>
+<p><strong>Jalview Controls</strong>
+<p>The Jalview Chimera View window has up to five menus:
+<ul>
+       <li><Strong>File<br>
+       </strong>
+       <ul>
+               <li><strong>View Mapping<br>
+               </strong><em> Opens a text window showing the alignment between the
+               residues corresponding to alpha-carbon atoms in the PDB structure and
+               the residues in the associated sequence.</em></li>
+       </ul>
+       </li>
+       <li><strong>View</strong>
+       <ul>
+               <li><strong>Show Chains<br>
+               </strong><em>Select which of the PDB file's chains (if more than one) are to be displayed.</em></li>
+               <li><strong>Colour by ..<br></strong><em>Submenu allowing specific alignment views to be selected for colouring associated chains in the structure display. This menu contains all the alignment views associated with the structure view, with those used to colour the view indicated by ticks. Addditionally, it contains the following menu entries:</em>
+               <ul><li><strong>Select many views<br></strong><em>When this option is enabled, selecting an alignment view adds it to the set used to colour the structures. Use this when colouring structures related to a number of alignments involving different domains or chains which are shown in the same structure view.</em>
+               </li>
+    <li><strong>Select all views<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will add all associated views to the set used to colour the structure display.</em>
+  </li>
+    <li><strong>Invert selection<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will replace the current set of views with any remaining views not currently used to colour the structure display.</em>
+  </li></ul></li></ul>
+       <li><strong>Colours<br>
+       </strong>
+       <ul>
+               <li><strong>By Sequence<br>
+               </strong><em> Colours each residue in the structure with the colour of its
+               corresponding residue in the associated sequence as rendered in the
+               associated alignment views, including any Uniprot sequence features or
+               region colourings.<br/>Pick which of the associated alignment views are used to colour the structures using the <strong>View&#8594;Colour by ..</strong> sub menu.</em><br>
+               Residues which only exist in the PDB structure are coloured white if
+               they are insertions (relative to the associated sequence in the
+               alignment) and grey if they are N or C terminal flanks outside the
+               region mapped to the alignment window's sequence.</em></li>
+               <li><strong>Charge &amp; Cysteine<br>
+               </strong><em> Highlights cysteines in yellow, anionic (Aspartic Acid or
+               Glutamic Acid) residues in red, and cationic (Lysine or Arginine)
+               residues in blue.</em></li>
+               <li><strong>Colour with Chimera<br></strong><em>Defers any colouring operations to Chimera. Select this if you want to use the 
+               Chimera scripting interface or menu to modify the view directly.</em></li>
+               <li><strong>Standard and User Defined Jalview
+               colourschemes.<br>
+               </strong><em>The remaining entries apply the colourschemes available from
+               the standard and user defined <a href="../colourSchemes/index.html">amino
+               acid colours</a>.</em></li>
+       </ul>
+       </li>
+       <li><strong>Chimera<br>
+       </strong><em>This pulldown menu is only displayed if there are multiple
+       structures shown in the Chimera window, and Jalview can also locate at
+       least two of the structures in the currently associated alignment view.</em>
+       <ul>
+               <li><strong><a name="sAlign">Align</a> <br>
+               </strong><em> When selected, the associated alignment will be used to
+               superimpose all the structures in the view onto the first structure in
+               the alignment. The regions used to calculate the superposition will be
+               highlighted using the 'Cartoon' rendering style, and the remaining
+               data shown as a chain trace.<br></em></li>
+       </ul>
+       </li>
+       <li><strong>Help<br>
+       </strong>
+       <ul>
+               <li><strong>Chimera Help<br>
+               </strong><em>Access the Chimera Help documentation in a new browser window.</em></li>
+       </ul>
+       </li>
+</ul>
+</p>
+</body>
+</html>
index 5102679..45e5526 100644 (file)
@@ -79,7 +79,7 @@ atoms in the displayed structures.</p>
 and alpha carbon location. Double clicking an atom allows distances to
 be measured from it to any other atom in the structure.</p>
 <p>
-<table>
+<table border="1">
        <tr>
                <td><strong>Action</strong></td>
                <td><strong>Windows</strong></td>
@@ -162,7 +162,7 @@ be measured from it to any other atom in the structure.</p>
     <li><strong>Select all views<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will add all associated views to the set used to colour the structure display.</em>
   </li>
     <li><strong>Invert selection<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will replace the current set of views with any remaining views not currently used to colour the structure display.</em>
-  </li></ul></li>
+  </li></ul></li></ul>
        <li><strong>Colours<br>
        </strong>
        <ul>
index 1831c3e..b2d8b93 100755 (executable)
@@ -121,6 +121,8 @@ annotation will be shown on the alignment when available.
 <p><em>Add Temperature Factor annotation to alignment</em> - if selected, PDB Temperature Factor
 annotation will be shown on the alignment when available. 
 <p><em>Default structure viewer</em> - choose JMOL or CHIMERA for viewing 3D structures. 
+<p><em>Path to Chimera program</em> - Optional, as Jalview will search standard installation paths for Windows, Linux or MacOS. 
+If you have installed Chimera in a non-standard location, you can specify it here. Enter the full path to the Chimera executable program.  
 
 <p><a name="connections"><strong>&quot;Connections&quot;
 Preferences tab</strong></a></p>
index 1f49498..8fc557e 100755 (executable)
@@ -28,6 +28,9 @@
 <p>Jalview can view protein structures associated with a sequence
 via the <strong>"Structure&rarr;"</strong> submenu from a
 sequence's <a href="../menus/popupMenu.html">pop-up menu</a>.</p>
+A <a href="jmol.html">Jmol viewer</a> has been included since Jalview 2.3. Jalview 2.8.2 added support for <a href="https://www.cgl.ucsf.edu/chimera/">Chimera</a>,
+provided this has been separately installed. Choice of default viewer is configurable in the Preferences <a href="preferences.html#structure">Structure tab</a>. 
+  
 <p>The following menu entries are provided for viewing structure data<br>
   <ul>
     <li>The <strong>&quot;Structure&#8594;View
@@ -40,14 +43,13 @@ sequence's <a href="../menus/popupMenu.html">pop-up menu</a>.</p>
       with the current selection, superposed according to the currently selected region of the alignment.<br/><em>This
       capability was added in Jalview 2.7</em>
     </li>
-    <li><a name="viewreps"/>The <strong>&quot;Structure&#8594;View all <em>N</em>
+    <li>The <strong>&quot;Structure&#8594;View all <em>N</em>
         representative structures
     </strong> option will open a new window containing exactly one structure per
       currently selected sequence.<br />
     <em>The View representative structures option was introduced in
         Jalview 2.8.1</em></li>
   </ul>
-  <br> 
 </p>
 
 <p>If a single pdb
@@ -55,19 +57,19 @@ structure is selected, one of the following will happen:</p>
 
 <ul>
        <li>If no structures are open, then an interactive display of the
-       structure will be opened in a new window</li>
+       structure will be opened in a new window.</li>
 
        <li>If another structure is already shown for the current
        alignment, then you will be asked if you want to add and <a
                href="jmol.html#align">align this structure</a> to the structure in
-       the existing view. (<em>new feature in Jalview 2.6</em>)</li>
+       the existing view. (<em>new feature in Jalview 2.6</em>).</li>
 
        <li>If the structure is already shown, then you will be prompted
        to associate the sequence with an existing view of the selected
        structure. This is useful when working with multi-domain or multi-chain PDB files.</li>
 
        <li style="list-style: none">See the <a href="jmol.html">Jmol
-       PDB viewer</a> help page for more information about the display.</li>
+       </a> and <a href="chimera.html">Chimera</a> PDB viewer help pages for more information about the display.</li>
 </ul>
        <p><strong>Associating PDB files with Sequences</strong></p>
        <p>To associate PDB files with a sequence, right click on a sequence
index 7033ba7..090b61d 100644 (file)
@@ -74,13 +74,14 @@ public abstract class JalviewChimeraBinding extends
   private boolean loadingFromArchive = false;
 
   /**
-   * second flag to indicate if the jmol viewer should ignore sequence colouring
-   * events from the structure manager because the GUI is still setting up
+   * second flag to indicate if the Chimera viewer should ignore sequence
+   * colouring events from the structure manager because the GUI is still
+   * setting up
    */
   private boolean loadingFinished = true;
 
   /**
-   * state flag used to check if the Jmol viewer's paint method can be called
+   * state flag used to check if the Chimera viewer's paint method can be called
    */
   private boolean finishedInit = false;
 
@@ -173,7 +174,7 @@ public abstract class JalviewChimeraBinding extends
         } catch (Error e)
         {
         }
-        // Explicitly map to the filename used by Jmol ;
+        // Explicitly map to the filename used by Chimera ;
         // pdbentry[pe].getFile(), protocol);
 
         if (ssm != null)
@@ -236,13 +237,6 @@ public abstract class JalviewChimeraBinding extends
     }
     viewer = new ChimeraManager(
             csm = new ext.edu.ucsf.rbvi.strucviz2.StructureManager(true));
-    /*
-     * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(),
-     * "jalviewJmol", ap.av.applet .getDocumentBase(),
-     * ap.av.applet.getCodeBase(), "", this);
-     * 
-     * jmolpopup = JmolPopup.newJmolPopup(viewer, true, "Jmol", true);
-     */
   }
 
   public JalviewChimeraBinding(StructureSelectionManager ssm,
@@ -335,15 +329,13 @@ public abstract class JalviewChimeraBinding extends
     {
       viewer.exitChimera();
     }
-    // viewer.evalStringQuiet("zap");
-    // viewer.setJmolStatusListener(null);
     lastCommand = null;
     viewer = null;
     releaseUIResources();
   }
 
   /**
-   * called by JalviewJmolbinding after closeViewer is called - release any
+   * called by JalviewChimerabinding after closeViewer is called - release any
    * resources and references so they can be garbage collected.
    */
   protected abstract void releaseUIResources();
@@ -351,17 +343,16 @@ public abstract class JalviewChimeraBinding extends
   public void colourByChain()
   {
     colourBySequence = false;
-    // TODO: colour by chain should colour each chain distinctly across all
-    // visible models
-    // TODO: http://issues.jalview.org/browse/JAL-628
+    // this is not a valid Chimera command; is there one? Menu option hidden
     evalStateCommand("select *;color chain",false);
   }
 
   public void colourByCharge()
   {
     colourBySequence = false;
-    evalStateCommand("colour *;color white;select ASP,GLU;color red;"
-            + "select LYS,ARG;color blue;select CYS;color yellow", false);
+    evalStateCommand(
+            "color white;color red ::ASP;color red ::GLU;color blue ::LYS;color blue ::ARG;color yellow ::CYS",
+            false);
   }
 
   /**
@@ -411,7 +402,7 @@ public abstract class JalviewChimeraBinding extends
     assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length);
     StringBuilder allComs = new StringBuilder(128); // Chimera superposition cmd
     String[] files = getPdbFile();
-    // check to see if we are still waiting for Jmol files
+    // check to see if we are still waiting for Chimera files
     long starttime = System.currentTimeMillis();
     boolean waiting = true;
     do
@@ -1225,10 +1216,13 @@ public abstract class JalviewChimeraBinding extends
     String res;
     int index;
     Color col;
+    // Chimera expects RBG values in the range 0-1
+    final double normalise = 255D;
     viewerCommandHistory(false);
     // TODO: Switch between nucleotide or aa selection expressions
     Enumeration en = ResidueProperties.aa3Hash.keys();
-    StringBuffer command = new StringBuffer("select *;color white;");
+    StringBuilder command = new StringBuilder(128);
+    command.append("color white;");
     while (en.hasMoreElements())
     {
       res = en.nextElement().toString();
@@ -1239,32 +1233,19 @@ public abstract class JalviewChimeraBinding extends
       }
 
       col = cs.findColour(ResidueProperties.aa[index].charAt(0));
-      // TODO: need colour string function and res selection here
-      command.append("select " + res + ";color[" + col.getRed() + ","
-              + col.getGreen() + "," + col.getBlue() + "];");
+      command.append("color " + col.getRed() / normalise + ","
+              + col.getGreen() / normalise + "," + col.getBlue()
+              / normalise + " ::" + res + ";");
     }
 
     evalStateCommand(command.toString(),false);
     viewerCommandHistory(true);
   }
 
-  public void showHelp()
-  {
-    // chimera help
-    showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp");
-  }
-
   /**
-   * open the URL somehow
-   * 
-   * @param target
-   */
-  public abstract void showUrl(String url, String target);
-
-  /**
-   * called when the binding thinks the UI needs to be refreshed after a Jmol
+   * called when the binding thinks the UI needs to be refreshed after a Chimera
    * state change. this could be because structures were loaded, or because an
-   * error has occured.
+   * error has occurred.
    */
   public abstract void refreshGUI();
 
@@ -1293,8 +1274,8 @@ public abstract class JalviewChimeraBinding extends
 
   /**
    * 
-   * @return true if Jmol is still restoring state or loading is still going on
-   *         (see setFinsihedLoadingFromArchive)
+   * @return true if Chimeral is still restoring state or loading is still going
+   *         on (see setFinsihedLoadingFromArchive)
    */
   public boolean isLoadingFromArchive()
   {
@@ -1312,13 +1293,22 @@ public abstract class JalviewChimeraBinding extends
     loadingFinished = finishedLoading;
   }
 
-  public void setBackgroundColour(java.awt.Color col)
+  /**
+   * Send the Chimera 'background solid <color>" command.
+   * 
+   * @see https
+   *      ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/background
+   *      .html
+   * @param col
+   */
+  public void setBackgroundColour(Color col)
   {
     viewerCommandHistory(false);
-    // todo set background colour
-    viewer.sendChimeraCommand(
-            "background [" + col.getRed() + "," + col.getGreen() + ","
-                    + col.getBlue() + "];", false);
+    double normalise = 255D;
+    final String command = "background solid " + col.getRed() / normalise + ","
+            + col.getGreen() / normalise + "," + col.getBlue()
+            / normalise + ";";
+    viewer.sendChimeraCommand(command, false);
     viewerCommandHistory(true);
   }
 
index 3c53762..cfac4ef 100644 (file)
@@ -144,6 +144,12 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable,
       _alignwith = new Vector<AlignmentPanel>();
     }
 
+    // no colour by chain command in Chimera?
+    chainColour.setVisible(false);
+
+    // save As not yet implemented
+    savemenu.setVisible(false);
+
     ViewSelectionMenu seqColourBy = new ViewSelectionMenu(
             MessageManager.getString("label.colour_by"), this, _colourwith,
             new ItemListener()
index c582c5d..f68b585 100644 (file)
@@ -94,11 +94,4 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding
     // TODO Auto-generated method stub
 
   }
-
-  @Override
-  public void showUrl(String url, String target)
-  {
-    // TODO Auto-generated method stub
-
-  }
 }
index 7e1be58..58b2eb1 100644 (file)
@@ -283,7 +283,7 @@ public class GStructureViewer extends JInternalFrame
 
   JMenu fileMenu = new JMenu();
 
-  JMenu savemenu = new JMenu();
+  protected JMenu savemenu = new JMenu();
 
   JMenuItem pdbFile = new JMenuItem();