1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertSame; |
25 |
|
|
26 |
|
import jalview.analysis.scoremodels.ScoreModels; |
27 |
|
import jalview.api.analysis.ScoreModelI; |
28 |
|
import jalview.bin.Cache; |
29 |
|
|
30 |
|
import java.util.List; |
31 |
|
|
32 |
|
import org.testng.annotations.BeforeClass; |
33 |
|
import org.testng.annotations.Test; |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (54) |
Complexity: 4 |
Complexity Density: 0.08 |
|
35 |
|
public class CalculationChooserTest |
36 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
37 |
1 |
@BeforeClass(alwaysRun = true)... |
38 |
|
public void setUp() |
39 |
|
{ |
40 |
|
|
41 |
1 |
Cache.loadProperties("test/jalview/io/testProps.jvprops"); |
42 |
1 |
Cache.applicationProperties.setProperty("BLOSUM62_PCA_FOR_NUCLEOTIDE", |
43 |
|
Boolean.FALSE.toString()); |
44 |
|
} |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (50) |
Complexity: 3 |
Complexity Density: 0.07 |
1PASS
|
|
46 |
1 |
@Test(groups = "Functional")... |
47 |
|
public void testGetApplicableScoreModels() |
48 |
|
{ |
49 |
1 |
ScoreModels models = ScoreModels.getInstance(); |
50 |
1 |
ScoreModelI blosum62 = models.getBlosum62(); |
51 |
1 |
ScoreModelI pam250 = models.getPam250(); |
52 |
1 |
ScoreModelI dna = models.getDefaultModel(false); |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
1 |
List<ScoreModelI> filtered = CalculationChooser |
58 |
|
.getApplicableScoreModels(false, true, true, false); |
59 |
1 |
assertEquals(filtered.size(), 5); |
60 |
1 |
assertSame(filtered.get(0), blosum62); |
61 |
1 |
assertSame(filtered.get(1), pam250); |
62 |
1 |
assertEquals(filtered.get(2).getName(), "PID"); |
63 |
1 |
assertEquals(filtered.get(3).getName(), "Sequence Feature Similarity"); |
64 |
1 |
assertEquals(filtered.get(4).getName(), |
65 |
|
"Secondary Structure Similarity"); |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
1 |
filtered = CalculationChooser.getApplicableScoreModels(false, false, |
71 |
|
true, false); |
72 |
1 |
assertEquals(filtered.size(), 5); |
73 |
1 |
assertSame(filtered.get(0), blosum62); |
74 |
1 |
assertSame(filtered.get(1), pam250); |
75 |
1 |
assertEquals(filtered.get(2).getName(), "PID"); |
76 |
1 |
assertEquals(filtered.get(3).getName(), "Sequence Feature Similarity"); |
77 |
1 |
assertEquals(filtered.get(4).getName(), |
78 |
|
"Secondary Structure Similarity"); |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
1 |
filtered = CalculationChooser.getApplicableScoreModels(true, true, |
84 |
|
false, false); |
85 |
1 |
assertEquals(filtered.size(), 3); |
86 |
1 |
assertSame(filtered.get(0), dna); |
87 |
1 |
assertEquals(filtered.get(1).getName(), "PID"); |
88 |
1 |
assertEquals(filtered.get(2).getName(), "Sequence Feature Similarity"); |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
1 |
filtered = CalculationChooser.getApplicableScoreModels(true, false, |
94 |
|
false, false); |
95 |
1 |
assertEquals(filtered.size(), 3); |
96 |
1 |
assertSame(filtered.get(0), dna); |
97 |
1 |
assertEquals(filtered.get(1).getName(), "PID"); |
98 |
1 |
assertEquals(filtered.get(2).getName(), "Sequence Feature Similarity"); |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
1 |
Cache.applicationProperties.setProperty("BLOSUM62_PCA_FOR_NUCLEOTIDE", |
104 |
|
Boolean.TRUE.toString()); |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
1 |
filtered = CalculationChooser.getApplicableScoreModels(true, false, |
110 |
|
true, false); |
111 |
1 |
assertEquals(filtered.size(), 4); |
112 |
1 |
assertSame(filtered.get(0), dna); |
113 |
1 |
assertEquals(filtered.get(1).getName(), "PID"); |
114 |
1 |
assertEquals(filtered.get(2).getName(), "Sequence Feature Similarity"); |
115 |
1 |
assertEquals(filtered.get(3).getName(), |
116 |
|
"Secondary Structure Similarity"); |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
1 |
filtered = CalculationChooser.getApplicableScoreModels(true, true, |
122 |
|
false, false); |
123 |
1 |
assertEquals(filtered.size(), 4); |
124 |
1 |
assertSame(filtered.get(0), dna); |
125 |
1 |
assertEquals(filtered.get(1).getName(), "PID"); |
126 |
1 |
assertEquals(filtered.get(2).getName(), "Sequence Feature Similarity"); |
127 |
1 |
assertSame(filtered.get(3), blosum62); |
128 |
|
|
129 |
1 |
filtered = CalculationChooser.getApplicableScoreModels(true, true, |
130 |
|
false, true); |
131 |
1 |
assertEquals(filtered.size(), 1); |
132 |
10 |
for (int i = 0; i <= 8; i++) |
133 |
|
{ |
134 |
9 |
boolean isDna = (i & 1) != 0, isPca = (i & 2) != 0, |
135 |
|
isSS = (i & 4) != 0; |
136 |
|
|
137 |
9 |
assertEquals(CalculationChooser |
138 |
|
.getApplicableScoreModels(isDna, isPca, isSS, true).size(), |
139 |
9 |
(isDna) ? 1 : 2); |
140 |
|
} |
141 |
|
} |
142 |
|
} |