JAL-2629 exported HMMs are now named correctly
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Tue, 15 Aug 2017 11:14:13 +0000 (12:14 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Tue, 15 Aug 2017 11:14:13 +0000 (12:14 +0100)
src/jalview/hmmer/HMMBuildThread.java

index 63236ea..853b5f1 100644 (file)
@@ -24,9 +24,9 @@ public class HMMBuildThread implements Runnable
   HMMERCommands cmds = new HMMERCommands();
   AlignFrame af;
   AlignmentI alignment;
-
   SequenceGroup group;
 
+  boolean forGroup = false;
   boolean canRun = true;
 
   File hmmTemp = null;
@@ -41,6 +41,7 @@ public class HMMBuildThread implements Runnable
     if (af.getViewport().getSelectionGroup() != null)
     {
       group = af.getViewport().getSelectionGroup();
+      forGroup = true;
     }
     alignment = af.getViewport().getAlignment();
 
@@ -78,7 +79,7 @@ public class HMMBuildThread implements Runnable
         List<SequenceI> seqs = alignment
                 .getHMMConsensusSequences(true);
         cmds.setHmmSeqs(seqs);
-        if (group != null)
+        if (forGroup)
         {
           array = group.getSelectionAsNewSequences(alignment);
         }
@@ -90,6 +91,7 @@ public class HMMBuildThread implements Runnable
           }
           array = alignment.getSequencesArray();
         }
+
         SequenceI[] newArr = new SequenceI[array.length];
         int index = 0;
         for (SequenceI seq : array)
@@ -97,6 +99,7 @@ public class HMMBuildThread implements Runnable
           newArr[index] = new Sequence(seq);
           index++;
         }
+
         cmds.uniquifySequences(newArr);
         cmds.exportData(newArr, stoTemp, null, null);
         jalview.analysis.SeqsetUtils.deuniquify(cmds.hash, array);
@@ -150,8 +153,21 @@ public class HMMBuildThread implements Runnable
     {
       return false;
     }
-    String command = cmds.HMMERFOLDER + cmds.HMMBUILD + cmds.NAME
-            + af.getName() + cmds.SPACE;
+    String command = cmds.HMMERFOLDER + cmds.HMMBUILD + cmds.NAME;
+    if (forGroup)
+    {
+      command += group.getName();
+    }
+    else
+    {
+      String name = af.getName();
+      if (name == null)
+      {
+        name = "Alignment";
+      }
+      command += name;
+    }
+    command += cmds.SPACE;
     if (!alignment.isNucleotide())
     {
       command += cmds.FORCEAMINO; // TODO check for rna