JAL-2629 adjust placement and optionality of arguments/options
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 10 May 2018 12:34:37 +0000 (13:34 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 10 May 2018 12:34:37 +0000 (13:34 +0100)
src/jalview/hmmer/HMMERParamStore.java

index b609f69..37ad435 100644 (file)
@@ -127,11 +127,12 @@ public final class HMMERParamStore implements ParamDatastoreI
         }
       }
       nameScanner.close();
-      args.add(new Option(MessageManager.getString(HMMSearch.DATABASE_KEY),
+      args.add(new StringParameter(
+              MessageManager.getString(HMMSearch.DATABASE_KEY),
               MessageManager.getString("label.database_for_hmmsearch"),
               true, MessageManager.getString(HMMSearch.THIS_ALIGNMENT_KEY),
               MessageManager.getString(HMMSearch.THIS_ALIGNMENT_KEY),
-              databases, null));
+              databases));
     }
     args.add(new BooleanOption(
             MessageManager.getString(HMMSearch.AUTO_ALIGN_SEQS_KEY),
@@ -205,7 +206,7 @@ public final class HMMERParamStore implements ParamDatastoreI
   protected void addChoiceOfHmm(List<ArgumentI> args)
   {
     List<SequenceI> hmms = viewport.getAlignment().getHmmSequences();
-    if (!hmms.isEmpty())
+    if (hmms.size() > 1)
     {
       List<String> options = new ArrayList<>();
       for (SequenceI hmmSeq : hmms)
@@ -213,9 +214,10 @@ public final class HMMERParamStore implements ParamDatastoreI
         options.add(hmmSeq.getName());
       }
       String defseq = options.get(0);
-      Option option = new Option(MessageManager.getString("label.use_hmm"),
-              "", true, defseq, defseq, options, null);
-      args.add(option);
+      ArgumentI arg = new StringParameter(
+              MessageManager.getString("label.use_hmm"), null, true, defseq,
+              defseq, options);
+      args.add(arg);
     }
   }
 
@@ -250,16 +252,20 @@ public final class HMMERParamStore implements ParamDatastoreI
 
     /*
      * choice of whether to compute HMM for alignment and/or group(s)
+     * - only if there are any groups
      */
-    Collection<String> options = new ArrayList<>();
-    options.add(MessageManager.getString("label.alignment"));
-    options.add(MessageManager.getString("label.groups_and_alignment"));
-    options.add(MessageManager.getString("label.groups"));
-    options.add(MessageManager.getString("label.selected_group"));
-    args.add(new Option(MessageManager.getString("label.hmmbuild_for"),
-            MessageManager.getString("label.hmmbuild_for_desc"), true,
-            MessageManager.getString("label.alignment"),
-            MessageManager.getString("label.alignment"), options, null));
+    if (!viewport.getAlignment().getGroups().isEmpty())
+    {
+      Collection<String> options = new ArrayList<>();
+      options.add(MessageManager.getString("label.alignment"));
+      options.add(MessageManager.getString("label.groups_and_alignment"));
+      options.add(MessageManager.getString("label.groups"));
+      options.add(MessageManager.getString("label.selected_group"));
+      args.add(new Option(MessageManager.getString("label.hmmbuild_for"),
+              MessageManager.getString("label.hmmbuild_for_desc"), true,
+              MessageManager.getString("label.alignment"),
+              MessageManager.getString("label.alignment"), options, null));
+    }
   }
 
   @Override