+ 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;
+ }
+
+ /**
+ * Checks if a file can be executed
+ *
+ * @param path
+ * the path to the file
+ * @return
+ */
+ public boolean canExecute(String path)
+ {
+ File file = new File(path);
+ if (!file.canExecute())
+ {
+ file = new File(path + ".exe");
+ {
+ if (!file.canExecute())
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 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(1);
+ 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();
+