From a32dfc833642269f2d72f56219657c9f7ec40592 Mon Sep 17 00:00:00 2001 From: TZVanaalten Date: Tue, 15 Aug 2017 12:48:09 +0100 Subject: [PATCH] JAL-2629 add HMMER version check --- src/jalview/gui/Preferences.java | 25 +++++++++++++++++++++++++ src/jalview/hmmer/HMMAlignThread.java | 5 +++-- src/jalview/jbgui/GAlignFrame.java | 1 - 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 39023dc..0e418bd 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -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); diff --git a/src/jalview/hmmer/HMMAlignThread.java b/src/jalview/hmmer/HMMAlignThread.java index d94ce97..3649108 100644 --- a/src/jalview/hmmer/HMMAlignThread.java +++ b/src/jalview/hmmer/HMMAlignThread.java @@ -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); diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 738d98f..518c51a 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -315,7 +315,6 @@ public class GAlignFrame extends JInternalFrame } hmmerMenu.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { -- 1.7.10.2