add tests for HMMFile class
[jalview.git] / test / jalview / io / HMMFileTest.java
1 package jalview.io;
2
3 import static org.testng.Assert.assertEquals;
4 import static org.testng.Assert.assertNull;
5
6 import java.io.BufferedReader;
7 import java.io.File;
8 import java.io.FileReader;
9 import java.io.IOException;
10 import java.util.ArrayList;
11 import java.util.List;
12 import java.util.Scanner;
13
14 import org.testng.annotations.Test;
15
16 public class HMMFileTest {
17
18   HMMFile testFile = new HMMFile("H:/HMMERFile.txt");
19
20   File file = new File("H:/HMMERFile.txt");
21
22   HMMFile testFile2 = new HMMFile("H:/EmptyFile.txt");
23
24   File file2 = new File("H:/EmptyFile.txt");
25
26   HMMFile testFile3 = new HMMFile("H:/HMMERFile2.txt");
27
28   File file3 = new File("H:/HMMERFile2.txt");
29
30   HMMFile testFile4 = new HMMFile("H:/HMMERFile.txt");
31
32   File file4 = new File("H:/HMMERFile.txt");
33
34   @Test
35   public void testParse() throws IOException
36   {
37     HMMFile integrationTestFile = new HMMFile("H:/HMMTutorialExample.hmm");
38     integrationTestFile.parse();
39
40     // file properties
41     assertEquals(integrationTestFile.hmm.getName(), "MADE1");
42     assertEquals(integrationTestFile.hmm.getAccessionNumber(),
43             "DF0000629.2");
44     assertEquals(integrationTestFile.hmm.getDescription(),
45             "MADE1 (MAriner Derived Element 1), a TcMar-Mariner DNA transposon");
46     assertEquals(integrationTestFile.hmm.getLength().intValue(), 80);
47     assertEquals(integrationTestFile.hmm.getMaxInstanceLength().intValue(),
48             426);
49     assertEquals(integrationTestFile.hmm.getAlphabetType(), "DNA");
50     assertEquals(integrationTestFile.hmm.getReferenceAnnotationFlag(),
51             true);
52     assertEquals(integrationTestFile.hmm.getModelMaskedFlag(), false);
53     assertEquals(
54             integrationTestFile.hmm.getConsensusResidueAnnotationFlag(),
55             true);
56     assertEquals(
57             integrationTestFile.hmm.getConsensusStructureAnnotationFlag(),
58             false);
59     assertEquals(integrationTestFile.hmm.getMapAnnotationFlag(), true);
60     assertEquals(integrationTestFile.hmm.getDate(),
61             "Tue Feb 19 20:33:41 2013");
62     assertNull(integrationTestFile.hmm.getCommandLineLog());
63     assertEquals(integrationTestFile.hmm.getSequenceNumber().intValue(),
64             1997);
65     assertEquals(integrationTestFile.hmm.getEffectiveSequenceNumber(),
66             3.911818, 4d);
67     assertEquals(integrationTestFile.hmm.getCheckSum().longValue(),
68             3015610723l);
69     assertNull(integrationTestFile.hmm.getGatheringThreshold1());
70     assertNull(integrationTestFile.hmm.getGatheringThreshold2());
71     assertNull(integrationTestFile.hmm.getTrustedCutoff1());
72     assertNull(integrationTestFile.hmm.getTrustedCutoff2());
73     assertNull(integrationTestFile.hmm.getNoiseCutoff1());
74     assertNull(integrationTestFile.hmm.getNoiseCutoff2());
75     assertEquals(integrationTestFile.hmm.getSlopeOfDistribution("MSV"),
76             -8.5786, 4d);
77     assertEquals(integrationTestFile.hmm.getSlopeOfDistribution("VITERBI"),
78             -9.3632, 4d);
79     assertEquals(integrationTestFile.hmm.getSlopeOfDistribution("FORWARD"),
80             -3.4823, 4d);
81     assertEquals(integrationTestFile.hmm.getLocationOfDistribution("MSV"),
82             0.71858, 4d);
83     assertEquals(
84             integrationTestFile.hmm.getLocationOfDistribution("VITERBI"),
85             0.71858, 4d);
86     assertEquals(
87             integrationTestFile.hmm.getLocationOfDistribution("FORWARD"),
88             0.71858, 4d);
89
90     List<Character> symbols = new ArrayList<>();
91     symbols.add('A');
92     symbols.add('C');
93     symbols.add('G');
94     symbols.add('T');
95
96     assertEquals(integrationTestFile.hmm.getSymbols(), symbols);
97
98     List<Double> averages = new ArrayList<>();
99     averages.add(1.24257);
100     averages.add(1.59430);
101     averages.add(1.62906);
102     averages.add(1.16413);
103
104     assertEquals(integrationTestFile.hmm
105             .getAverageMatchStateEmissionProbabilities(), averages);
106
107     assertEquals(integrationTestFile.hmm.getInsertZeroEmissions().get(2),
108             1.38629);
109     assertEquals(integrationTestFile.hmm.getInsertZeroEmissions().get(3),
110             1.38629);
111
112     assertEquals(integrationTestFile.hmm.getBeginStateTransitions().get(1),
113             3.94183);
114     assertEquals(integrationTestFile.hmm.getBeginStateTransitions().get(4),
115             0.26236);
116
117     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(1).get(1),
118             2.37873);
119     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(8).get(0),
120             2.16916);
121     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(12).get(2),
122             2.32214);
123     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(43).get(3),
124             2.60783);
125     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(54).get(2),
126             2.46442);
127     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(23).get(2),
128             2.50691);
129     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(56).get(1),
130             2.32720);
131     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(65).get(0),
132             2.79349);
133     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(21).get(0),
134             2.54484);
135     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(79).get(3),
136             2.88183);
137     assertEquals(integrationTestFile.hmm.getMatchEmissions().get(76).get(3),
138             1.84373);
139     
140     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(23).get(0),
141             1.35803);
142     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(54).get(3),
143             1.46331);
144     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(65).get(3),
145             1.39101);
146     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(57).get(2),
147             1.38112);
148     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(42).get(1),
149             1.58747);
150     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(12).get(3),
151             1.38740);
152     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(6).get(1),
153             1.38524);
154     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(59).get(0),
155             1.03649);
156     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(78).get(0),
157             1.38629);
158     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(17).get(2),
159             1.39937);
160     assertEquals(integrationTestFile.hmm.getInsertEmissions().get(0).get(2),
161             1.38629);
162
163     assertEquals(
164             integrationTestFile.hmm.getStateTransitions().get(13).get(1),
165             4.02482);
166     assertEquals(
167             integrationTestFile.hmm.getStateTransitions().get(64).get(2),
168             4.03073);
169     assertEquals(
170             integrationTestFile.hmm.getStateTransitions().get(45).get(6),
171             0.42814);
172     assertEquals(
173             integrationTestFile.hmm.getStateTransitions().get(71).get(4),
174             0.28542);
175     assertEquals(
176             integrationTestFile.hmm.getStateTransitions().get(32).get(5),
177             1.18729);
178     assertEquals(
179             integrationTestFile.hmm.getStateTransitions().get(9).get(0),
180             0.03536);
181     assertEquals(
182             integrationTestFile.hmm.getStateTransitions().get(0).get(3),
183             1.46634);
184     assertEquals(
185             integrationTestFile.hmm.getStateTransitions().get(31).get(6),
186             0.44749);
187     assertNull(
188             integrationTestFile.hmm.getStateTransitions().get(79).get(2));
189     assertEquals(
190             integrationTestFile.hmm.getStateTransitions().get(3).get(1),
191             4.05203);
192     assertEquals(
193             integrationTestFile.hmm.getStateTransitions().get(16).get(4),
194             0.26771);
195
196     assertEquals(integrationTestFile.hmm.getAlignmentColumnIndexes().get(0)
197             .intValue(), 1);
198     assertEquals(integrationTestFile.hmm.getAlignmentColumnIndexes().get(9)
199             .intValue(), 18);
200     assertEquals(integrationTestFile.hmm.getAlignmentColumnIndexes().get(12)
201             .intValue(), 28);
202     assertEquals(integrationTestFile.hmm.getAlignmentColumnIndexes().get(56)
203             .intValue(), 999);
204     assertEquals(integrationTestFile.hmm.getAlignmentColumnIndexes().get(79)
205             .intValue(), 1112);
206
207     assertEquals(integrationTestFile.hmm.getAnnotations().get(0).get("RF")
208             .charValue(), 'x');
209     assertEquals(integrationTestFile.hmm.getAnnotations().get(3).get("CS")
210             .charValue(), '-');
211     assertEquals(integrationTestFile.hmm.getAnnotations().get(65)
212             .get("CONS").charValue(), 't');
213     assertEquals(integrationTestFile.hmm.getAnnotations().get(23).get("MM")
214             .charValue(), '-');
215     assertEquals(integrationTestFile.hmm.getAnnotations().get(56).get("MM")
216             .charValue(), '-');
217     assertEquals(integrationTestFile.hmm.getAnnotations().get(76).get("RF")
218             .charValue(), 'x');
219     assertEquals(integrationTestFile.hmm.getAnnotations().get(79)
220             .get("CONS").charValue(), 'a');
221
222   }
223
224   @Test
225   public void testParseFileProperties() throws IOException
226   {
227     FileReader fr = new FileReader(file);
228     BufferedReader br = new BufferedReader(fr);
229     testFile.parseFileProperties(br);
230     br.close();
231     fr.close();
232     assertEquals(testFile.hmm.getName(), "fn3");
233     assertEquals(testFile.hmm.getAccessionNumber(), "PF00041.13");
234     assertEquals(testFile.hmm.getDescription(),
235             "Fibronectin type III domain");
236     assertEquals(testFile.hmm.getLength().intValue(), 4);
237     assertNull(testFile.hmm.getMaxInstanceLength());
238     assertEquals(testFile.hmm.getAlphabetType(), "amino");
239     assertEquals(testFile.hmm.getReferenceAnnotationFlag(), false);
240     assertEquals(testFile.hmm.getModelMaskedFlag(), false);
241     assertEquals(testFile.hmm.getConsensusResidueAnnotationFlag(), true);
242     assertEquals(testFile.hmm.getConsensusStructureAnnotationFlag(), true);
243     assertEquals(testFile.hmm.getMapAnnotationFlag(), true);
244     assertEquals(testFile.hmm.getDate(), "Fri Feb 15 06:04:13 2013");
245     assertNull(testFile.hmm.getCommandLineLog());
246     assertEquals(testFile.hmm.getSequenceNumber().intValue(), 106);
247     assertEquals(testFile.hmm.getEffectiveSequenceNumber(), 11.415833, 4d);
248     assertEquals(testFile.hmm.getCheckSum().longValue(), 3564431818l);
249     assertEquals(testFile.hmm.getGatheringThreshold1(), 8.00, 2d);
250     assertEquals(testFile.hmm.getGatheringThreshold2(), 7.20, 2d);
251     assertEquals(testFile.hmm.getTrustedCutoff1(), 8.00, 2d);
252     assertEquals(testFile.hmm.getTrustedCutoff2(), 7.20, 2d);
253     assertEquals(testFile.hmm.getNoiseCutoff1(), 7.90, 2d);
254     assertEquals(testFile.hmm.getNoiseCutoff2(), 7.90, 2d);
255     assertEquals(testFile.hmm.getSlopeOfDistribution("MSV"), -9.4043, 4d);
256     assertEquals(testFile.hmm.getSlopeOfDistribution("VITERBI"), -9.7737,
257             4d);
258     assertEquals(testFile.hmm.getSlopeOfDistribution("FORWARD"), -3.8341,
259             4d);
260     assertEquals(testFile.hmm.getLocationOfDistribution("MSV"), 0.71847,
261             4d);
262     assertEquals(testFile.hmm.getLocationOfDistribution("VITERBI"), 0.71847,
263             4d);
264     assertEquals(testFile.hmm.getLocationOfDistribution("FORWARD"), 0.71847,
265             4d);
266
267     FileReader fr2 = new FileReader(file2);
268     BufferedReader br2 = new BufferedReader(fr2);
269     testFile2.parseFileProperties(br2);
270     br2.close();
271     fr2.close();
272
273     assertNull(testFile2.hmm.getName());
274     assertNull(testFile2.hmm.getAccessionNumber());
275     assertNull(testFile2.hmm.getDescription());
276     assertNull(testFile2.hmm.getLength());
277     assertNull(testFile2.hmm.getMaxInstanceLength());
278     assertNull(testFile2.hmm.getAlphabetType());
279     assertEquals(testFile2.hmm.getReferenceAnnotationFlag(), false);
280     assertEquals(testFile2.hmm.getModelMaskedFlag(), false);
281     assertEquals(testFile2.hmm.getConsensusResidueAnnotationFlag(), false);
282     assertEquals(testFile2.hmm.getConsensusStructureAnnotationFlag(),
283             false);
284     assertEquals(testFile2.hmm.getMapAnnotationFlag(), false);
285     assertNull(testFile2.hmm.getDate());
286     assertNull(testFile2.hmm.getCommandLineLog());
287     assertNull(testFile2.hmm.getSequenceNumber());
288     assertNull(testFile2.hmm.getEffectiveSequenceNumber());
289     assertNull(testFile2.hmm.getCheckSum());
290     assertNull(testFile2.hmm.getGatheringThreshold1());
291     assertNull(testFile2.hmm.getGatheringThreshold2());
292     assertNull(testFile2.hmm.getTrustedCutoff1());
293     assertNull(testFile2.hmm.getTrustedCutoff2());
294     assertNull(testFile2.hmm.getNoiseCutoff1());
295     assertNull(testFile2.hmm.getNoiseCutoff2());
296     assertNull(testFile2.hmm.getSlopeOfDistribution("MSV"));
297     assertNull(testFile2.hmm.getSlopeOfDistribution("VITERBI"));
298     assertNull(testFile2.hmm.getSlopeOfDistribution("FORWARD"));
299     assertNull(testFile2.hmm.getLocationOfDistribution("MSV"));
300     assertNull(testFile2.hmm.getLocationOfDistribution("VITERBI"));
301     assertNull(testFile2.hmm.getLocationOfDistribution("FORWARD"));
302
303     FileReader fr3 = new FileReader(file3);
304     BufferedReader br3 = new BufferedReader(fr3);
305     testFile3.parseFileProperties(br3);
306     br3.close();
307     fr3.close();
308
309     assertEquals(testFile3.hmm.getName(), "th4");
310     assertEquals(testFile3.hmm.getAccessionNumber(), "PF99041.16");
311     assertEquals(testFile3.hmm.getDescription(),
312             "Fibronectin type I domain");
313     assertEquals(testFile3.hmm.getLength().intValue(), 10);
314     assertEquals(testFile3.hmm.getMaxInstanceLength().intValue(), 6);
315     assertEquals(testFile3.hmm.getAlphabetType(), "amino");
316     assertEquals(testFile3.hmm.getReferenceAnnotationFlag(), true);
317     assertEquals(testFile3.hmm.getModelMaskedFlag(), false);
318     assertEquals(testFile3.hmm.getConsensusResidueAnnotationFlag(), false);
319     assertEquals(testFile3.hmm.getConsensusStructureAnnotationFlag(),
320             false);
321     assertEquals(testFile3.hmm.getMapAnnotationFlag(), false);
322     assertEquals(testFile3.hmm.getDate(), "Tue Jan 01 11:02:59 2000");
323     assertEquals(testFile3.hmm.getCommandLineLog(), "this is the log");
324     assertEquals(testFile3.hmm.getSequenceNumber().intValue(), 567);
325     assertEquals(testFile3.hmm.getEffectiveSequenceNumber(), 15.964683, 4d);
326     assertEquals(testFile3.hmm.getCheckSum().longValue(), 9485949654l);
327     assertEquals(testFile3.hmm.getGatheringThreshold1(), 6.40, 2d);
328     assertEquals(testFile3.hmm.getGatheringThreshold2(), 7.20, 2d);
329     assertEquals(testFile3.hmm.getTrustedCutoff1(), 2.40, 2d);
330     assertEquals(testFile3.hmm.getTrustedCutoff2(), 7.00, 2d);
331     assertNull(testFile3.hmm.getNoiseCutoff1());
332     assertNull(testFile3.hmm.getNoiseCutoff2());
333     assertNull(testFile3.hmm.getSlopeOfDistribution("MSV"));
334     assertNull(testFile3.hmm.getSlopeOfDistribution("VITERBI"));
335     assertNull(testFile3.hmm.getSlopeOfDistribution("FORWARD"));
336     assertNull(testFile3.hmm.getLocationOfDistribution("MSV"));
337     assertNull(testFile3.hmm.getLocationOfDistribution("VITERBI"));
338     assertNull(testFile3.hmm.getLocationOfDistribution("FORWARD"));
339   }
340
341   /**
342    * @Test public void testParseModel() throws IOException { HiddenMarkovModel
343    *       hmm = new HiddenMarkovModel(); HMMFile testFile = new HMMFile(hmm,
344    *       "H:/HMMERFile.txt"); File file = new File("H:/HMMERFile.txt");
345    *       FileReader fr = new FileReader(file); BufferedReader br = new
346    *       BufferedReader(fr); testFile.parseFileProperties(br);
347    *       testFile.parseModel(br); br.close(); fr.close();
348    * 
349    *       }
350    **/
351
352   @Test
353   public void testGetTransitionType()
354   {
355
356     assertEquals(testFile.getTransitionType("mm").intValue(), 0);
357     assertEquals(testFile.getTransitionType("mi").intValue(), 1);
358     assertEquals(testFile.getTransitionType("md").intValue(), 2);
359     assertEquals(testFile.getTransitionType("im").intValue(), 3);
360     assertEquals(testFile.getTransitionType("ii").intValue(), 4);
361     assertEquals(testFile.getTransitionType("dm").intValue(), 5);
362     assertEquals(testFile.getTransitionType("dd").intValue(), 6);
363     assertNull(testFile.getTransitionType("df"));
364
365   }
366
367   @Test
368   public void testReadStats()
369   {
370     Scanner scanner = new Scanner("LOCAL MSV 5.6943 6.2313");
371     testFile.readStats(scanner);
372     assertEquals(testFile.hmm.getEValueStatistics().get("MSV")
373             .getAlignmentModeConfiguration(), "LOCAL");
374     assertEquals(
375             testFile.hmm.getEValueStatistics().get("MSV")
376                     .getSlopeOfDistribution(),
377             5.6943, 4d);
378     assertEquals(testFile.hmm.getEValueStatistics().get("MSV")
379             .getLocationOfDistribution(), 6.2313, 4d);
380     scanner.close();
381
382     Scanner scanner2 = new Scanner("GLOBAL VITERBI 3 -0.234");
383     testFile.readStats(scanner2);
384     assertEquals(testFile.hmm.getEValueStatistics().get("VITERBI")
385             .getAlignmentModeConfiguration(), "GLOBAL");
386     assertEquals(testFile.hmm.getEValueStatistics().get("VITERBI")
387             .getSlopeOfDistribution(), 3, 2d);
388     assertEquals(testFile.hmm.getEValueStatistics().get("VITERBI")
389             .getLocationOfDistribution(), -0.234, 4d);
390     scanner.close();
391
392   }
393
394   @Test
395   public void testParseBeginNodeData() throws IOException
396   {
397     FileReader fr = new FileReader(file4);
398     BufferedReader br = new BufferedReader(fr);
399     for (int i = 0; i < 24; i++)
400     {
401       br.readLine(); // this is done to reach the begin node
402                                          // data in the file
403     }
404
405     testFile4.hmm.fillSymbols("HMM A B C D E F G H I");
406     testFile4.parseBeginNodeData(br);
407     ArrayList<Double> emissions = new ArrayList<>();
408     ArrayList<Double> transitions = new ArrayList<>();
409
410     emissions.add(2.68618);
411     emissions.add(4.42225);
412     emissions.add(2.77519);
413     emissions.add(2.73123);
414     emissions.add(3.46354);
415     emissions.add(2.40513);
416     emissions.add(3.72494);
417     emissions.add(3.29354);
418     emissions.add(3.61503);
419
420     transitions.add(0.00338);
421     transitions.add(6.08833);
422     transitions.add(6.81068);
423     transitions.add(0.61958);
424     transitions.add(0.77255);
425     transitions.add(0.00000);
426     transitions.add(null);
427
428     assertEquals(testFile4.hmm.getInsertZeroEmissions(), emissions);
429     assertEquals(testFile4.hmm.getBeginStateTransitions(), transitions);
430
431   }
432
433   @Test
434   public void testFillList()
435   {
436     Scanner scanner1 = new Scanner("1.3 2.4 5.3 3.9 9.8 4.7 4.3 2.3 6.9");
437     ArrayList<Double> filledArray = new ArrayList<>();
438
439     filledArray.add(1.3);
440     filledArray.add(2.4);
441     filledArray.add(5.3);
442     filledArray.add(3.9);
443     filledArray.add(9.8);
444     filledArray.add(4.7);
445     filledArray.add(4.3);
446     filledArray.add(2.3);
447     filledArray.add(6.9);
448
449     assertEquals(HMMFile.fillList(scanner1, 9), filledArray);
450     filledArray.clear();
451     scanner1.close();
452
453     Scanner scanner2 = new Scanner(
454             "1.346554 5.58756754 35.3523645 12345.3564 1.4");
455     filledArray.add(1.346554);
456     filledArray.add(5.58756754);
457     filledArray.add(35.3523645);
458     filledArray.add(12345.3564);
459     filledArray.add(1.4);
460     assertEquals(HMMFile.fillList(scanner2, 5), filledArray);
461     scanner2.close();
462
463   }
464
465   @Test
466   public void testParseModel() throws IOException
467   {
468     FileReader fr = new FileReader(file);
469     BufferedReader br = new BufferedReader(fr);
470     for (int i = 0; i < 23; i++)
471     {
472       br.readLine(); // this is done to reach the begin node
473                      // data in the file
474     }
475
476     testFile.parseModel(br);
477     assertEquals(testFile.hmm.getMatchEmissions().get(0).get(0), 3.16986);
478     assertEquals(testFile.hmm.getMatchEmissions().get(0).get(3), 3.29953);
479     assertEquals(testFile.hmm.getMatchEmissions().get(1).get(2), 2.24744);
480     assertEquals(testFile.hmm.getMatchEmissions().get(1).get(8), 4.25623);
481     assertEquals(testFile.hmm.getMatchEmissions().get(2).get(5), 3.48010);
482     assertEquals(testFile.hmm.getMatchEmissions().get(2).get(6), 4.51877);
483     assertEquals(testFile.hmm.getMatchEmissions().get(3).get(4), 5.26587);
484     assertEquals(testFile.hmm.getMatchEmissions().get(3).get(8), 4.99111);
485     assertEquals(testFile.hmm.getInsertEmissions().get(0).get(3), 2.73088);
486     assertEquals(testFile.hmm.getInsertEmissions().get(0).get(6), 3.72505);
487     assertEquals(testFile.hmm.getInsertEmissions().get(1).get(2), 2.77519);
488     assertEquals(testFile.hmm.getInsertEmissions().get(1).get(8), 3.61503);
489     assertEquals(testFile.hmm.getInsertEmissions().get(2).get(0), 2.68618);
490     assertEquals(testFile.hmm.getInsertEmissions().get(2).get(8), 3.61503);
491     assertEquals(testFile.hmm.getInsertEmissions().get(3).get(2), 2.77519);
492     assertEquals(testFile.hmm.getInsertEmissions().get(3).get(3), 2.73123);
493   }
494
495   @Test
496   public void testParseAnnotations()
497   {
498     testFile4.hmm.setMapAnnotationFlag(true);
499     Scanner scanner = new Scanner("1 t - - -");
500     testFile4.parseAnnotations(scanner, 0);
501
502     assertEquals(
503             testFile4.hmm.getAlignmentColumnIndexes().get(0).intValue(), 1);
504     assertEquals(
505             testFile4.hmm.getAnnotations().get(0).get("CONS").charValue(),
506             't');
507     assertEquals(
508             testFile4.hmm.getAnnotations().get(0).get("RF").charValue(),
509             '-');
510     assertEquals(
511             testFile4.hmm.getAnnotations().get(0).get("MM").charValue(),
512             '-');
513     assertEquals(
514             testFile4.hmm.getAnnotations().get(0).get("CS").charValue(),
515             '-');
516
517     testFile4.hmm.setMapAnnotationFlag(false);
518     testFile4.hmm.getAlignmentColumnIndexes().clear();
519     testFile4.hmm.getAnnotations().clear();
520     Scanner scanner2 = new Scanner("- S g C Y");
521     testFile4.parseAnnotations(scanner2, 0);
522
523     assertEquals(
524             testFile4.hmm.getAnnotations().get(0).get("CONS").charValue(),
525             'S');
526     assertEquals(
527             testFile4.hmm.getAnnotations().get(0).get("RF").charValue(),
528             'g');
529     assertEquals(
530             testFile4.hmm.getAnnotations().get(0).get("MM").charValue(),
531             'C');
532     assertEquals(
533             testFile4.hmm.getAnnotations().get(0).get("CS").charValue(),
534             'Y');
535   }
536
537   @Test
538   public void testExportFile() throws IOException
539   {
540     HMMFile exportTestFile = new HMMFile("H:/HMMTutorialExample.hmm");
541     exportTestFile.parse();
542     exportTestFile.exportFile("H:/WriteTestFile.hmm");
543
544   }
545 }