JAL-1432 updated copyright notices
[jalview.git] / src / jalview / jbgui / GAlignFrame.java
index 49ab7c1..d991950 100755 (executable)
@@ -1,30 +1,52 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
+ * Copyright (C) 2014 The Jalview Authors
  * 
- * This program 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 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
  * 
- * This program 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.
+ * 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 this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ * 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.
  */
 package jalview.jbgui;
 
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.schemes.*;
+import jalview.schemes.ColourSchemeProperty;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
 
 public class GAlignFrame extends JInternalFrame
 {
@@ -114,6 +136,15 @@ public class GAlignFrame extends JInternalFrame
 
   protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
 
+  protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
+
+  protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+  // protected JRadioButtonMenuItem covariationColour = new
+  // JRadioButtonMenuItem();
+
+  protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem();
+
   JMenuItem njTreeBlosumMenuItem = new JMenuItem();
 
   JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();
@@ -122,7 +153,7 @@ public class GAlignFrame extends JInternalFrame
 
   public JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();
 
-  public JCheckBoxMenuItem showUnconservedMenuItem = new JCheckBoxMenuItem();
+  public JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem();
 
   JMenuItem htmlMenuItem = new JMenuItem();
 
@@ -147,9 +178,8 @@ public class GAlignFrame extends JInternalFrame
   public JCheckBoxMenuItem abovePIDThreshold = new JCheckBoxMenuItem();
 
   public JCheckBoxMenuItem showSeqFeatures = new JCheckBoxMenuItem();
-  public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
 
-  protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
+  public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
 
   JMenuItem deleteGroups = new JMenuItem();
 
@@ -196,7 +226,9 @@ public class GAlignFrame extends JInternalFrame
   JMenu jMenu2 = new JMenu();
 
   protected JCheckBoxMenuItem padGapsMenuitem = new JCheckBoxMenuItem();
+
   protected JCheckBoxMenuItem showNpFeatsMenuitem = new JCheckBoxMenuItem();
+
   protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem();
 
   protected ButtonGroup colours = new ButtonGroup();
@@ -209,16 +241,22 @@ public class GAlignFrame extends JInternalFrame
 
   protected JMenu showProducts = new JMenu();
 
-  public JMenuItem featureSettings = new JMenuItem();
+  public JMenuItem openFeatureSettings = new JMenuItem();
 
   JMenuItem fetchSequence = new JMenuItem();
 
   JMenuItem annotationColour = new JMenuItem();
 
+  protected JMenuItem rnahelicesColour = new JMenuItem();
+
   JMenuItem associatedData = new JMenuItem();
 
   protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
 
+  protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
+
+  protected JCheckBoxMenuItem listenToViewSelections = new JCheckBoxMenuItem();
+
   JMenu addSequenceMenu = new JMenu();
 
   JMenuItem addFromFile = new JMenuItem();
@@ -236,7 +274,7 @@ public class GAlignFrame extends JInternalFrame
   GridLayout gridLayout1 = new GridLayout();
 
   JMenu jMenu3 = new JMenu();
-  
+
   JMenuItem showAllSeqs = new JMenuItem();
 
   JMenuItem showAllColumns = new JMenuItem();
@@ -247,6 +285,12 @@ public class GAlignFrame extends JInternalFrame
 
   JMenuItem hideSelColumns = new JMenuItem();
 
+  JMenuItem hideAllButSelection = new JMenuItem();
+
+  JMenuItem hideAllSelection = new JMenuItem();
+
+  JMenuItem showAllhidden = new JMenuItem();
+
   protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem();
 
   JMenuItem invertColSel = new JMenuItem();
@@ -270,7 +314,7 @@ public class GAlignFrame extends JInternalFrame
   protected JCheckBoxMenuItem centreColumnLabelsMenuItem = new JCheckBoxMenuItem();
 
   protected JCheckBoxMenuItem followHighlightMenuItem = new JCheckBoxMenuItem();
-  
+
   protected JMenuItem gatherViews = new JMenuItem();
 
   protected JMenuItem expandViews = new JMenuItem();
@@ -278,13 +322,29 @@ public class GAlignFrame extends JInternalFrame
   JMenuItem pageSetup = new JMenuItem();
 
   JMenuItem alignmentProperties = new JMenuItem();
-  
+
   JMenu tooltipSettingsMenu = new JMenu();
 
-  private JMenuItem justifyLeftMenuItem=new JMenuItem();
+  private JMenuItem justifyLeftMenuItem = new JMenuItem();
+
+  private JMenuItem justifyRightMenuItem = new JMenuItem();
+
+  JMenu autoAnnMenu = new JMenu();
+
+  protected JCheckBoxMenuItem showGroupConsensus = new JCheckBoxMenuItem();
+
+  protected JCheckBoxMenuItem showGroupConservation = new JCheckBoxMenuItem();
+
+  protected JCheckBoxMenuItem showConsensusHistogram = new JCheckBoxMenuItem();
+
+  protected JCheckBoxMenuItem showSequenceLogo = new JCheckBoxMenuItem();
+
+  protected JCheckBoxMenuItem normaliseSequenceLogo = new JCheckBoxMenuItem();
+
+  protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
+
+  private JMenuItem grpsFromSelection = new JMenuItem();
 
-  private JMenuItem justifyRightMenuItem=new JMenuItem();
-  
   public GAlignFrame()
   {
     try
@@ -341,8 +401,7 @@ public class GAlignFrame extends JInternalFrame
             if (evt.isControlDown()
                     || SwingUtilities.isRightMouseButton(evt))
             {
-              radioItem
-                      .removeActionListener(radioItem.getActionListeners()[0]);
+              radioItem.removeActionListener(radioItem.getActionListeners()[0]);
 
               int option = JOptionPane.showInternalConfirmDialog(
                       jalview.gui.Desktop.desktop,
@@ -392,6 +451,9 @@ public class GAlignFrame extends JInternalFrame
     colours.add(PIDColour);
     colours.add(BLOSUM62Colour);
     colours.add(nucleotideColour);
+    colours.add(purinePyrimidineColour);
+    // colours.add(covariationColour);
+    colours.add(tcoffeeColour);
 
     setColourSelected(jalview.bin.Cache
             .getDefault("DEFAULT_COLOUR", "None"));
@@ -408,9 +470,6 @@ public class GAlignFrame extends JInternalFrame
 
       switch (index)
       {
-      case ColourSchemeProperty.NONE:
-        noColourmenuItem.setSelected(true);
-        break;
       case ColourSchemeProperty.CLUSTAL:
         clustalColour.setSelected(true);
 
@@ -465,10 +524,29 @@ public class GAlignFrame extends JInternalFrame
 
         break;
 
+      case ColourSchemeProperty.TCOFFEE:
+        tcoffeeColour.setSelected(true);
+        break;
+
+      case ColourSchemeProperty.PURINEPYRIMIDINE:
+        purinePyrimidineColour.setSelected(true);
+
+        break;
+      /*
+       * case ColourSchemeProperty.COVARIATION:
+       * covariationColour.setSelected(true);
+       * 
+       * break;
+       */
       case ColourSchemeProperty.USER_DEFINED:
         userDefinedColour.setSelected(true);
 
         break;
+      case ColourSchemeProperty.NONE:
+      default:
+        noColourmenuItem.setSelected(true);
+        break;
+
       }
     }
 
@@ -540,6 +618,15 @@ public class GAlignFrame extends JInternalFrame
                 invertSequenceMenuItem_actionPerformed(e);
               }
             });
+    grpsFromSelection.setText("Make Groups for selection");
+    grpsFromSelection.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        makeGrpsFromSelection_actionPerformed(e);
+      }
+    });
+
     remove2LeftMenuItem.setText("Remove Left");
     remove2LeftMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
             java.awt.event.KeyEvent.VK_L, Toolkit.getDefaultToolkit()
@@ -590,21 +677,23 @@ public class GAlignFrame extends JInternalFrame
               }
             });
     justifyLeftMenuItem.setText("Left Justify Alignment");
-    justifyLeftMenuItem.addActionListener(new java.awt.event.ActionListener()
-    {
-        public void actionPerformed(ActionEvent e)
-        {
-          justifyLeftMenuItem_actionPerformed(e);
-        }
-    });
+    justifyLeftMenuItem
+            .addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                justifyLeftMenuItem_actionPerformed(e);
+              }
+            });
     justifyRightMenuItem.setText("Right Justify Alignment");
-    justifyRightMenuItem.addActionListener(new java.awt.event.ActionListener()
-    {
-        public void actionPerformed(ActionEvent e)
-        {
-          justifyRightMenuItem_actionPerformed(e);
-        }
-    });
+    justifyRightMenuItem
+            .addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                justifyRightMenuItem_actionPerformed(e);
+              }
+            });
     viewBoxesMenuItem.setText("Boxes");
     viewBoxesMenuItem.setState(true);
     viewBoxesMenuItem.addActionListener(new java.awt.event.ActionListener()
@@ -623,15 +712,16 @@ public class GAlignFrame extends JInternalFrame
         viewTextMenuItem_actionPerformed(e);
       }
     });
-    showUnconservedMenuItem.setText("Show Unconserved");
-    showUnconservedMenuItem.setState(false);
-    showUnconservedMenuItem.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        showUnconservedMenuItem_actionPerformed(e);
-      }
-    });
+    showNonconservedMenuItem.setText("Show nonconserved");
+    showNonconservedMenuItem.setState(false);
+    showNonconservedMenuItem
+            .addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                showUnconservedMenuItem_actionPerformed(e);
+              }
+            });
     sortPairwiseMenuItem.setText("by Pairwise Identity");
     sortPairwiseMenuItem
             .addActionListener(new java.awt.event.ActionListener()
@@ -650,13 +740,14 @@ public class GAlignFrame extends JInternalFrame
       }
     });
     sortLengthMenuItem.setText("By Length");
-    sortLengthMenuItem.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        sortLengthMenuItem_actionPerformed(e);
-      }
-    });
+    sortLengthMenuItem
+            .addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                sortLengthMenuItem_actionPerformed(e);
+              }
+            });
     sortGroupMenuItem.setText("by Group");
     sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
@@ -810,6 +901,31 @@ public class GAlignFrame extends JInternalFrame
         BLOSUM62Colour_actionPerformed(e);
       }
     });
+    nucleotideColour.setText("Nucleotide");
+    nucleotideColour.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        nucleotideColour_actionPerformed(e);
+      }
+    });
+
+    purinePyrimidineColour.setText("Purine/Pyrimidine");
+    purinePyrimidineColour
+            .addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                purinePyrimidineColour_actionPerformed(e);
+              }
+            });
+    /*
+     * covariationColour.setText("Covariation");
+     * covariationColour.addActionListener(new java.awt.event.ActionListener() {
+     * public void actionPerformed(ActionEvent e) {
+     * covariationColour_actionPerformed(e); } });
+     */
+
     avDistanceTreeBlosumMenuItem.setText("Average Distance Using BLOSUM62");
     avDistanceTreeBlosumMenuItem
             .addActionListener(new java.awt.event.ActionListener()
@@ -962,14 +1078,12 @@ public class GAlignFrame extends JInternalFrame
         showSeqFeatures_actionPerformed(actionEvent);
       }
     });
-    showSeqFeaturesHeight.setText("Vary Sequence Feature Height");
-    showSeqFeaturesHeight.addActionListener(new ActionListener()
-    {
-      public void actionPerformed(ActionEvent actionEvent)
-      {
-        showSeqFeaturesHeight_actionPerformed(actionEvent);
-      }
-    });
+    /*
+     * showSeqFeaturesHeight.setText("Vary Sequence Feature Height");
+     * showSeqFeaturesHeight.addActionListener(new ActionListener() { public
+     * void actionPerformed(ActionEvent actionEvent) {
+     * showSeqFeaturesHeight_actionPerformed(actionEvent); } });
+     */
     showDbRefsMenuitem.setText("Show Database Refs");
     showDbRefsMenuitem.addActionListener(new ActionListener()
     {
@@ -978,7 +1092,7 @@ public class GAlignFrame extends JInternalFrame
       {
         showDbRefs_actionPerformed(e);
       }
-      
+
     });
     showNpFeatsMenuitem.setText("Show Non-Positional Features");
     showNpFeatsMenuitem.addActionListener(new ActionListener()
@@ -988,8 +1102,72 @@ public class GAlignFrame extends JInternalFrame
       {
         showNpFeats_actionPerformed(e);
       }
-      
+
+    });
+    showGroupConservation.setText("Group Conservation");
+    showGroupConservation.addActionListener(new ActionListener()
+    {
+
+      public void actionPerformed(ActionEvent e)
+      {
+        showGroupConservation_actionPerformed(e);
+      }
+
+    });
+
+    showGroupConsensus.setText("Group Consensus");
+    showGroupConsensus.addActionListener(new ActionListener()
+    {
+
+      public void actionPerformed(ActionEvent e)
+      {
+        showGroupConsensus_actionPerformed(e);
+      }
+
+    });
+    showConsensusHistogram.setText("Show Consensus Histogram");
+    showConsensusHistogram.addActionListener(new ActionListener()
+    {
+
+      public void actionPerformed(ActionEvent e)
+      {
+        showConsensusHistogram_actionPerformed(e);
+      }
+
+    });
+    showSequenceLogo.setText("Show Consensus Logo");
+    showSequenceLogo.addActionListener(new ActionListener()
+    {
+
+      public void actionPerformed(ActionEvent e)
+      {
+        showSequenceLogo_actionPerformed(e);
+      }
+
     });
+    normaliseSequenceLogo.setText("Normalise Consensus Logo");
+    normaliseSequenceLogo.addActionListener(new ActionListener()
+    {
+
+      public void actionPerformed(ActionEvent e)
+      {
+        normaliseSequenceLogo_actionPerformed(e);
+      }
+
+    });
+    applyAutoAnnotationSettings.setText("Apply to all groups");
+    applyAutoAnnotationSettings.setState(false);
+    applyAutoAnnotationSettings.setVisible(true);
+    applyAutoAnnotationSettings.addActionListener(new ActionListener()
+    {
+
+      public void actionPerformed(ActionEvent e)
+      {
+        applyAutoAnnotationSettings_actionPerformed(e);
+      }
+
+    });
+
     nucleotideColour.setText("Nucleotide");
     nucleotideColour.addActionListener(new java.awt.event.ActionListener()
     {
@@ -998,6 +1176,19 @@ public class GAlignFrame extends JInternalFrame
         nucleotideColour_actionPerformed(e);
       }
     });
+
+    tcoffeeColour.setText("T-Coffee scores");
+    tcoffeeColour.setEnabled(false);
+    tcoffeeColour.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        tcoffeeColorScheme_actionPerformed(e);
+      }
+    });
+
     deleteGroups.setText("Undefine groups");
     deleteGroups.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
             java.awt.event.KeyEvent.VK_U, Toolkit.getDefaultToolkit()
@@ -1118,6 +1309,7 @@ public class GAlignFrame extends JInternalFrame
         LoadtreeMenuItem_actionPerformed(e);
       }
     });
+
     scaleAbove.setVisible(false);
     scaleAbove.setText("Scale Above");
     scaleAbove.addActionListener(new java.awt.event.ActionListener()
@@ -1168,9 +1360,9 @@ public class GAlignFrame extends JInternalFrame
       {
         followHighlight_actionPerformed();
       }
-      
+
     });
-    
+
     modifyPID.setText("Modify Identity Threshold...");
     modifyPID.addActionListener(new java.awt.event.ActionListener()
     {
@@ -1264,7 +1456,7 @@ public class GAlignFrame extends JInternalFrame
       }
     });
     extractScores.setVisible(true); // JBPNote: TODO: make gui for regex based
-                                    // score extraction
+    // score extraction
     showProducts.setText("Get Cross References");
     /*
      * showProducts.addActionListener(new ActionListener() {
@@ -1272,8 +1464,8 @@ public class GAlignFrame extends JInternalFrame
      * public void actionPerformed(ActionEvent e) {
      * showProducts_actionPerformed(e); } });
      */
-    featureSettings.setText("Feature Settings...");
-    featureSettings.addActionListener(new ActionListener()
+    openFeatureSettings.setText("Feature Settings...");
+    openFeatureSettings.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
       {
@@ -1297,6 +1489,16 @@ public class GAlignFrame extends JInternalFrame
         annotationColour_actionPerformed(e);
       }
     });
+
+    rnahelicesColour.setText("By RNA helices");
+    rnahelicesColour.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        rnahelicesColour_actionPerformed(e);
+      }
+    });
+
     associatedData.setText("Load Features / Annotations");
     associatedData.addActionListener(new ActionListener()
     {
@@ -1315,6 +1517,31 @@ public class GAlignFrame extends JInternalFrame
         autoCalculate_actionPerformed(e);
       }
     });
+    sortByTree.setText("Sort Alignment With New Tree");
+    sortByTree
+            .setToolTipText("<html>Enable this to automatically sort<br>the alignment when you open<br> a new tree.");
+    sortByTree
+            .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false));
+    sortByTree.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        sortByTreeOption_actionPerformed(e);
+      }
+    });
+
+    listenToViewSelections.setText("Listen for selections");
+    listenToViewSelections
+            .setToolTipText("<html>When selected, selections in this view will mirror<br>selections made on the same sequences in other views.");
+    listenToViewSelections.setState(false);
+    listenToViewSelections.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        listenToViewSelections_actionPerformed(e);
+      }
+    });
+
     addSequenceMenu.setText("Add Sequences");
     addFromFile.setText("From File");
     addFromFile.addActionListener(new ActionListener()
@@ -1359,6 +1586,7 @@ public class GAlignFrame extends JInternalFrame
     statusPanel.setLayout(gridLayout1);
     jMenu3.setText("Show");
     showAllSeqs.setText("All Sequences");
+    showAllSeqs.setToolTipText("Shift+H toggles sequence visiblity.");
     showAllSeqs.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1367,6 +1595,7 @@ public class GAlignFrame extends JInternalFrame
       }
     });
     showAllColumns.setText("All Columns");
+    showAllColumns.setToolTipText("Ctrl+H toggles column visiblity.");
     showAllColumns.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1376,6 +1605,7 @@ public class GAlignFrame extends JInternalFrame
     });
     hideMenu.setText("Hide");
     hideSelSequences.setText("Selected Sequences");
+    hideSelSequences.setToolTipText("Shift+H toggles sequence visiblity.");
     hideSelSequences.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1384,6 +1614,7 @@ public class GAlignFrame extends JInternalFrame
       }
     });
     hideSelColumns.setText("Selected Columns");
+    hideSelColumns.setToolTipText("Ctrl+H toggles column visiblity.");
     hideSelColumns.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1391,6 +1622,34 @@ public class GAlignFrame extends JInternalFrame
         hideSelColumns_actionPerformed(e);
       }
     });
+    hideAllSelection.setText("Selected Region");
+    hideAllSelection.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        hideAllSelection_actionPerformed(e);
+      }
+    });
+    // TODO: should be hidden if no selection exists.
+    hideAllButSelection.setText("All but Selected Region (Shift+Ctrl+H)");
+    hideAllButSelection.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        hideAllButSelection_actionPerformed(e);
+      }
+    });
+    showAllhidden.setText("All Sequences and Columns");
+    showAllhidden
+            .setToolTipText("H toggles visibility of hidden or selected regions.");
+    showAllhidden.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        showAllhidden_actionPerformed(e);
+      }
+    });
+
     hiddenMarkers.setText("Show Hidden Markers");
     hiddenMarkers.addActionListener(new ActionListener()
     {
@@ -1524,6 +1783,7 @@ public class GAlignFrame extends JInternalFrame
       }
     });
     tooltipSettingsMenu.setText("Sequence ID Tooltip");
+    autoAnnMenu.setText("Autocalculated Annotation");
     alignFrameMenuBar.add(fileMenu);
     alignFrameMenuBar.add(editMenu);
     alignFrameMenuBar.add(selectMenu);
@@ -1564,9 +1824,10 @@ public class GAlignFrame extends JInternalFrame
     editMenu.add(removeRedundancyMenuItem);
     editMenu.addSeparator();
     // dont add these yet in the CVS build - they cannot be undone!
-    editMenu.add(justifyLeftMenuItem);
-    editMenu.add(justifyRightMenuItem);
-    editMenu.addSeparator();
+    // Excluded from Jalview 2.5 release - undo needs to be implemented.
+    // editMenu.add(justifyLeftMenuItem);
+    // editMenu.add(justifyRightMenuItem);
+    // editMenu.addSeparator();
     editMenu.add(padGapsMenuitem);
     viewMenu.add(newView);
     viewMenu.add(expandViews);
@@ -1577,11 +1838,19 @@ public class GAlignFrame extends JInternalFrame
     viewMenu.addSeparator();
     viewMenu.add(followHighlightMenuItem);
     viewMenu.add(annotationPanelMenuItem);
+    autoAnnMenu.add(applyAutoAnnotationSettings);
+    autoAnnMenu.add(showConsensusHistogram);
+    autoAnnMenu.add(showSequenceLogo);
+    autoAnnMenu.add(normaliseSequenceLogo);
+    autoAnnMenu.addSeparator();
+    autoAnnMenu.add(showGroupConservation);
+    autoAnnMenu.add(showGroupConsensus);
+    viewMenu.add(autoAnnMenu);
     viewMenu.addSeparator();
     viewMenu.add(showSeqFeatures);
-    viewMenu.add(showSeqFeaturesHeight);
-   
-    viewMenu.add(featureSettings);
+    // viewMenu.add(showSeqFeaturesHeight);
+
+    viewMenu.add(openFeatureSettings);
     tooltipSettingsMenu.add(showDbRefsMenuitem);
     tooltipSettingsMenu.add(showNpFeatsMenuitem);
     viewMenu.add(tooltipSettingsMenu);
@@ -1604,6 +1873,9 @@ public class GAlignFrame extends JInternalFrame
     colourMenu.add(turnColour);
     colourMenu.add(buriedColour);
     colourMenu.add(nucleotideColour);
+    colourMenu.add(purinePyrimidineColour);
+    // colourMenu.add(covariationColour);
+    colourMenu.add(tcoffeeColour);
     colourMenu.add(userDefinedColour);
     colourMenu.addSeparator();
     colourMenu.add(conservationMenuItem);
@@ -1611,6 +1883,7 @@ public class GAlignFrame extends JInternalFrame
     colourMenu.add(abovePIDThreshold);
     colourMenu.add(modifyPID);
     colourMenu.add(annotationColour);
+    colourMenu.add(rnahelicesColour);
     calculateMenu.add(sort);
     calculateMenu.add(calculateTree);
     calculateMenu.addSeparator();
@@ -1620,6 +1893,7 @@ public class GAlignFrame extends JInternalFrame
     calculateMenu.add(showTranslation);
     calculateMenu.add(showProducts);
     calculateMenu.add(autoCalculate);
+    calculateMenu.add(sortByTree);
     calculateMenu.addSeparator();
     calculateMenu.add(extractScores);
     webServiceNoServices = new JMenuItem("<No Services>");
@@ -1646,8 +1920,12 @@ public class GAlignFrame extends JInternalFrame
     this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
     jMenu3.add(showAllColumns);
     jMenu3.add(showAllSeqs);
+    jMenu3.add(showAllhidden);
     hideMenu.add(hideSelColumns);
     hideMenu.add(hideSelSequences);
+    hideMenu.add(hideAllSelection);
+    hideMenu.add(hideAllButSelection);
+
     formatMenu.add(font);
     formatMenu.addSeparator();
     formatMenu.add(wrapMenuItem);
@@ -1662,7 +1940,7 @@ public class GAlignFrame extends JInternalFrame
     formatMenu.add(colourTextMenuItem);
     formatMenu.add(renderGapsMenuItem);
     formatMenu.add(centreColumnLabelsMenuItem);
-    formatMenu.add(showUnconservedMenuItem);
+    formatMenu.add(showNonconservedMenuItem);
     selectMenu.add(findMenuItem);
     selectMenu.addSeparator();
     selectMenu.add(selectAllSequenceMenuItem);
@@ -1670,49 +1948,120 @@ public class GAlignFrame extends JInternalFrame
     selectMenu.add(invertSequenceMenuItem);
     selectMenu.add(invertColSel);
     selectMenu.add(deleteGroups);
+    selectMenu.add(grpsFromSelection);
+    // TODO - determine if the listenToViewSelections button is needed : see bug
+    // JAL-574
+    // selectMenu.addSeparator();
+    // selectMenu.add(listenToViewSelections);
+  }
+
+  protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void listenToViewSelections_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void showAllhidden_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void hideAllButSelection_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void hideAllSelection_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void showConsensusHistogram_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void showSequenceLogo_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void showGroupConsensus_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  protected void showGroupConservation_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+
   }
 
   protected void showUnconservedMenuItem_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub
-    
+
   }
 
   protected void showSeqFeaturesHeight_actionPerformed(
           ActionEvent actionEvent)
   {
     // TODO Auto-generated method stub
-    
+
   }
 
   protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub
-    
+
   }
 
   protected void justifyLeftMenuItem_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub
-    
+
   }
 
   protected void followHighlight_actionPerformed()
   {
     // TODO Auto-generated method stub
-    
+
   }
 
   protected void showNpFeats_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub
-    
+
   }
 
   protected void showDbRefs_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub
-    
+
   }
 
   protected void centreColumnLabels_actionPerformed(ActionEvent e)
@@ -1916,6 +2265,14 @@ public class GAlignFrame extends JInternalFrame
   {
   }
 
+  protected void purinePyrimidineColour_actionPerformed(ActionEvent e)
+  {
+  }
+
+  /*
+   * protected void covariationColour_actionPerformed(ActionEvent e) { }
+   */
+
   protected void noColourmenuItem_actionPerformed(ActionEvent e)
   {
   }
@@ -1999,6 +2356,33 @@ public class GAlignFrame extends JInternalFrame
 
   protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
   {
+
+  }
+
+  /**
+   * Template method to handle the 'load T-Coffee scores' menu event.
+   * <p>
+   * Subclasses override this method to provide a custom action.
+   * 
+   * @param event
+   *          The raised event
+   */
+  protected void loadScores_actionPerformed(ActionEvent event)
+  {
+
+  }
+
+  /**
+   * Template method to handle the 'Color T-Coffee scores' menu event.
+   * <p>
+   * Subclasses override this method to provide a custom action.
+   * 
+   * @param event
+   *          The raised event
+   */
+  protected void tcoffeeColorScheme_actionPerformed(ActionEvent event)
+  {
+
   }
 
   protected void jpred_actionPerformed(ActionEvent e)
@@ -2068,6 +2452,11 @@ public class GAlignFrame extends JInternalFrame
 
   }
 
+  public void rnahelicesColour_actionPerformed(ActionEvent e)
+  {
+
+  }
+
   public void associatedData_actionPerformed(ActionEvent e)
   {
 
@@ -2078,6 +2467,11 @@ public class GAlignFrame extends JInternalFrame
 
   }
 
+  public void sortByTreeOption_actionPerformed(ActionEvent e)
+  {
+
+  }
+
   public void showAllSeqs_actionPerformed(ActionEvent e)
   {