Clover icon

Coverage Report

  1. Project Clover database Thu Dec 4 2025 16:11:35 GMT
  2. Package jalview.analysis

File AAFrequencyTest.java

 

Code metrics

10
257
15
1
566
371
20
0.08
17.13
15
1.33

Classes

Class Line # Actions
AAFrequencyTest 50 257 20
0.946808594.7%
 

Contributing tests

This file is covered by 12 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.analysis;
22   
23    import static org.testng.AssertJUnit.assertEquals;
24    import static org.testng.AssertJUnit.assertNull;
25   
26    import jalview.datamodel.AlignmentAnnotation;
27    import jalview.datamodel.Annotation;
28    import jalview.datamodel.HiddenMarkovModel;
29    import jalview.datamodel.Profile;
30    import jalview.datamodel.ProfileI;
31    import jalview.datamodel.Profiles;
32    import jalview.datamodel.ProfilesI;
33    import jalview.datamodel.ResidueCount;
34    import jalview.datamodel.Sequence;
35    import jalview.datamodel.SequenceGroup;
36    import jalview.datamodel.SequenceI;
37    import jalview.gui.JvOptionPane;
38    import jalview.io.DataSourceType;
39    import jalview.io.FileParse;
40    import jalview.io.HMMFile;
41   
42    import java.io.IOException;
43    import java.net.MalformedURLException;
44   
45    import java.util.Hashtable;
46   
47    import org.testng.annotations.BeforeClass;
48    import org.testng.annotations.Test;
49   
 
50    public class AAFrequencyTest
51    {
52    HiddenMarkovModel hmm;
53   
 
54  1 toggle @BeforeClass(alwaysRun = true)
55    public void setUpJvOptionPane()
56    {
57  1 JvOptionPane.setInteractiveMode(false);
58  1 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
59    }
60   
 
61  1 toggle @BeforeClass(alwaysRun = true)
62    public void setUp() throws IOException, MalformedURLException
63    {
64    /*
65    * load a dna (ACGT) HMM file to a HiddenMarkovModel
66    */
67  1 HMMFile hmmFile = new HMMFile(new FileParse(
68    "test/jalview/io/test_MADE1_hmm.txt", DataSourceType.FILE));
69  1 hmm = hmmFile.getHMM();
70    }
71   
 
72  1 toggle @Test(groups = { "Functional" })
73    public void testCalculate_noProfile()
74    {
75  1 SequenceI seq1 = new Sequence("Seq1", "CAG-T");
76  1 SequenceI seq2 = new Sequence("Seq2", "CAC-T");
77  1 SequenceI seq3 = new Sequence("Seq3", "C---G");
78  1 SequenceI seq4 = new Sequence("Seq4", "CA--t");
79  1 SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 };
80  1 int width = seq1.getLength();
81  1 ProfilesI result = AAFrequency.calculate(seqs, width, 0, width, false);
82   
83    // col 0 is 100% C
84  1 ProfileI col = result.get(0);
85  1 assertEquals(100f, col.getPercentageIdentity(false));
86  1 assertEquals(100f, col.getPercentageIdentity(true));
87  1 assertEquals(4, col.getMaxCount());
88  1 assertEquals("C", col.getModalResidue());
89  1 assertNull(col.getCounts());
90   
91    // col 1 is 75% A
92  1 col = result.get(1);
93  1 assertEquals(75f, col.getPercentageIdentity(false));
94  1 assertEquals(100f, col.getPercentageIdentity(true));
95  1 assertEquals(3, col.getMaxCount());
96  1 assertEquals("A", col.getModalResidue());
97   
98    // col 2 is 50% G 50% C or 25/25 counting gaps
99  1 col = result.get(2);
100  1 assertEquals(25f, col.getPercentageIdentity(false));
101  1 assertEquals(50f, col.getPercentageIdentity(true));
102  1 assertEquals(1, col.getMaxCount());
103  1 assertEquals("CG", col.getModalResidue());
104   
105    // col 3 is all gaps
106  1 col = result.get(3);
107  1 assertEquals(0f, col.getPercentageIdentity(false));
108  1 assertEquals(0f, col.getPercentageIdentity(true));
109  1 assertEquals(0, col.getMaxCount());
110  1 assertEquals("", col.getModalResidue());
111   
112    // col 4 is 75% T 25% G
113  1 col = result.get(4);
114  1 assertEquals(75f, col.getPercentageIdentity(false));
115  1 assertEquals(75f, col.getPercentageIdentity(true));
116  1 assertEquals(3, col.getMaxCount());
117  1 assertEquals("T", col.getModalResidue());
118    }
119   
 
120  1 toggle @Test(groups = { "Functional" })
121    public void testCalculate_withProfile()
122    {
123  1 SequenceI seq1 = new Sequence("Seq1", "CAGT");
124  1 SequenceI seq2 = new Sequence("Seq2", "CACT");
125  1 SequenceI seq3 = new Sequence("Seq3", "C--G");
126  1 SequenceI seq4 = new Sequence("Seq4", "CA-t");
127  1 SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 };
128  1 int width = seq1.getLength();
129  1 ProfilesI result = AAFrequency.calculate(seqs, width, 0, width, true);
130   
131  1 ProfileI profile = result.get(0);
132  1 assertEquals(4, profile.getCounts().getCount('C'));
133  1 assertEquals(4, profile.getHeight());
134  1 assertEquals(4, profile.getNonGapped());
135   
136  1 profile = result.get(1);
137  1 assertEquals(3, profile.getCounts().getCount('A'));
138  1 assertEquals(4, profile.getHeight());
139  1 assertEquals(3, profile.getNonGapped());
140   
141  1 profile = result.get(2);
142  1 assertEquals(1, profile.getCounts().getCount('C'));
143  1 assertEquals(1, profile.getCounts().getCount('G'));
144  1 assertEquals(4, profile.getHeight());
145  1 assertEquals(2, profile.getNonGapped());
146   
147  1 profile = result.get(3);
148  1 assertEquals(3, profile.getCounts().getCount('T'));
149  1 assertEquals(1, profile.getCounts().getCount('G'));
150  1 assertEquals(4, profile.getHeight());
151  1 assertEquals(4, profile.getNonGapped());
152    }
153   
 
154  0 toggle @Test(groups = { "Functional" }, enabled = false)
155    public void testCalculate_withProfileTiming()
156    {
157  0 SequenceI seq1 = new Sequence("Seq1", "CAGT");
158  0 SequenceI seq2 = new Sequence("Seq2", "CACT");
159  0 SequenceI seq3 = new Sequence("Seq3", "C--G");
160  0 SequenceI seq4 = new Sequence("Seq4", "CA-t");
161  0 SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 };
162   
163    // ensure class loaded and initialised
164  0 int width = seq1.getLength();
165  0 AAFrequency.calculate(seqs, width, 0, width, true);
166   
167  0 int reps = 100000;
168  0 long start = System.currentTimeMillis();
169  0 for (int i = 0; i < reps; i++)
170    {
171  0 AAFrequency.calculate(seqs, width, 0, width, true);
172    }
173  0 System.out.println(System.currentTimeMillis() - start);
174    }
175   
176    /**
177    * Test generation of consensus annotation with options 'include gaps'
178    * (profile percentages are of all sequences, whether gapped or not), and
179    * 'show logo' (the full profile with all residue percentages is reported in
180    * the description for the tooltip)
181    */
 
182  1 toggle @Test(groups = { "Functional" })
183    public void testCompleteConsensus_includeGaps_showLogo()
184    {
185    /*
186    * first compute the profiles
187    */
188  1 SequenceI seq1 = new Sequence("Seq1", "CAG-T");
189  1 SequenceI seq2 = new Sequence("Seq2", "CAC-T");
190  1 SequenceI seq3 = new Sequence("Seq3", "C---G");
191  1 SequenceI seq4 = new Sequence("Seq4", "CA--t");
192  1 SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 };
193  1 int width = seq1.getLength();
194  1 ProfilesI profiles = AAFrequency.calculate(seqs, width, 0, width, true);
195   
196  1 AlignmentAnnotation consensus = new AlignmentAnnotation("Consensus",
197    "PID", new Annotation[width]);
198  1 AAFrequency.completeConsensus(consensus, profiles, 0, 5, false, true,
199    4);
200   
201  1 Annotation ann = consensus.annotations[0];
202  1 assertEquals("C 100%", ann.description);
203  1 assertEquals("C", ann.displayCharacter);
204  1 ann = consensus.annotations[1];
205  1 assertEquals("A 75%", ann.description);
206  1 assertEquals("A", ann.displayCharacter);
207  1 ann = consensus.annotations[2];
208  1 assertEquals("C 25%; G 25%", ann.description);
209  1 assertEquals("+", ann.displayCharacter);
210  1 ann = consensus.annotations[3];
211  1 assertEquals("", ann.description);
212  1 assertEquals("-", ann.displayCharacter);
213  1 ann = consensus.annotations[4];
214  1 assertEquals("T 75%; G 25%", ann.description);
215  1 assertEquals("T", ann.displayCharacter);
216    }
217   
218    /**
219    * Test generation of consensus annotation with options 'ignore gaps' (profile
220    * percentages are of the non-gapped sequences) and 'no logo' (only the modal
221    * residue[s] percentage is reported in the description for the tooltip)
222    */
 
223  1 toggle @Test(groups = { "Functional" })
224    public void testCompleteConsensus_ignoreGaps_noLogo()
225    {
226    /*
227    * first compute the profiles
228    */
229  1 SequenceI seq1 = new Sequence("Seq1", "CAG-T");
230  1 SequenceI seq2 = new Sequence("Seq2", "CAC-T");
231  1 SequenceI seq3 = new Sequence("Seq3", "C---G");
232  1 SequenceI seq4 = new Sequence("Seq4", "CA--t");
233  1 SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 };
234  1 int width = seq1.getLength();
235  1 ProfilesI profiles = AAFrequency.calculate(seqs, width, 0, width, true);
236   
237  1 AlignmentAnnotation consensus = new AlignmentAnnotation("Consensus",
238    "PID", new Annotation[width]);
239  1 AAFrequency.completeConsensus(consensus, profiles, 0, 5, true, false,
240    4);
241   
242  1 Annotation ann = consensus.annotations[0];
243  1 assertEquals("C 100%", ann.description);
244  1 assertEquals("C", ann.displayCharacter);
245  1 ann = consensus.annotations[1];
246  1 assertEquals("A 100%", ann.description);
247  1 assertEquals("A", ann.displayCharacter);
248  1 ann = consensus.annotations[2];
249  1 assertEquals("[CG] 50%", ann.description);
250  1 assertEquals("+", ann.displayCharacter);
251  1 ann = consensus.annotations[3];
252  1 assertEquals("", ann.description);
253  1 assertEquals("-", ann.displayCharacter);
254  1 ann = consensus.annotations[4];
255  1 assertEquals("T 75%", ann.description);
256  1 assertEquals("T", ann.displayCharacter);
257    }
258   
259    /**
260    * Test to include rounding down of a non-zero count to 0% (JAL-3202)
261    */
 
262  1 toggle @Test(groups = { "Functional" })
263    public void testExtractProfile()
264    {
265    /*
266    * 200 sequences of which 30 gapped (170 ungapped)
267    * max count 70 for modal residue 'G'
268    */
269  1 ProfileI profile = new Profile(200, 30, 70, "G");
270  1 ResidueCount counts = new ResidueCount();
271  1 counts.put('G', 70);
272  1 counts.put('R', 60);
273  1 counts.put('L', 38);
274  1 counts.put('H', 2);
275  1 profile.setCounts(counts);
276   
277    /*
278    * [0, noOfValues, totalPercent, char1, count1, ...]
279    * G: 70/170 = 41.2 = 41
280    * R: 60/170 = 35.3 = 35
281    * L: 38/170 = 22.3 = 22
282    * H: 2/170 = 1
283    * total (rounded) percentages = 99
284    */
285  1 int[] extracted = AAFrequency.extractProfile(profile, true);
286  1 int[] expected = new int[] { 0, 4, 99, 'G', 41, 'R', 35, 'L', 22, 'H',
287    1 };
288  1 org.testng.Assert.assertEquals(extracted, expected);
289   
290    /*
291    * add some counts of 1; these round down to 0% and should be discarded
292    */
293  1 counts.put('G', 68); // 68/170 = 40% exactly (percentages now total 98)
294  1 counts.put('Q', 1);
295  1 counts.put('K', 1);
296  1 extracted = AAFrequency.extractProfile(profile, true);
297  1 expected = new int[] { 0, 4, 98, 'G', 40, 'R', 35, 'L', 22, 'H', 1 };
298  1 org.testng.Assert.assertEquals(extracted, expected);
299   
300    }
301   
302    /**
303    * Tests for the profile calculation where gaps are included i.e. the
304    * denominator is the total number of sequences in the column
305    */
 
306  1 toggle @Test(groups = { "Functional" })
307    public void testExtractProfile_countGaps()
308    {
309    /*
310    * 200 sequences of which 30 gapped (170 ungapped)
311    * max count 70 for modal residue 'G'
312    */
313  1 ProfileI profile = new Profile(200, 30, 70, "G");
314  1 ResidueCount counts = new ResidueCount();
315  1 counts.put('G', 70);
316  1 counts.put('R', 60);
317  1 counts.put('L', 38);
318  1 counts.put('H', 2);
319  1 profile.setCounts(counts);
320   
321    /*
322    * [0, noOfValues, totalPercent, char1, count1, ...]
323    * G: 70/200 = 35%
324    * R: 60/200 = 30%
325    * L: 38/200 = 19%
326    * H: 2/200 = 1%
327    * total (rounded) percentages = 85
328    */
329  1 int[] extracted = AAFrequency.extractProfile(profile, false);
330  1 int[] expected = new int[] { AlignmentAnnotation.SEQUENCE_PROFILE, 4,
331    85, 'G', 35, 'R', 30, 'L', 19, 'H', 1 };
332  1 org.testng.Assert.assertEquals(extracted, expected);
333   
334    /*
335    * add some counts of 1; these round down to 0% and should be discarded
336    */
337  1 counts.put('G', 68); // 68/200 = 34%
338  1 counts.put('Q', 1);
339  1 counts.put('K', 1);
340  1 extracted = AAFrequency.extractProfile(profile, false);
341  1 expected = new int[] { AlignmentAnnotation.SEQUENCE_PROFILE, 4, 84, 'G',
342    34, 'R', 30, 'L', 19, 'H', 1 };
343  1 org.testng.Assert.assertEquals(extracted, expected);
344   
345    }
346   
 
347  1 toggle @Test(groups = { "Functional" })
348    public void testExtractCdnaProfile()
349    {
350    /*
351    * 200 sequences of which 30 gapped (170 ungapped)
352    * max count 70 for modal residue 'G'
353    */
354  1 Hashtable profile = new Hashtable();
355   
356    /*
357    * cdna profile is {seqCount, ungappedCount, codonCount1, ...codonCount64}
358    * where 1..64 positions correspond to encoded codons
359    * see CodingUtils.encodeCodon()
360    */
361  1 int[] codonCounts = new int[66];
362  1 char[] codon1 = new char[] { 'G', 'C', 'A' };
363  1 char[] codon2 = new char[] { 'c', 'C', 'A' };
364  1 char[] codon3 = new char[] { 't', 'g', 'A' };
365  1 char[] codon4 = new char[] { 'G', 'C', 't' };
366  1 int encoded1 = CodingUtils.encodeCodon(codon1);
367  1 int encoded2 = CodingUtils.encodeCodon(codon2);
368  1 int encoded3 = CodingUtils.encodeCodon(codon3);
369  1 int encoded4 = CodingUtils.encodeCodon(codon4);
370  1 codonCounts[2 + encoded1] = 30;
371  1 codonCounts[2 + encoded2] = 70;
372  1 codonCounts[2 + encoded3] = 9;
373  1 codonCounts[2 + encoded4] = 1;
374  1 codonCounts[0] = 120;
375  1 codonCounts[1] = 110;
376  1 profile.put(AAFrequency.PROFILE, codonCounts);
377   
378    /*
379    * [0, noOfValues, totalPercent, char1, count1, ...]
380    * codon1: 30/110 = 27.2 = 27%
381    * codon2: 70/110 = 63.6% = 63%
382    * codon3: 9/110 = 8.1% = 8%
383    * codon4: 1/110 = 0.9% = 0% should be discarded
384    * total (rounded) percentages = 98
385    */
386  1 int[] extracted = AAFrequency.extractCdnaProfile(profile, true);
387  1 int[] expected = new int[] { AlignmentAnnotation.CDNA_PROFILE, 3, 98,
388    encoded2, 63, encoded1, 27, encoded3, 8 };
389  1 org.testng.Assert.assertEquals(extracted, expected);
390    }
391   
 
392  1 toggle @Test(groups = { "Functional" })
393    public void testExtractCdnaProfile_countGaps()
394    {
395    /*
396    * 200 sequences of which 30 gapped (170 ungapped)
397    * max count 70 for modal residue 'G'
398    */
399  1 Hashtable profile = new Hashtable();
400   
401    /*
402    * cdna profile is {seqCount, ungappedCount, codonCount1, ...codonCount64}
403    * where 1..64 positions correspond to encoded codons
404    * see CodingUtils.encodeCodon()
405    */
406  1 int[] codonCounts = new int[66];
407  1 char[] codon1 = new char[] { 'G', 'C', 'A' };
408  1 char[] codon2 = new char[] { 'c', 'C', 'A' };
409  1 char[] codon3 = new char[] { 't', 'g', 'A' };
410  1 char[] codon4 = new char[] { 'G', 'C', 't' };
411  1 int encoded1 = CodingUtils.encodeCodon(codon1);
412  1 int encoded2 = CodingUtils.encodeCodon(codon2);
413  1 int encoded3 = CodingUtils.encodeCodon(codon3);
414  1 int encoded4 = CodingUtils.encodeCodon(codon4);
415  1 codonCounts[2 + encoded1] = 30;
416  1 codonCounts[2 + encoded2] = 70;
417  1 codonCounts[2 + encoded3] = 9;
418  1 codonCounts[2 + encoded4] = 1;
419  1 codonCounts[0] = 120;
420  1 codonCounts[1] = 110;
421  1 profile.put(AAFrequency.PROFILE, codonCounts);
422   
423    /*
424    * [0, noOfValues, totalPercent, char1, count1, ...]
425    * codon1: 30/120 = 25%
426    * codon2: 70/120 = 58.3 = 58%
427    * codon3: 9/120 = 7.5 = 7%
428    * codon4: 1/120 = 0.8 = 0% should be discarded
429    * total (rounded) percentages = 90
430    */
431  1 int[] extracted = AAFrequency.extractCdnaProfile(profile, false);
432  1 int[] expected = new int[] { AlignmentAnnotation.CDNA_PROFILE, 3, 90,
433    encoded2, 58, encoded1, 25, encoded3, 7 };
434  1 org.testng.Assert.assertEquals(extracted, expected);
435    }
 
436  1 toggle @Test(groups= {"Functional"})
437    public void testExtractSSProfileForSequenceGroup()
438    {
439  1 Sequence sq = new Sequence("ASD","ASD");
440  1 Annotation h=new Annotation("H","",'H',0f),e=new Annotation("E","",'E',0f);
441  1 AlignmentAnnotation aa_allh = new AlignmentAnnotation("Secondary Structure","Foo h", new Annotation[] {h,h,h});
442  1 AlignmentAnnotation aa_allh2 = new AlignmentAnnotation("Secondary Structure","Foo h2", new Annotation[] {h,h,h});
443  1 AlignmentAnnotation aa_alle = new AlignmentAnnotation("Secondary Structure","Foo e", new Annotation[] {e,e,e});
444  1 AlignmentAnnotation aa_allc = new AlignmentAnnotation("Secondary Structure","Foo c", new Annotation[] {null,null,null});
445   
446  1 SequenceGroup sg = new SequenceGroup();
447  1 sq.addAlignmentAnnotation(aa_allc);
448  1 sq.addAlignmentAnnotation(aa_alle);
449  1 sq.addAlignmentAnnotation(aa_allh);
450  1 sq.addAlignmentAnnotation(aa_allh2);
451   
452    // Only E annotation added to sequence group
453  1 sg.addSequence(sq, false);
454  1 sg.addAnnotationFromTree(aa_alle);
455   
456  1 ProfilesI profile;
457    // should just calculate frequency for annotations on sequence group
458  1 profile = AAFrequency.calculateSS(new SequenceI[] {sq}, 3, 1, 3, false, "All", sg);
459  1 assertEquals("E",profile.get(1).getModalSS());
460  1 assertEquals(1,profile.getCount());
461  1 assertEquals(1,profile.get(1).getSeqWithSSCount());
462   
463    // Test source==null becomes 'All'
464  1 profile = AAFrequency.calculateSS(new SequenceI[] {sq}, 3, 1, 3, false, null, sg);
465  1 assertEquals("E",profile.get(1).getModalSS());
466   
467    // Test sg==null calculates frequency for all annotations on sequence
468  1 profile = AAFrequency.calculateSS(new SequenceI[] {sq}, 3, 1, 3, false, "All", null);
469  1 assertEquals("H",profile.get(1).getModalSS());
470  1 assertEquals(4,profile.getCount()); // 4 tracks
471  1 assertEquals(1,profile.get(1).getSeqWithSSCount()); // 1 sequence
472   
473    // Test sg==null calculates frequency for all annotations on sequence
474  1 profile = AAFrequency.calculateSS(new SequenceI[] {sq}, 3, 1, 3, false, null, null);
475  1 assertEquals("H",profile.get(1).getModalSS());
476    }
477   
 
478  1 toggle @Test(groups = { "Functional" })
479    public void testExtractHMMProfile()
480    throws MalformedURLException, IOException
481    {
482  1 int[] expected = { 0, 4, 100, 'T', 71, 'C', 12, 'G', 9, 'A', 9 };
483  1 int[] actual = AAFrequency.extractHMMProfile(hmm, 17, false, false);
484  12 for (int i = 0; i < actual.length; i++)
485    {
486  11 if (i == 2)
487    {
488  1 assertEquals(actual[i], expected[i]);
489    }
490    else
491    {
492  10 assertEquals(actual[i], expected[i]);
493    }
494    }
495   
496  1 int[] expected2 = { 0, 4, 100, 'A', 85, 'C', 0, 'G', 0, 'T', 0 };
497  1 int[] actual2 = AAFrequency.extractHMMProfile(hmm, 2, true, false);
498  12 for (int i = 0; i < actual2.length; i++)
499    {
500  11 if (i == 2)
501    {
502  1 assertEquals(actual[i], expected[i]);
503    }
504    else
505    {
506  10 assertEquals(actual[i], expected[i]);
507    }
508    }
509   
510  1 assertNull(AAFrequency.extractHMMProfile(null, 98978867, true, false));
511    }
512   
 
513  1 toggle @Test(groups = { "Functional" })
514    public void testGetAnalogueCount()
515    {
516    /*
517    * 'T' in column 0 has emission probability 0.7859, scales to 7859
518    */
519  1 int count = AAFrequency.getAnalogueCount(hmm, 0, 'T', false, false);
520  1 assertEquals(7859, count);
521   
522    /*
523    * same with 'use info height': value is multiplied by log ratio
524    * log(value / background) / log(2) = log(0.7859/0.25)/0.693
525    * = log(3.1)/0.693 = 1.145/0.693 = 1.66
526    * so value becomes 1.2987 and scales up to 12987
527    */
528  1 count = AAFrequency.getAnalogueCount(hmm, 0, 'T', false, true);
529  1 assertEquals(12987, count);
530   
531    /*
532    * 'G' in column 20 has emission probability 0.75457, scales to 7546
533    */
534  1 count = AAFrequency.getAnalogueCount(hmm, 20, 'G', false, false);
535  1 assertEquals(7546, count);
536   
537    /*
538    * 'G' in column 1077 has emission probability 0.0533, here
539    * ignored (set to 0) since below background of 0.25
540    */
541  1 count = AAFrequency.getAnalogueCount(hmm, 1077, 'G', true, false);
542  1 assertEquals(0, count);
543    }
544   
 
545  1 toggle @Test(groups = { "Functional" })
546    public void testCompleteInformation()
547    {
548  1 ProfileI prof1 = new Profile(1, 0, 100, "A");
549  1 ProfileI prof2 = new Profile(1, 0, 100, "-");
550   
551  1 ProfilesI profs = new Profiles(1,new ProfileI[] { prof1, prof2 });
552  1 Annotation ann1 = new Annotation(6.5f);
553  1 Annotation ann2 = new Annotation(0f);
554  1 Annotation[] annots = new Annotation[] { ann1, ann2 };
555  1 SequenceI seq = new Sequence("", "AA", 0, 0);
556  1 seq.setHMM(hmm);
557  1 AlignmentAnnotation annot = new AlignmentAnnotation("", "", annots);
558  1 annot.setSequenceRef(seq);
559  1 AAFrequency.completeInformation(annot, profs, 0, 1);
560  1 float ic = annot.annotations[0].value;
561  1 assertEquals(0.91532f, ic, 0.0001f);
562  1 ic = annot.annotations[1].value;
563  1 assertEquals(0f, ic, 0.0001f);
564  1 int i = 0;
565    }
566    }