JAL-2629 refactoring of Hmmer preferences
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 19 Feb 2018 17:04:07 +0000 (17:04 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 19 Feb 2018 17:04:07 +0000 (17:04 +0000)
resources/lang/Messages.properties
src/jalview/gui/AlignFrame.java
src/jalview/gui/Preferences.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/jbgui/GPreferences.java

index b5547cb..d9cfc6d 100644 (file)
@@ -1143,9 +1143,9 @@ status.loading_cached_pdb_entries = Loading Cached PDB Entries
 status.searching_for_pdb_structures = Searching for PDB Structures
 status.opening_file_for = opening file for
 status.colouring_chimera = Colouring Chimera
-status.running_hmmbuild = "Building hidden Markov model"
-status.running_hmmalign = "Creating alignment with hidden Markov model"
-status.running_hmmsearch = "Searching for matching sequences"
+status.running_hmmbuild = Building Hidden Markov Model
+status.running_hmmalign = Creating alignment with Hidden Markov Model
+status.running_hmmsearch = Searching for matching sequences
 label.font_doesnt_have_letters_defined = Font doesn't have letters defined\nso cannot be used\nwith alignment data
 label.font_too_small = Font size is too small
 label.error_loading_file_params = Error loading file {0}
@@ -1320,12 +1320,10 @@ label.hmmbuild = hmmbuild
 label.hmmbuild_group = Build HMM from Selected Group
 label.group_hmmbuild = Build HMM from Group
 label.hmmsearch = hmmsearch
-label.change_hmmer_location = HMMER Binaries Installation Location
+label.hmmer_location = HMMER Binaries Installation Location
 warn.null_hmm = Please ensure the alignment contains a hidden Markov model.
 label.ignore_below_background_frequency = Ignore Below Background Frequency
 label.information_description = Information content, measured in bits
-label.enter_location = Please enter the path of your HMMER binaries folder.
-label.invalid_hmmer_folder = The folder that you selected does not contain the necessary HMMER binaries.
 warn.no_selected_hmm = Please select a hidden Markov model sequence.
 label.select_hmm = Select HMM
 warn.no_sequence_data = No sequence data found.
@@ -1339,15 +1337,14 @@ label.freq_alignment = Use Alignment Background Frequencies
 label.freq_uniprot = Use Uniprot Background Frequencies
 label.hmmalign_label = hmmalign Options
 label.hmmsearch_label = hmmsearch Options
-label.hmmbuild_not_found = The hmmbuild binary was not found.
-label.hmmalign_not_found = The hmmalign binary was not found.
-label.hmmsearch_not_found = The hmmsearch binary was not found.
-warn.hmmbuild_failed = hmmbuild was not found. 
-warn.align_failed = hmmalign was not found.
+label.hmmbuild_not_found = The hmmbuild binary was not found
+label.hmmalign_not_found = The hmmalign binary was not found
+label.hmmsearch_not_found = The hmmsearch binary was not found
+warn.hmm_command_failed = hmm command not found
 label.invalid_folder = Invalid Folder
 label.folder_not_exists = HMMER binaries not found. \n Please enter the path to the HMMER binaries (if installed).
 label.hmmer_installed = HMMER installed
-label.hmmer_no_sequences_found = No sequences found.
+label.hmmer_no_sequences_found = No sequences found
 label.number_of_results = Number of Results to Return
 label.auto_align_seqs = Automatically Align Fetched Sequences
 label.use_accessions = Return Accessions
index 126196f..9755729 100644 (file)
@@ -68,6 +68,7 @@ import jalview.hmmer.HMMBuildThread;
 import jalview.hmmer.HMMERParamStore;
 import jalview.hmmer.HMMERPreset;
 import jalview.hmmer.HMMSearchThread;
+import jalview.hmmer.HmmerCommand;
 import jalview.io.AlignmentProperties;
 import jalview.io.AnnotationFile;
 import jalview.io.BioJsHTMLOutput;
@@ -400,7 +401,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       }
     });
     buildColourMenu();
-    buildHMMERMenu();
 
     if (Desktop.desktop != null)
     {
@@ -508,18 +508,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   /**
-   * Adds all menu items to the HMMER menu
-   */
-  private void buildHMMERMenu()
-  {
-    hmmerMenu.removeAll();
-
-    hmmerMenu.add(hmmAlign);
-    hmmerMenu.add(hmmBuild);
-    hmmerMenu.add(hmmSearch);
-  }
-
-  /**
    * Change the filename and format for the alignment, and enable the 'reload'
    * button functionality.
    * 
@@ -1036,8 +1024,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   @Override
-  public void hmmBuildSettings_actionPerformed(ActionEvent e)
-          throws IOException, InterruptedException
+  public void hmmBuildSettings_actionPerformed()
   {
     if (!(alignmentIsSufficient(1)))
     {
@@ -1057,8 +1044,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   @Override
-  public void hmmAlignSettings_actionPerformed(ActionEvent e)
-          throws IOException, InterruptedException
+  public void hmmAlignSettings_actionPerformed()
   {
     if (!(checkForHMM() && alignmentIsSufficient(2)))
     {
@@ -1078,7 +1064,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   @Override
-  public void hmmSearchSettings_actionPerformed(ActionEvent e)
+  public void hmmSearchSettings_actionPerformed()
   {
     if (!checkForHMM())
     {
@@ -1098,8 +1084,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   @Override
-  public void hmmBuildRun_actionPerformed(ActionEvent e)
-          throws IOException, InterruptedException
+  public void hmmBuildRun_actionPerformed()
   {
     if (!alignmentIsSufficient(1))
     {
@@ -1107,13 +1092,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
     new Thread(new HMMBuildThread(this, null))
             .start();
-    alignPanel.repaint();
-
   }
 
   @Override
-  public void hmmAlignRun_actionPerformed(ActionEvent e)
-          throws IOException, InterruptedException
+  public void hmmAlignRun_actionPerformed()
   {
     if (!(checkForHMM() && alignmentIsSufficient(2)))
     {
@@ -1121,11 +1103,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
     new Thread(new HMMAlignThread(this, true, null))
             .start();
-    alignPanel.repaint();
   }
 
   @Override
-  public void hmmSearchRun_actionPerformed(ActionEvent e)
+  public void hmmSearchRun_actionPerformed()
   {
     if (!checkForHMM())
     {
@@ -1133,7 +1114,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
     new Thread(new HMMSearchThread(this, true, null))
             .start();
-    alignPanel.repaint();
   }
 
   /**
@@ -1170,7 +1150,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   @Override
-  public void addDatabase_actionPerformed(ActionEvent e) throws IOException
+  public void addDatabase_actionPerformed() throws IOException
   {
     if (Cache.getProperty(Preferences.HMMSEARCH_DB_PATHS) == null)
     {
@@ -1191,7 +1171,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                 .getProperty(Preferences.HMMSEARCH_DB_PATHS);
         currentDbPaths += " " + path;
 
-        String fileName = StringUtils.getLastToken(path, new String("/"));
+        String fileName = StringUtils.getLastToken(path, File.separator);
         Scanner scanner = new Scanner(fileName).useDelimiter(".");
         String name = scanner.next();
         scanner.close();
@@ -5858,12 +5838,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * Sets the status of the HMMER menu
-   * 
-   * @param status
    */
-  public void updateHMMERStatus(boolean status)
+  public void updateHMMERStatus()
   {
-    hmmerMenu.setEnabled(status);
+    hmmerMenu.setEnabled(HmmerCommand.isHmmerAvailable());
   }
 
   /**
index ed86eab..b0fd215 100755 (executable)
@@ -22,14 +22,9 @@ package jalview.gui;
 
 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import jalview.bin.Cache;
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.HiddenMarkovModel;
-import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceI;
 import jalview.gui.Help.HelpId;
 import jalview.gui.StructureViewer.ViewerType;
-import jalview.hmmer.HMMBuildThread;
+import jalview.hmmer.HmmerCommand;
 import jalview.io.FileFormatI;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
@@ -54,11 +49,12 @@ import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
 import java.awt.event.MouseEvent;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Scanner;
 
 import javax.help.HelpSetException;
 import javax.swing.JColorChooser;
@@ -214,28 +210,32 @@ public class Preferences extends GPreferences
     /*
      * Set HMMER tab defaults
      */
-    trimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false));
-    isHMMERInstalled
-            .setSelected(Cache.getDefault("HMMER_INSTALLED", false));
+    hmmrTrimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false));
     if (Cache.getDefault("USE_UNIPROT", false))
     {
-      uniprot.setSelected(true);
+      hmmerBackgroundUniprot.setSelected(true);
     }
     else
     {
-      alignment.setSelected(true);
+      hmmerBackgroundAlignment.setSelected(true);
     }
-    numberOfSequencesToKeepField
+    hmmerSequenceCount
             .setText(Cache.getProperty("SEQUENCES_TO_KEEP"));
-    installationLocation.setEnabled(isHMMERInstalled.isSelected());
-    hmmerPath.setEnabled(isHMMERInstalled.isSelected());
     hmmerPath.setText(Cache.getProperty(HMMER_PATH));
     hmmerPath.addActionListener(new ActionListener()
     {
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        validateHMMERPath();
+        validateHMMERPath(true);
+      }
+    });
+    hmmerPath.addFocusListener(new FocusAdapter()
+    {
+      @Override
+      public void focusLost(FocusEvent e)
+      {
+        validateHMMERPath(true);
       }
     });
 
@@ -682,39 +682,32 @@ public class Preferences extends GPreferences
      * Save HMMER settings
      */
     Cache.applicationProperties.setProperty("TRIM_TERMINI",
-            Boolean.toString(trimTermini.isSelected()));
+            Boolean.toString(hmmrTrimTermini.isSelected()));
     Cache.applicationProperties.setProperty("USE_UNIPROT",
-            Boolean.toString(uniprot.isSelected()));
+            Boolean.toString(hmmerBackgroundUniprot.isSelected()));
     Cache.applicationProperties.setProperty("SEQUENCES_TO_KEEP",
-            numberOfSequencesToKeepField.getText());
+            hmmerSequenceCount.getText());
     Cache.applicationProperties.setProperty(HMMER_PATH,
             hmmerPath.getText());
-    boolean hmmerInstalled = isHMMERInstalled.isSelected();
-    Cache.applicationProperties.setProperty("HMMER_INSTALLED",
-            Boolean.toString(hmmerInstalled));
-    boolean hmmerFunctioning = validateHMMERPath(false);
-    Cache.applicationProperties.setProperty("HMMER_FUNCTIONING",
-            Boolean.toString(hmmerFunctioning));
     AlignFrame[] frames = Desktop.getAlignFrames();
-    boolean hmmerStatus = hmmerFunctioning && hmmerInstalled ? true : false;
     if (frames != null && frames.length > 0)
     {
-      for (AlignFrame frame : frames)
+      for (AlignFrame f : frames)
       {
-        frame.updateHMMERStatus(hmmerStatus);
+        f.updateHMMERStatus();
       }
     }
     
-    trimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false));
+    hmmrTrimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false));
     if (Cache.getDefault("USE_UNIPROT", false))
     {
-      uniprot.setSelected(true);
+      hmmerBackgroundUniprot.setSelected(true);
     }
     else
     {
-      alignment.setSelected(true);
+      hmmerBackgroundAlignment.setSelected(true);
     }
-    numberOfSequencesToKeepField
+    hmmerSequenceCount
             .setText(Cache.getProperty("SEQUENCES_TO_KEEP"));
     hmmerPath.setText(Cache.getProperty(HMMER_PATH));
 
@@ -875,14 +868,6 @@ public class Preferences extends GPreferences
       structureTab.requestFocusInWindow();
       return false;
     }
-    if (isHMMERInstalled.isSelected())
-    {
-      if (!validateHMMER())
-      {
-        hmmerTab.requestFocusInWindow();
-        return false;
-      }
-    }
     return true;
   }
 
@@ -893,13 +878,6 @@ public class Preferences extends GPreferences
 
   }
 
-  @Override
-  protected boolean validateHMMER()
-  {
-    return validateHMMERPath();
-
-  }
-
   /**
    * DOCUMENT ME!
    */
@@ -1194,94 +1172,27 @@ public class Preferences extends GPreferences
   }
   
   /**
-   * Returns true if hmmer path contains the necessary valid executables, else
-   * show an error dialog (if showing dialog).
+   * Returns true if hmmer path is to a folder that contains an executable
+   * hmmbuild or hmmbuild.exe, else false (optionally after showing a warning
+   * dialog)
    */
-  private boolean validateHMMERPath(boolean showDialog)
+  @Override
+  protected boolean validateHMMERPath(boolean showWarning)
   {
-    int missing = 0;
-    String message = "";
     String folder = hmmerPath.getText().trim();
-    if (folder.length() > 0)
-    {
-      File f = new File(folder);
-      if (!f.exists())
-      {
-        if (showDialog)
-        {
-          JvOptionPane.showInternalMessageDialog(Desktop.desktop,
-                MessageManager.getString("label.folder_not_exists"),
-                MessageManager.getString("label.invalid_folder"),
-                JvOptionPane.ERROR_MESSAGE);
-        }
-        return false;
-      }
-      AlignmentI alignment = new Alignment(
-              new SequenceI[]
-      { new Sequence("test", "WLWL", 0, 3) });
-      if (canExecute(folder + "/hmmbuild"))
-        {
-        validateHMMBuild(alignment);
-        }
-      else
-      {
-        message += MessageManager.getString("label.hmmbuild_not_found")
-                + "\n";
-        missing++;
-      }
-
-
-      if (canExecute(folder + "/hmmalign"))
-        {
-
-        }
-      else
-      {
-        message += MessageManager.getString("label.hmmalign_not_found")
-                + "\n";
-        missing++;
-      }
 
-
-      if (canExecute(folder + "/hmmsearch"))
-        {
-
-        }
-      else
-      {
-        message += MessageManager.getString("label.hmmsearch_not_found")
-                + "\n";
-        missing++;
-      }
-      }
-
-      if (missing > 0)
-      {
-        if (missing < 3)
-        {
-          if (showDialog)
-          {
-            JvOptionPane.showInternalMessageDialog(Desktop.desktop, message,
-                  MessageManager.getString("label.invalid_folder"),
-                  JvOptionPane.ERROR_MESSAGE);
-          }
-          return false;
-        }
-        else
-        {
-          if (showDialog)
-          {
-            JvOptionPane.showInternalMessageDialog(Desktop.desktop,
-                  MessageManager.getString("label.no_binaries"),
-                  MessageManager.getString("label.invalid_folder"),
-                  JvOptionPane.ERROR_MESSAGE);
-          }
-
-          return false;
-        }
-      }
-
-    return true;
+    if (HmmerCommand.getExecutable(HmmerCommand.HMMBUILD, folder) != null)
+    {
+      return true;
+    }
+    if (showWarning && folder.length() > 0)
+    {
+      JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+              MessageManager.getString("label.hmmbuild_not_found"),
+              MessageManager.getString("label.invalid_folder"),
+              JvOptionPane.ERROR_MESSAGE);
+    }
+    return false;
   }
 
   /**
@@ -1308,57 +1219,6 @@ public class Preferences extends GPreferences
   }
 
   /**
-   * Runs hmmbuild to check if it is working. While doing this it parses the
-   * version of HMMER.
-   * 
-   * @param frame
-   * @return
-   */
-  public boolean validateHMMBuild(AlignmentI alignment)
-  {
-    HMMBuildThread hmmbuild = new HMMBuildThread(alignment);
-    hmmbuild.hmmbuildWaitTillComplete();
-    SequenceI hmmSeq = alignment.getSequenceAt(0);
-    HiddenMarkovModel hmm;
-    if (hmmSeq.isHMMConsensusSequence() && hmmSeq.getHMM() != null)
-    {
-      hmm = hmmSeq.getHMM();
-
-      if (hmm.getNumberOfSymbols() < 1)
-      {
-        return false;
-      }
-    }
-    else
-    {
-      return false;
-    }
-
-    String header = hmm.getFileHeader();
-    if (header == null)
-    {
-      return false;
-    }
-    else
-    {
-      Scanner scanner = new Scanner(header);
-      scanner.next();
-      String string = scanner.next();
-      String version = string.substring(1);
-      Cache.setProperty("HMMER_VERSION", version);
-      scanner.close();
-
-    }
-    return true;
-  }
-
-
-  private boolean validateHMMERPath()
-  {
-    return validateHMMERPath(true);
-  }
-
-  /**
    * If Chimera is selected, check it can be found on default or user-specified
    * path, if not show a warning/help dialog.
    */
index c2d19d7..663f544 100755 (executable)
@@ -25,6 +25,7 @@ import jalview.api.SplitContainerI;
 import jalview.bin.Cache;
 import jalview.gui.JvSwingUtils;
 import jalview.gui.Preferences;
+import jalview.hmmer.HmmerCommand;
 import jalview.io.FileFormatException;
 import jalview.io.FileFormats;
 import jalview.util.MessageManager;
@@ -320,15 +321,7 @@ public class GAlignFrame extends JInternalFrame
             MessageManager.getString("action.calculate"));
     webService.setText(MessageManager.getString("action.web_service"));
     hmmerMenu.setText(MessageManager.getString("action.hmmer"));
-    String status = Cache.getProperty("HMMER_FUNCTIONING");
-    if ("false".equals(status) || status == null)
-    {
-      hmmerMenu.setEnabled(false);
-    }
-    else
-    {
-      hmmerMenu.setEnabled(true);
-    }
+    hmmerMenu.setEnabled(HmmerCommand.isHmmerAvailable());
     hmmerMenu.addActionListener(new ActionListener()
     {
       @Override
@@ -337,6 +330,10 @@ public class GAlignFrame extends JInternalFrame
         hmmerMenu_actionPerformed(e);
       }
     });
+    hmmerMenu.add(hmmBuild);
+    hmmerMenu.add(hmmAlign);
+    hmmerMenu.add(hmmSearch);
+
     JMenuItem selectAllSequenceMenuItem = new JMenuItem(
             MessageManager.getString("action.select_all"));
     keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A,
@@ -1752,119 +1749,76 @@ public class GAlignFrame extends JInternalFrame
             "label.action_with_default_settings", "hmmbuild"));
     hmmBuildRun.addActionListener(new ActionListener()
     {
-
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        try
-        {
-          hmmBuildRun_actionPerformed(e);
-        } catch (IOException | InterruptedException e1)
-        {
-          // TODO Auto-generated catch block
-          e1.printStackTrace();
-        }
+        hmmBuildRun_actionPerformed();
       }
-
     });
     hmmBuildSettings.setText(
             MessageManager.getString("label.edit_settings_and_run"));
     hmmBuildSettings.addActionListener(new ActionListener()
     {
-
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        try
-        {
-          hmmBuildSettings_actionPerformed(e);
-        } catch (IOException | InterruptedException e1)
-        {
-          // TODO Auto-generated catch block
-          e1.printStackTrace();
-        }
+        hmmBuildSettings_actionPerformed();
       }
-
     });
     hmmAlignRun.setText(MessageManager.formatMessage(
             "label.action_with_default_settings", "hmmalign"));
     hmmAlignRun.addActionListener(new ActionListener()
     {
-
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        try
-        {
-          hmmAlignRun_actionPerformed(e);
-        } catch (IOException | InterruptedException e1)
-        {
-          // TODO Auto-generated catch block
-          e1.printStackTrace();
-        }
+        hmmAlignRun_actionPerformed();
       }
-
     });
     hmmAlignSettings.setText(
             MessageManager.getString("label.edit_settings_and_run"));
     hmmAlignSettings.addActionListener(new ActionListener()
     {
-
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        try
-        {
-          hmmAlignSettings_actionPerformed(e);
-        } catch (IOException | InterruptedException e1)
-        {
-          // TODO Auto-generated catch block
-          e1.printStackTrace();
-        }
+        hmmAlignSettings_actionPerformed();
       }
-
     });
     hmmSearchRun.setText(MessageManager.formatMessage(
             "label.action_with_default_settings", "hmmsearch"));
     hmmSearchRun.addActionListener(new ActionListener()
     {
-
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        hmmSearchRun_actionPerformed(e);
+        hmmSearchRun_actionPerformed();
       }
-
     });
     addDatabase.setText(MessageManager.getString("label.add_database"));
     addDatabase.addActionListener(new ActionListener()
     {
-
       @Override
       public void actionPerformed(ActionEvent e)
       {
         try
         {
-          addDatabase_actionPerformed(e);
+          addDatabase_actionPerformed();
         } catch (IOException e1)
         {
-          // TODO Auto-generated catch block
           e1.printStackTrace();
         }
       }
-
     });
     hmmSearchSettings.setText(
             MessageManager.getString("label.edit_settings_and_run"));
     hmmSearchSettings.addActionListener(new ActionListener()
     {
-
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        hmmSearchSettings_actionPerformed(e);
+        hmmSearchSettings_actionPerformed();
       }
-
     });
     selectHighlighted.addActionListener(al);
     JMenu tooltipSettingsMenu = new JMenu(
@@ -2567,36 +2521,32 @@ public class GAlignFrame extends JInternalFrame
   {
   }
 
-  protected void hmmBuildRun_actionPerformed(ActionEvent e)
-          throws IOException, InterruptedException
+  protected void hmmBuildRun_actionPerformed()
   {
   }
 
-  protected void hmmSearchRun_actionPerformed(ActionEvent e)
+  protected void hmmSearchRun_actionPerformed()
   {
   }
 
-  protected void addDatabase_actionPerformed(ActionEvent e)
+  protected void addDatabase_actionPerformed()
           throws FileFormatException, IOException
   {
   }
 
-  protected void hmmAlignRun_actionPerformed(ActionEvent e)
-          throws IOException, InterruptedException
+  protected void hmmAlignRun_actionPerformed()
   {
   }
 
-  protected void hmmBuildSettings_actionPerformed(ActionEvent e)
-          throws IOException, InterruptedException
+  protected void hmmBuildSettings_actionPerformed()
   {
   }
 
-  protected void hmmSearchSettings_actionPerformed(ActionEvent e)
+  protected void hmmSearchSettings_actionPerformed()
   {
   }
 
-  protected void hmmAlignSettings_actionPerformed(ActionEvent e)
-          throws IOException, InterruptedException
+  protected void hmmAlignSettings_actionPerformed()
   {
   }
 
index bb6f223..93442b2 100755 (executable)
@@ -40,7 +40,6 @@ import java.awt.Insets;
 import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
@@ -262,28 +261,16 @@ public class GPreferences extends JPanel
    */
   protected JPanel hmmerTab = new JPanel();
 
-  protected JCheckBox trimTermini = new JCheckBox();
+  protected JCheckBox hmmrTrimTermini = new JCheckBox();
 
-  protected ButtonGroup backgroundFreqSource = new ButtonGroup();
+  protected AbstractButton hmmerBackgroundUniprot = new JCheckBox();
 
-  protected AbstractButton uniprot = new JCheckBox();
+  protected AbstractButton hmmerBackgroundAlignment = new JCheckBox();
 
-  protected AbstractButton alignment = new JCheckBox();
-
-  protected JLabel sequencesToKeep = new JLabel();
-
-  protected JTextField numberOfSequencesToKeepField = new JTextField();
-
-  protected JLabel installationLocation = new JLabel();
-
-  protected JCheckBox isHMMERInstalled = new JCheckBox();
+  protected JTextField hmmerSequenceCount = new JTextField();
 
   protected JTextField hmmerPath = new JTextField();
 
-  protected JLabel hmmsearch = new JLabel();
-
-  protected JLabel hmmalign = new JLabel();
-
   /*
    * DAS Settings tab
    */
@@ -360,7 +347,7 @@ public class GPreferences extends JPanel
 
     /*
      * Handler to validate a tab before leaving it - currently only for
-     * Structure.
+     * Structure
      */
     tabbedPane.addChangeListener(new ChangeListener()
     {
@@ -378,16 +365,6 @@ public class GPreferences extends JPanel
             return;
           }
         }
-        else if (lastTab == hmmerTab
-                && tabbedPane.getSelectedComponent() != hmmerTab
-                && isHMMERInstalled.isSelected())
-        {
-          if (!validateHMMER())
-          {
-            tabbedPane.setSelectedComponent(hmmerTab);
-          }
-          return;
-        }
         lastTab = tabbedPane.getSelectedComponent();
       }
 
@@ -424,7 +401,7 @@ public class GPreferences extends JPanel
   }
 
   /**
-   * Initialises the hmmer tabbed panel.
+   * Initialises the hmmer tabbed panel
    * 
    * @return
    */
@@ -432,43 +409,11 @@ public class GPreferences extends JPanel
   {
     hmmerTab.setLayout(null);
 
-    hmmalign.setFont(LABEL_FONT);
-    hmmalign.setText(MessageManager.getString("label.hmmalign_label"));
-    hmmalign.setBounds(new Rectangle(22, 10, 200, 23));
-
-    trimTermini.setFont(LABEL_FONT);
-    trimTermini.setText(MessageManager.getString("label.trim_termini"));
-    trimTermini.setBounds(new Rectangle(22, 30, 200, 23));
-
-    hmmsearch.setFont(LABEL_FONT);
-    hmmsearch.setText(MessageManager.getString("label.hmmsearch_label"));
-    hmmsearch.setBounds(new Rectangle(250, 10, 200, 23));
-
-    sequencesToKeep.setFont(LABEL_FONT);
-    sequencesToKeep
-            .setText(MessageManager.getString("label.no_of_sequences"));
-    sequencesToKeep.setBounds(new Rectangle(250, 30, 125, 23));
-    numberOfSequencesToKeepField.setBounds(new Rectangle(375, 30, 40, 23));
-
-    isHMMERInstalled.setFont(LABEL_FONT);
-    isHMMERInstalled.setText(
-            MessageManager.getString("label.hmmer_installed"));
-    isHMMERInstalled.setBounds(new Rectangle(22, 180, 200, 23));
-    isHMMERInstalled.addActionListener(new ActionListener()
-    {
-      @Override
-      public void actionPerformed(ActionEvent e)
-      {
-        boolean status = isHMMERInstalled.isSelected();
-        installationLocation.setEnabled(status);
-        hmmerPath.setEnabled(status);
-      }
-    });
+    JLabel installationLocation = new JLabel(
+            MessageManager.getString("label.hmmer_location"));
     installationLocation.setFont(LABEL_FONT);
-    installationLocation.setText(
-            MessageManager.getString("label.change_hmmer_location"));
-    installationLocation.setBounds(new Rectangle(22, 200, 200, 23));
-    hmmerPath.setBounds(new Rectangle(22, 220, 200, 23));
+    installationLocation.setBounds(new Rectangle(22, 10, 250, 23));
+    hmmerPath.setBounds(new Rectangle(22, 30, 300, 23));
     hmmerPath.addMouseListener(new MouseAdapter()
     {
       @Override
@@ -485,29 +430,49 @@ public class GPreferences extends JPanel
       }
     });
 
-    backgroundFreqSource.add(uniprot);
-    backgroundFreqSource.add(alignment);
-    backgroundFreqSource.setSelected(uniprot.getModel(), true);
+    JLabel hmmalign = new JLabel(
+            MessageManager.getString("label.hmmalign_label"));
+    hmmalign.setFont(LABEL_FONT);
+    hmmalign.setBounds(new Rectangle(22, 50, 200, 23));
 
-    uniprot.setText(MessageManager.getString("label.freq_uniprot"));
-    uniprot.setFont(LABEL_FONT);
-    uniprot.setBounds(new Rectangle(22, 260, 255, 23));
+    hmmrTrimTermini.setFont(LABEL_FONT);
+    hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
+    hmmrTrimTermini.setBounds(new Rectangle(22, 70, 200, 23));
 
-    alignment.setText(MessageManager.getString("label.freq_alignment"));
-    alignment.setFont(LABEL_FONT);
-    alignment.setBounds(new Rectangle(22, 280, 255, 23));
+    JLabel hmmsearch = new JLabel(
+            MessageManager.getString("label.hmmsearch_label"));
+    hmmsearch.setFont(LABEL_FONT);
+    hmmsearch.setBounds(new Rectangle(22, 90, 200, 23));
 
-    hmmerTab.add(uniprot);
-    hmmerTab.add(alignment);
+    JLabel sequencesToKeep = new JLabel(
+            MessageManager.getString("label.no_of_sequences"));
+    sequencesToKeep.setFont(LABEL_FONT);
+    sequencesToKeep.setBounds(new Rectangle(22, 110, 125, 23));
+    hmmerSequenceCount.setBounds(new Rectangle(150, 110, 40, 23));
+
+    ButtonGroup backgroundFreqSource = new ButtonGroup();
+    backgroundFreqSource.add(hmmerBackgroundUniprot);
+    backgroundFreqSource.add(hmmerBackgroundAlignment);
+    backgroundFreqSource.setSelected(hmmerBackgroundUniprot.getModel(), true);
+
+    hmmerBackgroundUniprot.setText(MessageManager.getString("label.freq_uniprot"));
+    hmmerBackgroundUniprot.setFont(LABEL_FONT);
+    hmmerBackgroundUniprot.setBounds(new Rectangle(22, 130, 255, 23));
+
+    hmmerBackgroundAlignment.setText(MessageManager.getString("label.freq_alignment"));
+    hmmerBackgroundAlignment.setFont(LABEL_FONT);
+    hmmerBackgroundAlignment.setBounds(new Rectangle(22, 150, 300, 23));
+
+    hmmerTab.add(hmmerBackgroundUniprot);
+    hmmerTab.add(hmmerBackgroundAlignment);
     hmmerTab.add(hmmalign);
     hmmerTab.add(hmmsearch);
     hmmerTab.add(installationLocation);
     hmmerTab.add(hmmerPath);
-    hmmerTab.add(trimTermini);
+    hmmerTab.add(hmmrTrimTermini);
     hmmerTab.add(sequencesToKeep);
     hmmerTab.add(sequencesToKeep);
-    hmmerTab.add(numberOfSequencesToKeepField);
-    hmmerTab.add(isHMMERInstalled);
+    hmmerTab.add(hmmerSequenceCount);
 
     return hmmerTab;
   }
@@ -1275,42 +1240,12 @@ public class GPreferences extends JPanel
     return choice;
   }
 
-  /**
-   * Validate the structure tab preferences; if invalid, set focus on this tab.
-   * 
-   * @param e
-   */
-  protected boolean validateStructure(FocusEvent e)
-  {
-    if (!validateStructure())
-    {
-      e.getComponent().requestFocusInWindow();
-      return false;
-    }
-    return true;
-  }
-
-  /**
-   * Validate the hmmer tab preferences; if invalid, set focus on this tab.
-   * 
-   * @param e
-   */
-  protected boolean validateHMMER(FocusEvent e)
-  {
-    if (!validateHMMER())
-    {
-      e.getComponent().requestFocusInWindow();
-      return false;
-    }
-    return true;
-  }
-
   protected boolean validateStructure()
   {
     return false;
   }
 
-  protected boolean validateHMMER()
+  protected boolean validateHMMERPath(boolean showWarning)
   {
     return false;
   }