JAL-2629 adjust parameter min and max to better suit HMMER ranges
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Thu, 24 Aug 2017 14:07:36 +0000 (15:07 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Fri, 25 Aug 2017 16:21:02 +0000 (17:21 +0100)
src/jalview/gui/OptsAndParamsPage.java
src/jalview/hmmer/HMMERParamStore.java

index 424d561..44acdab 100644 (file)
@@ -599,15 +599,11 @@ public class OptsAndParamsPage
 
     public String formatDouble(Double value)
     {
-      String string = "";
-      if (value < 0.0001)
+      String string = String.format("%2.3f", value);
+      if (value < 0.001)
       {
         string = String.format("%3.3e", value);
       }
-      else
-      {
-        string = value.toString();
-      }
       return string;
     }
 
@@ -681,7 +677,17 @@ public class OptsAndParamsPage
         }
         else
         {
-          valueField.setText(parm.getValue());
+          if (parm instanceof LogarithmicParameter)
+          {
+            Double base = ((LogarithmicParameter) parm).getBase();
+            Double value = Math.pow(base,
+                    Double.parseDouble(parm.getValue()));
+            valueField.setText(formatDouble(value));
+          }
+          else
+          {
+            valueField.setText(parm.getValue());
+          }
         }
       }
       lastVal = updateSliderFromValueField();
index 4791626..ab33c95 100644 (file)
@@ -51,96 +51,101 @@ public class HMMERParamStore implements ParamDatastoreI
     List<ArgumentI> args = new ArrayList<>();
     if ("hmmsearch".equals(name))
     {
-      args.add(new IntegerParameter(
-              MessageManager.getString("label.number_of_results"),
-              MessageManager
-                      .getString("label.number_of_results_desc"),
-              true, 100, 0, 100000));
-      String names = Cache.getProperty(Preferences.HMMSEARCH_DBS);
-      if (names != null && !names.isEmpty())
-      {
-        Collection<String> databases = new ArrayList<>();
-        databases.add(MessageManager.getString("label.this_alignment"));
-        Scanner nameScanner = new Scanner(names);
-
-        if (nameScanner.hasNext())
-        {
-          while (nameScanner.hasNext())
-          {
-            String next = nameScanner.next();
-            if (next == "null")
-            {
-              Cache.setProperty(Preferences.HMMSEARCH_DBS, "");
-              Cache.setProperty(Preferences.HMMSEARCH_DB_PATHS, "");
-            }
-            else
-            {
-              databases.add(next);
-            }
-          }
-        }
-        nameScanner.close();
-        args.add(new Option(MessageManager.getString("label.database"),
-                MessageManager.getString("label.database_for_hmmsearch"),
-                true, MessageManager.getString("label.this_alignment"),
-                MessageManager.getString("label.this_alignment"), databases,
-                null));
-      }
-      args.add(new BooleanOption(
-              MessageManager.getString("label.auto_align_seqs"),
-              MessageManager.getString("label.auto_align_seqs_desc"),
-              false, false, true, null));
-      args.add(new BooleanOption(
-              MessageManager.getString("label.use_accessions"),
-              MessageManager.getString("label.use_accessions_desc"),
-              false, false, true, null));
-      args.add(new BooleanOption(
-              MessageManager.getString("label.trim_termini"),
-              MessageManager.getString("label.trim_termini_desc"), false,
-              false, true, null));
-      args.add(new LogarithmicParameter(
-              MessageManager.getString("label.seq_e_value"),
-              MessageManager.getString("label.seq_e_value_desc"), false,
-              0.001d, -63d, 9d, 4d));
-      /*
-      args.add(new DoubleParameter(
-              MessageManager.getString("label.seq_score"),
-              MessageManager.getString("label.seq_score_desc"), false,
-              0d, 0d, 10000d));
-         */
-      args.add(new LogarithmicParameter(
-              MessageManager.getString("label.dom_e_value_desc"),
-              MessageManager.getString("label.dom_e_value_desc"), false,
-              0.001d, -63d, 9d, 4d));
-      /*
-      args.add(new DoubleParameter(
-              MessageManager.getString("label.dom_score"),
-              MessageManager.getString("label.dom_score_desc"), false, 0d,
-              0d,
-              10000d));
-              */
+      getHMMSearchParams(args);
     }
     if ("hmmalign".equals(name))
     {
-      args.add(new BooleanOption(
-              MessageManager.getString("label.trim_termini"),
-              MessageManager.getString(
-                      "label.trim_termini = Trim Non-Matching Termini_desc"),
-              false, false, true, null));
+      getHMMAlignParams(args);
 
     }
     if ("hmmbuild".equals(name))
     {
-      args.add(new BooleanOption(
-              MessageManager.getString("label.trim_termini"),
-              MessageManager.getString(
-                      "label.trim_termini = Trim Non-Matching Termini_desc"),
-              false, false, true, null));
+
 
     }
     return args;
   }
 
+  private void getHMMSearchParams(List<ArgumentI> args)
+  {
+    args.add(new IntegerParameter(
+            MessageManager.getString("label.number_of_results"),
+            MessageManager.getString("label.number_of_results_desc"), true,
+            100, 0, 100000));
+    String names = Cache.getProperty(Preferences.HMMSEARCH_DBS);
+    if (names != null && !names.isEmpty())
+    {
+      Collection<String> databases = new ArrayList<>();
+      databases.add(MessageManager.getString("label.this_alignment"));
+      Scanner nameScanner = new Scanner(names);
+
+      if (nameScanner.hasNext())
+      {
+        while (nameScanner.hasNext())
+        {
+          String next = nameScanner.next();
+          if (next == "null")
+          {
+            Cache.setProperty(Preferences.HMMSEARCH_DBS, "");
+            Cache.setProperty(Preferences.HMMSEARCH_DB_PATHS, "");
+          }
+          else
+          {
+            databases.add(next);
+          }
+        }
+      }
+      nameScanner.close();
+      args.add(new Option(MessageManager.getString("label.database"),
+              MessageManager.getString("label.database_for_hmmsearch"),
+              true, MessageManager.getString("label.this_alignment"),
+              MessageManager.getString("label.this_alignment"), databases,
+              null));
+    }
+    args.add(new BooleanOption(
+            MessageManager.getString("label.auto_align_seqs"),
+            MessageManager.getString("label.auto_align_seqs_desc"), false,
+            false, true, null));
+    args.add(new BooleanOption(
+            MessageManager.getString("label.use_accessions"),
+            MessageManager.getString("label.use_accessions_desc"), false,
+            false, true, null));
+    args.add(new BooleanOption(
+            MessageManager.getString("label.trim_termini"),
+            MessageManager.getString("label.trim_termini_desc"), false,
+            false, true, null));
+    args.add(new LogarithmicParameter(
+            MessageManager.getString("label.seq_e_value"),
+            MessageManager.getString("label.seq_e_value_desc"), false,
+            -9.96578, -126d, 3.3219d, 2d));
+    /*
+    args.add(new DoubleParameter(
+            MessageManager.getString("label.seq_score"),
+            MessageManager.getString("label.seq_score_desc"), false,
+            0d, 0d, 10000d));
+       */
+    args.add(new LogarithmicParameter(
+            MessageManager.getString("label.dom_e_value_desc"),
+            MessageManager.getString("label.dom_e_value_desc"), false,
+            -9.96578, -126d, 3.3219d, 2d));
+    /*
+    args.add(new DoubleParameter(
+            MessageManager.getString("label.dom_score"),
+            MessageManager.getString("label.dom_score_desc"), false, 0d,
+            0d,
+            10000d));
+            */
+  }
+
+  private void getHMMAlignParams(List<ArgumentI> args)
+  {
+    args.add(new BooleanOption(
+            MessageManager.getString("label.trim_termini"),
+            MessageManager.getString(
+                    "label.trim_termini = Trim Non-Matching Termini_desc"),
+            false, false, true, null));
+  }
+
   @Override
   public boolean presetExists(String name)
   {