JAL-2629 choice of hmm profile now a parameter not a selection, apis simplified
[jalview.git] / src / jalview / hmmer / HmmerCommand.java
index 9bec181..8888c20 100644 (file)
@@ -254,8 +254,8 @@ public abstract class HmmerCommand implements Runnable
     File file = FileUtils.getExecutable(cmd, binariesFolder);
     if (file == null && af != null)
     {
-        JvOptionPane.showInternalMessageDialog(af,
-                MessageManager.getString("warn.hmm_command_failed"));
+      JvOptionPane.showInternalMessageDialog(af, MessageManager
+              .formatMessage("label.executable_not_found", cmd));
     }
 
     return file == null ? null : file.getAbsolutePath();
@@ -279,4 +279,29 @@ public abstract class HmmerCommand implements Runnable
       writer.close();
     }
   }
+
+  /**
+   * Answers the HMM profile for the profile sequence the user selected (default
+   * is just the first HMM sequence in the alignment)
+   * 
+   * @return
+   */
+  protected HiddenMarkovModel getHmmProfile()
+  {
+    String alignToParamName = MessageManager.getString("label.use_hmm");
+    for (ArgumentI arg : params)
+    {
+      String name = arg.getName();
+      if (name.equals(alignToParamName))
+      {
+        String seqName = arg.getValue();
+        SequenceI hmmSeq = alignment.findName(seqName);
+        if (hmmSeq.hasHMMProfile())
+        {
+          return hmmSeq.getHMM();
+        }
+      }
+    }
+    return null;
+  }
 }