1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.analysis.scoremodels; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertFalse; |
25 |
|
import static org.testng.Assert.assertTrue; |
26 |
|
|
27 |
|
import jalview.api.analysis.PairwiseScoreModelI; |
28 |
|
import jalview.api.analysis.ScoreModelI; |
29 |
|
|
30 |
|
import java.util.Iterator; |
31 |
|
|
32 |
|
import org.testng.annotations.Test; |
33 |
|
|
|
|
| 79.2% |
Uncovered Elements: 10 (48) |
Complexity: 5 |
Complexity Density: 0.12 |
|
34 |
|
public class ScoreModelsTest |
35 |
|
{ |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (37) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
40 |
1 |
@Test(groups = "Functional")... |
41 |
|
public void testConstructor() |
42 |
|
{ |
43 |
1 |
Iterator<ScoreModelI> models = ScoreModels.getInstance().getModels() |
44 |
|
.iterator(); |
45 |
1 |
assertTrue(models.hasNext()); |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
1 |
ScoreModelI sm = models.next(); |
51 |
1 |
assertTrue(sm instanceof SimilarityScoreModel); |
52 |
1 |
assertTrue(sm instanceof PairwiseScoreModelI); |
53 |
1 |
assertFalse(sm instanceof DistanceScoreModel); |
54 |
1 |
assertEquals(sm.getName(), "BLOSUM62"); |
55 |
1 |
assertEquals(((PairwiseScoreModelI) sm).getPairwiseScore('I', 'R'), |
56 |
|
-3f); |
57 |
|
|
58 |
1 |
sm = models.next(); |
59 |
1 |
assertTrue(sm instanceof SimilarityScoreModel); |
60 |
1 |
assertTrue(sm instanceof PairwiseScoreModelI); |
61 |
1 |
assertFalse(sm instanceof DistanceScoreModel); |
62 |
1 |
assertEquals(sm.getName(), "PAM250"); |
63 |
1 |
assertEquals(((PairwiseScoreModelI) sm).getPairwiseScore('R', 'C'), |
64 |
|
-4f); |
65 |
|
|
66 |
1 |
sm = models.next(); |
67 |
1 |
assertTrue(sm instanceof SimilarityScoreModel); |
68 |
1 |
assertTrue(sm instanceof PairwiseScoreModelI); |
69 |
1 |
assertFalse(sm instanceof DistanceScoreModel); |
70 |
1 |
assertEquals(sm.getName(), "DNA"); |
71 |
1 |
assertEquals(((PairwiseScoreModelI) sm).getPairwiseScore('c', 'x'), 1f); |
72 |
|
|
73 |
1 |
sm = models.next(); |
74 |
1 |
assertTrue(sm instanceof SimilarityScoreModel); |
75 |
1 |
assertTrue(sm instanceof PairwiseScoreModelI); |
76 |
1 |
assertFalse(sm instanceof DistanceScoreModel); |
77 |
1 |
assertEquals(sm.getName(), "PID"); |
78 |
1 |
assertEquals(((PairwiseScoreModelI) sm).getPairwiseScore('R', 'C'), 0f); |
79 |
1 |
assertEquals(((PairwiseScoreModelI) sm).getPairwiseScore('R', 'r'), 1f); |
80 |
|
|
81 |
1 |
sm = models.next(); |
82 |
1 |
assertFalse(sm instanceof SimilarityScoreModel); |
83 |
1 |
assertFalse(sm instanceof PairwiseScoreModelI); |
84 |
1 |
assertTrue(sm instanceof DistanceScoreModel); |
85 |
1 |
assertEquals(sm.getName(), "Sequence Feature Similarity"); |
86 |
|
|
87 |
1 |
sm = models.next(); |
88 |
1 |
assertFalse(sm instanceof SimilarityScoreModel); |
89 |
1 |
assertFalse(sm instanceof PairwiseScoreModelI); |
90 |
1 |
assertTrue(sm instanceof DistanceScoreModel); |
91 |
1 |
assertEquals(sm.getName(), "Secondary Structure Similarity"); |
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
100 |
0 |
@Test(groups = "none")... |
101 |
|
public void printAllMatrices_tabDelimited() |
102 |
|
{ |
103 |
0 |
printAllMatrices(false); |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
112 |
0 |
@Test(groups = "none")... |
113 |
|
public void printAllMatrices_asHtml() |
114 |
|
{ |
115 |
0 |
printAllMatrices(true); |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
@param |
122 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
123 |
0 |
protected void printAllMatrices(boolean asHtml)... |
124 |
|
{ |
125 |
0 |
for (ScoreModelI sm : ScoreModels.getInstance().getModels()) |
126 |
|
{ |
127 |
0 |
if (sm instanceof ScoreMatrix) |
128 |
|
{ |
129 |
0 |
System.out.println(((ScoreMatrix) sm).outputMatrix(asHtml)); |
130 |
|
} |
131 |
|
} |
132 |
|
} |
133 |
|
} |