3 import static org.testng.Assert.assertEquals;
4 import static org.testng.Assert.assertNotEquals;
5 import static org.testng.Assert.fail;
7 import jalview.bin.Jalview;
8 import jalview.datamodel.Alignment;
9 import jalview.datamodel.AlignmentI;
10 import jalview.datamodel.HiddenMarkovModel;
11 import jalview.datamodel.SequenceI;
12 import jalview.gui.AlignFrame;
13 import jalview.gui.Desktop;
14 import jalview.io.DataSourceType;
15 import jalview.io.FastaFile;
16 import jalview.io.FileParse;
17 import jalview.ws.params.ArgumentI;
19 import java.io.IOException;
20 import java.net.MalformedURLException;
21 import java.util.ArrayList;
22 import java.util.List;
24 import org.testng.annotations.AfterClass;
25 import org.testng.annotations.BeforeClass;
26 import org.testng.annotations.Test;
29 public class HMMERTest {
33 @BeforeClass(alwaysRun = true)
34 public static void setUpBeforeClass() throws Exception
38 { "-noquestionnaire", "-nonews", "-props",
39 "test/jalview/hmmer/testProps.jvprops" });
42 @AfterClass(alwaysRun = true)
43 public static void tearDownAfterClass() throws Exception
45 Desktop.instance.closeAll_actionPerformed(null);
49 public void testHMMBuild() throws MalformedURLException, IOException
51 FastaFile file = null;
55 new FileParse("examples/uniref50.fa", DataSourceType.FILE));
56 } catch (IOException e)
61 SequenceI[] seqs = file.getSeqsAsArray();
62 AlignmentI al = new Alignment(seqs);
63 frame = new AlignFrame(al, 150, 20);
65 HMMBuildThread thread = new HMMBuildThread(frame,
66 new ArrayList<ArgumentI>());
67 thread.hmmbuildWaitTillComplete();
69 SequenceI seq = frame.getViewport().getAlignment().getSequenceAt(0);
70 HiddenMarkovModel hmm = seq.getHMM();
76 assertEquals(hmm.getLength().intValue(), 148);
77 assertEquals(hmm.getAlphabetType(), "amino");
78 assertEquals(hmm.getName(), "Alignment");
79 assertEquals(hmm.getEffectiveNumberOfSequences(), 0.648193, 0.0001);
80 assertEquals(hmm.getConsensusAtAlignColumn(15), 's');
84 public void testHMMAlign() throws MalformedURLException, IOException
86 HMMAlignThread thread = new HMMAlignThread(frame, true,
87 new ArrayList<ArgumentI>());
90 thread.hmmalignWaitTillComplete();
97 if (Desktop.getAlignFrames() == null)
102 AlignFrame frame = Desktop.getAlignFrames()[0];
103 AlignmentI al = frame.getViewport().getAlignment();
104 assertNotEquals(al, null);
105 List<SequenceI> hmmSeqs = al.getHMMConsensusSequences(false);
106 assertNotEquals(hmmSeqs, null);