+
+ /**
+ * Returns true if hmmer path contains the necessary valid executables, else
+ * show an error dialog (if showing dialog).
+ */
+ private boolean validateHMMERPath(boolean showDialog)
+ {
+ int missing = 0;
+ String message = "";
+ String path = hmmerPath.getText().trim();
+ if (path.length() > 0)
+ {
+ File f = new File(path);
+ 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;
+ }
+
+ File hmmbuild = new File(path + "/binaries/hmmbuild.exe");
+ {
+ if (!hmmbuild.canExecute())
+ {
+ message += MessageManager.getString("label.hmmbuild_not_found")
+ + "\n";
+ missing++;
+ }
+ }
+
+ File hmmalign = new File(path + "/binaries/hmmalign.exe");
+ {
+ if (!hmmalign.canExecute())
+ {
+ message += MessageManager.getString("label.hmmalign_not_found")
+ + "\n";
+ missing++;
+ }
+ }
+
+ File hmmsearch = new File(path + "/binaries/hmmsearch.exe");
+ {
+ if (!hmmsearch.canExecute())
+ {
+ 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;
+ }
+
+ 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);
+ }