+
+ /**
+ * Answers the full path to the given hmmer executable, or null if file cannot
+ * be found or is not executable
+ *
+ * @param cmd
+ * command short name e.g. hmmalign
+ * @return
+ */
+ protected String getCommandRoot(String cmd)
+ {
+ String binariesFolder = Cache.getProperty(Preferences.HMMER_PATH);
+ File file = getExecutable(cmd, binariesFolder);
+ if (file == null && af != null)
+ {
+ JvOptionPane.showInternalMessageDialog(af,
+ MessageManager.getString("warn.hmm_command_failed"));
+ }
+
+ return file == null ? null : file.getAbsolutePath();
+ }
+
+ /**
+ * Answers the executable file for the given hmmer command, or null if not
+ * found or not executable. The path to the executable is the command name
+ * prefixed by the hmmer binaries folder path, optionally with .exe appended.
+ *
+ * @param cmd
+ * hmmer command short name, for example hmmbuild
+ * @param binaryPath
+ * parent folder containing hmmer executables
+ * @return
+ */
+ public static File getExecutable(String cmd, String binaryPath)
+ {
+ File file = new File(binaryPath, cmd);
+ if (!file.canExecute())
+ {
+ file = new File(binaryPath, cmd + ".exe");
+ {
+ if (!file.canExecute())
+ {
+ file = null;
+ }
+ }
+ }
+ return file;
+ }