package jalview.hmmer;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
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;
import java.util.ArrayList;
+import java.util.List;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@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];
}
throws MalformedURLException, IOException
{
/*
- * run hmmbuild - note the side-effect of selecting the HMM
- * sequence that gets added to the alignment
+ * run hmmbuild
*/
testHMMBuild();
- HiddenMarkovModel hmm = frame.getSelectedHMM();
- assertNotNull(hmm);
+ List<SequenceI> hmms = frame.getViewport().getAlignment()
+ .getHmmSequences();
+ assertFalse(hmms.isEmpty());
/*
- * now run hmmalign - with respect to the select HMM profile
+ * now run hmmalign - by default with respect to the added HMM profile
*/
testHMMAlign();
}
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);
assertEquals(hmm.getName(), "Alignment_HMM");
assertEquals(hmm.getProperty(HMMFile.EFF_NUMBER_OF_SEQUENCES),
"0.648193");
- assertEquals(hmm.getConsensusAtAlignColumn(15), 's');
}
public void testHMMAlign()
{
- HMMAlign thread = new HMMAlign(frame,
+ HmmerCommand thread = new HMMAlign(frame,
new ArrayList<ArgumentI>());
thread.run();
assertNotNull(original);
AlignmentI realigned = alignFrames[1].getViewport().getAlignment();
assertNotNull(realigned);
- assertNotNull(original.getHmmConsensus());
- assertNotNull(realigned.getHmmConsensus());
+ assertFalse(original.getHmmSequences().isEmpty());
+ assertFalse(realigned.getHmmSequences().isEmpty());
SequenceI ferCapan = original.findName("FER_CAPAN");
assertTrue(ferCapan.getSequenceAsString().startsWith("MA------SVSAT"));