JAL-3878 Create web service class - container for service metadata and actions
[jalview.git] / src / jalview / hmmer / HmmerCommand.java
index a30c524..e241008 100644 (file)
@@ -1,6 +1,7 @@
 package jalview.hmmer;
 
 import jalview.analysis.SeqsetUtils;
+import jalview.analysis.SeqsetUtils.SequenceInfo;
 import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
@@ -30,6 +31,7 @@ import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Base class for hmmbuild, hmmalign and hmmsearch
@@ -60,6 +62,8 @@ public abstract class HmmerCommand implements Runnable
 
   static final String NUMBER_OF_RESULTS_KEY = "label.number_of_results";
 
+  static final String NUMBER_OF_ITERATIONS = "label.number_of_iterations";
+
   static final String TRIM_TERMINI_KEY = "label.trim_termini";
 
   static final String RETURN_N_NEW_SEQ = "label.check_for_new_sequences";
@@ -72,16 +76,26 @@ public abstract class HmmerCommand implements Runnable
 
   static final String CUTOFF_EVALUE = "label.evalue";
 
-  static final String SEQ_EVALUE_KEY = "label.seq_evalue";
+  static final String REPORTING_SEQ_EVALUE_KEY = "label.reporting_seq_evalue";
+
+  static final String REPORTING_DOM_EVALUE_KEY = "label.reporting_dom_evalue";
+
+  static final String REPORTING_SEQ_SCORE_KEY = "label.reporting_seq_score";
+
+  static final String REPORTING_DOM_SCORE_KEY = "label.reporting_dom_score";
 
-  static final String DOM_EVALUE_KEY = "label.dom_evalue";
+  static final String INCLUSION_SEQ_EVALUE_KEY = "label.inclusion_seq_evalue";
 
-  static final String SEQ_SCORE_KEY = "label.seq_score";
+  static final String INCLUSION_DOM_EVALUE_KEY = "label.inclusion_dom_evalue";
 
-  static final String DOM_SCORE_KEY = "label.dom_score";
+  static final String INCLUSION_SEQ_SCORE_KEY = "label.inclusion_seq_score";
+
+  static final String INCLUSION_DOM_SCORE_KEY = "label.inclusion_dom_score";
 
   static final String ARG_TRIM = "--trim";
 
+  static final String INCLUSION_THRESHOLD_KEY = "label.inclusion_threshold";
+
   /**
    * Constructor
    * 
@@ -115,7 +129,7 @@ public abstract class HmmerCommand implements Runnable
    * 
    * @param seqs
    */
-  protected Hashtable stashSequences(SequenceI[] seqs)
+  protected Map<String, SequenceInfo> stashSequences(SequenceI[] seqs)
   {
     return SeqsetUtils.uniquify(seqs, true);
   }
@@ -123,12 +137,12 @@ public abstract class HmmerCommand implements Runnable
   /**
    * Restores the sequence data lost by uniquifying
    * 
-   * @param hashtable
+   * @param sequencesHash
    * @param seqs
    */
-  protected void recoverSequences(Hashtable hashtable, SequenceI[] seqs)
+  protected void recoverSequences(Map<String, SequenceInfo> sequencesHash, SequenceI[] seqs)
   {
-    SeqsetUtils.deuniquify(hashtable, seqs);
+    SeqsetUtils.deuniquify(sequencesHash, seqs);
   }
 
   /**
@@ -142,14 +156,14 @@ public abstract class HmmerCommand implements Runnable
   public boolean runCommand(List<String> commands)
           throws IOException
   {
-    List<String> args = Platform.isWindows() ? wrapWithCygwin(commands)
+    List<String> args = Platform.isWindowsAndNotJS() ? wrapWithCygwin(commands)
             : commands;
 
     try
     {
       ProcessBuilder pb = new ProcessBuilder(args);
       pb.redirectErrorStream(true); // merge syserr to sysout
-      if (Platform.isWindows())
+      if (Platform.isWindowsAndNotJS())
       {
         String path = pb.environment().get("Path");
         path = jalview.bin.Cache.getProperty("CYGWIN_PATH") + ";" + path;
@@ -387,8 +401,8 @@ public abstract class HmmerCommand implements Runnable
   }
 
   /**
-   * Answers the HMM profile for the profile sequence the user selected (default
-   * is just the first HMM sequence in the alignment)
+   * Answers the query sequence the user selected (default is just the first
+   * sequence in the alignment)
    * 
    * @return
    */
@@ -424,7 +438,7 @@ public abstract class HmmerCommand implements Runnable
   protected String getFilePath(File resultFile, boolean isInCygwin)
   {
     String path = resultFile.getAbsolutePath();
-    if (Platform.isWindows() && isInCygwin)
+    if (Platform.isWindowsAndNotJS() && isInCygwin)
     {
       // the first backslash escapes '\' for the regular expression argument
       path = path.replaceAll("\\" + File.separator, "/");