From: gmungoc Date: Fri, 30 Mar 2018 14:33:11 +0000 (+0100) Subject: JAL-2629 ensure hmm consensus sequence set on alignment output X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b1a54bfee07ae00588a38864114d4c69b22fd971;p=jalview.git JAL-2629 ensure hmm consensus sequence set on alignment output --- diff --git a/src/jalview/hmmer/HMMAlign.java b/src/jalview/hmmer/HMMAlign.java index 6255e9f..44828aa 100644 --- a/src/jalview/hmmer/HMMAlign.java +++ b/src/jalview/hmmer/HMMAlign.java @@ -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); } diff --git a/test/jalview/hmmer/HMMERTest.java b/test/jalview/hmmer/HMMERTest.java index 7c8d637..8f96d04 100644 --- a/test/jalview/hmmer/HMMERTest.java +++ b/test/jalview/hmmer/HMMERTest.java @@ -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()); + /* + * set up argument to run hmmbuild for the alignment + */ + ArrayList 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()