JAL-2629 add HMMER version check
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Tue, 15 Aug 2017 11:48:09 +0000 (12:48 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Tue, 15 Aug 2017 11:48:09 +0000 (12:48 +0100)
src/jalview/gui/Preferences.java
src/jalview/hmmer/HMMAlignThread.java
src/jalview/jbgui/GAlignFrame.java

index 39023dc..0e418bd 100755 (executable)
@@ -50,8 +50,10 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseEvent;
 import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Scanner;
 
 import javax.help.HelpSetException;
 import javax.swing.JColorChooser;
@@ -690,6 +692,11 @@ public class Preferences extends GPreferences
     {
       frame.updateHMMERStatus(hmmerStatus);
     }
+    if (hmmerStatus)
+    {
+      String ver = getHMMERVersion();
+      Cache.setProperty("HMMER_VERSION", ver);
+    }
     
     
     trimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false));
@@ -1262,6 +1269,24 @@ public class Preferences extends GPreferences
     return true;
   }
 
+  private String getHMMERVersion()
+  {
+    File file = new File(hmmerPath.getText() + "/release-notes.txt");
+    Scanner scanner = null;
+    try
+    {
+      scanner = new Scanner(file);
+    } catch (IOException e)
+    {
+      e.printStackTrace();
+      return null;
+    }
+    scanner.next();
+    String res = scanner.next();
+    scanner.close();
+    return res;
+  }
+
   private boolean validateHMMERPath()
   {
     return validateHMMERPath(true);
index d94ce97..3649108 100644 (file)
@@ -171,7 +171,8 @@ public class HMMAlignThread implements Runnable
       return false;
     }
     String command = cmds.HMMERFOLDER + cmds.HMMALIGN;
-    if (!hmm.getFileHeader().contains("HMMER3/f"))
+    String version = Cache.getProperty("HMMER_VERSION");
+    if (!"3.1b2".equals(version))
     {
       command += cmds.ALLCOL;
     }
@@ -185,7 +186,7 @@ public class HMMAlignThread implements Runnable
     {
       command += cmds.TRIM;
     }
-    command += " -o" + inputTemp.getAbsolutePath() + cmds.SPACE
+    command += " -o " + inputTemp.getAbsolutePath() + cmds.SPACE
             + hmmTemp.getAbsolutePath() + cmds.SPACE
             + outTemp.getAbsolutePath();
     return cmds.runCommand(command);
index 738d98f..518c51a 100755 (executable)
@@ -315,7 +315,6 @@ public class GAlignFrame extends JInternalFrame
     }
     hmmerMenu.addActionListener(new ActionListener()
     {
-
       @Override
       public void actionPerformed(ActionEvent e)
       {