JAL-2629 ensure hmm consensus sequence set on alignment output
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 30 Mar 2018 14:33:11 +0000 (15:33 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 30 Mar 2018 14:33:11 +0000 (15:33 +0100)
src/jalview/hmmer/HMMAlign.java
test/jalview/hmmer/HMMERTest.java

index 6255e9f..44828aa 100644 (file)
@@ -211,6 +211,14 @@ public class HMMAlign extends HmmerCommand
       al.setDataset(dataset);
     }
 
+    /*
+     * hack to ensure hmm set on alignment
+     */
+    if (al.getSequenceAt(0).isHMMConsensusSequence())
+    {
+      al.setHmmConsensus(al.getSequenceAt(0));
+    }
+
     displayInNewFrame(al, allOrders, hidden, title);
   }
 
index 7c8d637..8f96d04 100644 (file)
@@ -12,7 +12,9 @@ import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
 import jalview.io.HMMFile;
+import jalview.util.MessageManager;
 import jalview.ws.params.ArgumentI;
+import jalview.ws.params.simple.Option;
 
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -29,17 +31,15 @@ public class HMMERTest {
   @BeforeClass(alwaysRun = true)
   public void setUpBeforeClass() throws Exception
   {
+    /*
+     * NB: check HMMER_PATH in testProps.jvprops is valid for
+     * the machine on which this runs
+     */
     Jalview.main(
             new String[]
     { "-noquestionnaire", "-nonews", "-props",
                 "test/jalview/hmmer/testProps.jvprops", "-open",
                 "examples/uniref50.fa" });
-    // FastaFile file = null;
-    // file = new FastaFile(
-    // new FileParse("examples/uniref50.fa", DataSourceType.FILE));
-    // SequenceI[] seqs = file.getSeqsAsArray();
-    // AlignmentI al = new Alignment(seqs);
-    // frame = new AlignFrame(al, 150, 20);
     frame = Desktop.getAlignFrames()[0];
   }
 
@@ -75,8 +75,16 @@ public class HMMERTest {
 
   public void testHMMBuild()
   {
-    HMMBuild builder = new HMMBuild(frame,
-            new ArrayList<ArgumentI>());
+    /*
+     * set up argument to run hmmbuild for the alignment
+     */
+    ArrayList<ArgumentI> params = new ArrayList<>();
+    String argName = MessageManager.getString("label.hmmbuild_for");
+    String argValue = MessageManager.getString("label.alignment");
+    params.add(
+            new Option(argName, null, false, null, argValue, null, null));
+
+    HMMBuild builder = new HMMBuild(frame, params);
     builder.run();
 
     SequenceI seq = frame.getViewport().getAlignment().getSequenceAt(0);
@@ -88,7 +96,6 @@ public class HMMERTest {
     assertEquals(hmm.getName(), "Alignment_HMM");
     assertEquals(hmm.getProperty(HMMFile.EFF_NUMBER_OF_SEQUENCES),
             "0.648193");
-    assertEquals(hmm.getConsensusAtAlignColumn(15), 's');
   }
 
   public void testHMMAlign()