1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.schemes; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertEquals; |
24 |
|
import static org.testng.AssertJUnit.assertFalse; |
25 |
|
import static org.testng.AssertJUnit.assertTrue; |
26 |
|
|
27 |
|
import jalview.datamodel.Alignment; |
28 |
|
import jalview.datamodel.AlignmentAnnotation; |
29 |
|
import jalview.datamodel.AlignmentI; |
30 |
|
import jalview.datamodel.AnnotatedCollectionI; |
31 |
|
import jalview.datamodel.Annotation; |
32 |
|
import jalview.datamodel.Sequence; |
33 |
|
import jalview.datamodel.SequenceI; |
34 |
|
import jalview.gui.JvOptionPane; |
35 |
|
import jalview.io.TCoffeeScoreFile; |
36 |
|
|
37 |
|
import org.testng.annotations.BeforeClass; |
38 |
|
import org.testng.annotations.Test; |
39 |
|
|
|
|
| 99% |
Uncovered Elements: 1 (96) |
Complexity: 7 |
Complexity Density: 0.08 |
|
40 |
|
public class ResidueColourSchemeTest |
41 |
|
{ |
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
42 |
1 |
@BeforeClass(alwaysRun = true)... |
43 |
|
public void setUp() |
44 |
|
{ |
45 |
|
|
46 |
|
} |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
48 |
1 |
@BeforeClass(alwaysRun = true)... |
49 |
|
public void setUpJvOptionPane() |
50 |
|
{ |
51 |
1 |
JvOptionPane.setInteractiveMode(false); |
52 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (58) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
55 |
1 |
@Test(groups = "Functional")... |
56 |
|
public void testIsApplicableTo() |
57 |
|
{ |
58 |
1 |
SequenceI pep1 = new Sequence("pep1", "APQTWLS"); |
59 |
1 |
SequenceI pep2 = new Sequence("pep2", "AILFQYG"); |
60 |
1 |
SequenceI dna1 = new Sequence("dna1", "ACTGAC"); |
61 |
1 |
SequenceI dna2 = new Sequence("dna2", "TCCAAG"); |
62 |
1 |
AlignmentI peptide = new Alignment(new SequenceI[] { pep1, pep2 }); |
63 |
1 |
AlignmentI nucleotide = new Alignment(new SequenceI[] { dna1, dna2 }); |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
1 |
assertTrue(new ClustalxColourScheme(peptide, null) |
69 |
|
.isApplicableTo(peptide)); |
70 |
1 |
assertFalse(new ClustalxColourScheme(nucleotide, null) |
71 |
|
.isApplicableTo(nucleotide)); |
72 |
1 |
assertTrue(new Blosum62ColourScheme().isApplicableTo(peptide)); |
73 |
1 |
assertFalse(new Blosum62ColourScheme().isApplicableTo(nucleotide)); |
74 |
1 |
assertTrue(new BuriedColourScheme().isApplicableTo(peptide)); |
75 |
1 |
assertFalse(new BuriedColourScheme().isApplicableTo(nucleotide)); |
76 |
1 |
assertTrue(new HelixColourScheme().isApplicableTo(peptide)); |
77 |
1 |
assertFalse(new HelixColourScheme().isApplicableTo(nucleotide)); |
78 |
1 |
assertTrue(new HydrophobicColourScheme().isApplicableTo(peptide)); |
79 |
1 |
assertFalse(new HydrophobicColourScheme().isApplicableTo(nucleotide)); |
80 |
1 |
assertTrue(new StrandColourScheme().isApplicableTo(peptide)); |
81 |
1 |
assertFalse(new StrandColourScheme().isApplicableTo(nucleotide)); |
82 |
1 |
assertTrue(new TaylorColourScheme().isApplicableTo(peptide)); |
83 |
1 |
assertFalse(new TaylorColourScheme().isApplicableTo(nucleotide)); |
84 |
1 |
assertTrue(new TurnColourScheme().isApplicableTo(peptide)); |
85 |
1 |
assertFalse(new TurnColourScheme().isApplicableTo(nucleotide)); |
86 |
1 |
assertTrue(new ZappoColourScheme().isApplicableTo(peptide)); |
87 |
1 |
assertFalse(new ZappoColourScheme().isApplicableTo(nucleotide)); |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
1 |
assertFalse(new NucleotideColourScheme().isApplicableTo(peptide)); |
93 |
1 |
assertTrue(new NucleotideColourScheme().isApplicableTo(nucleotide)); |
94 |
1 |
assertFalse(new PurinePyrimidineColourScheme().isApplicableTo(peptide)); |
95 |
1 |
assertTrue( |
96 |
|
new PurinePyrimidineColourScheme().isApplicableTo(nucleotide)); |
97 |
1 |
assertFalse(new RNAInteractionColourScheme().isApplicableTo(peptide)); |
98 |
1 |
assertTrue(new RNAInteractionColourScheme().isApplicableTo(nucleotide)); |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
1 |
assertTrue(new UserColourScheme().isApplicableTo(peptide)); |
104 |
1 |
assertTrue(new UserColourScheme().isApplicableTo(nucleotide)); |
105 |
1 |
assertTrue(new ScoreColourScheme(new int[] {}, new double[] {}, 0, 0d) |
106 |
|
.isApplicableTo(peptide)); |
107 |
1 |
assertTrue(new ScoreColourScheme(new int[] {}, new double[] {}, 0, 0d) |
108 |
|
.isApplicableTo(nucleotide)); |
109 |
1 |
ResidueColourScheme rcs = new PIDColourScheme(); |
110 |
1 |
assertTrue(rcs.isApplicableTo(peptide)); |
111 |
1 |
assertTrue(rcs.isApplicableTo(nucleotide)); |
112 |
1 |
assertTrue(new PIDColourScheme().isApplicableTo(peptide)); |
113 |
1 |
assertTrue(new PIDColourScheme().isApplicableTo(nucleotide)); |
114 |
1 |
assertTrue(new FollowerColourScheme().isApplicableTo(peptide)); |
115 |
1 |
assertTrue(new FollowerColourScheme().isApplicableTo(nucleotide)); |
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
1 |
assertFalse(new TCoffeeColourScheme(peptide).isApplicableTo(peptide)); |
121 |
1 |
assertFalse( |
122 |
|
new TCoffeeColourScheme(nucleotide).isApplicableTo(nucleotide)); |
123 |
1 |
AlignmentAnnotation aa = new AlignmentAnnotation("T-COFFEE", "", null); |
124 |
1 |
aa.setCalcId(TCoffeeScoreFile.TCOFFEE_SCORE); |
125 |
1 |
peptide.addAnnotation(aa); |
126 |
1 |
aa = new AlignmentAnnotation("T-COFFEE", "", null); |
127 |
1 |
aa.setCalcId(TCoffeeScoreFile.TCOFFEE_SCORE); |
128 |
1 |
nucleotide.addAnnotation(aa); |
129 |
1 |
assertTrue(new TCoffeeColourScheme(peptide).isApplicableTo(peptide)); |
130 |
1 |
assertTrue( |
131 |
|
new TCoffeeColourScheme(nucleotide).isApplicableTo(nucleotide)); |
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
1 |
assertFalse(new RNAHelicesColour(peptide).isApplicableTo(peptide)); |
137 |
1 |
assertFalse( |
138 |
|
new RNAHelicesColour(nucleotide).isApplicableTo(nucleotide)); |
139 |
|
|
140 |
1 |
Annotation[] ss = new Annotation[2]; |
141 |
1 |
ss[0] = new Annotation("", "", '{', 0f); |
142 |
1 |
ss[1] = new Annotation("", "", '}', 0f); |
143 |
1 |
nucleotide.addAnnotation(new AlignmentAnnotation("SS", "", ss)); |
144 |
1 |
assertTrue(new RNAHelicesColour(nucleotide).isApplicableTo(nucleotide)); |
145 |
|
} |
146 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
147 |
1 |
@Test(groups = "Functional")... |
148 |
|
public void testIsApplicableTo_dynamicColourScheme() |
149 |
|
{ |
150 |
1 |
SequenceI pep1 = new Sequence("pep1", "APQTWLS"); |
151 |
1 |
SequenceI pep2 = new Sequence("pep2", "AILFQYG"); |
152 |
1 |
AlignmentI peptide = new Alignment(new SequenceI[] { pep1, pep2 }); |
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
1 |
ColourSchemeI cs = new UserColourScheme() |
159 |
|
{ |
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
160 |
2 |
@Override... |
161 |
|
public boolean isApplicableTo(AnnotatedCollectionI ac) |
162 |
|
{ |
163 |
2 |
AlignmentI al = ac.getContext() == null ? (AlignmentI) ac |
164 |
|
: (AlignmentI) ac.getContext(); |
165 |
2 |
return al.getSequences().size() > 2; |
166 |
|
} |
167 |
|
}; |
168 |
1 |
assertFalse(cs.isApplicableTo(peptide)); |
169 |
1 |
peptide.addSequence(pep1); |
170 |
1 |
assertTrue(cs.isApplicableTo(peptide)); |
171 |
|
} |
172 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
173 |
1 |
@Test(groups = "Functional")... |
174 |
|
public void testGetName() |
175 |
|
{ |
176 |
1 |
SequenceI pep1 = new Sequence("pep1", "APQTWLS"); |
177 |
1 |
AlignmentI peptide = new Alignment(new SequenceI[] { pep1 }); |
178 |
|
|
179 |
1 |
assertEquals("Blosum62", new Blosum62ColourScheme().getSchemeName()); |
180 |
1 |
assertEquals("Buried Index", new BuriedColourScheme().getSchemeName()); |
181 |
1 |
assertEquals("Helix Propensity", |
182 |
|
new HelixColourScheme().getSchemeName()); |
183 |
1 |
assertEquals("Hydrophobic", |
184 |
|
new HydrophobicColourScheme().getSchemeName()); |
185 |
1 |
assertEquals("Strand Propensity", |
186 |
|
new StrandColourScheme().getSchemeName()); |
187 |
1 |
assertEquals("Taylor", new TaylorColourScheme().getSchemeName()); |
188 |
1 |
assertEquals("Turn Propensity", new TurnColourScheme().getSchemeName()); |
189 |
1 |
assertEquals("Zappo", new ZappoColourScheme().getSchemeName()); |
190 |
1 |
assertEquals("Nucleotide", |
191 |
|
new NucleotideColourScheme().getSchemeName()); |
192 |
1 |
assertEquals("Purine/Pyrimidine", |
193 |
|
new PurinePyrimidineColourScheme().getSchemeName()); |
194 |
1 |
assertEquals("RNA Interaction type", |
195 |
|
new RNAInteractionColourScheme().getSchemeName()); |
196 |
1 |
assertEquals("User Defined", new UserColourScheme().getSchemeName()); |
197 |
1 |
assertEquals("Score", |
198 |
|
new ScoreColourScheme(new int[] {}, new double[] {}, 0, 0d) |
199 |
|
.getSchemeName()); |
200 |
1 |
assertEquals("% Identity", new PIDColourScheme().getSchemeName()); |
201 |
1 |
assertEquals("Follower", new FollowerColourScheme().getSchemeName()); |
202 |
1 |
assertEquals("T-Coffee Scores", |
203 |
|
new TCoffeeColourScheme(peptide).getSchemeName()); |
204 |
1 |
assertEquals("RNA Helices", |
205 |
|
new RNAHelicesColour(peptide).getSchemeName()); |
206 |
|
} |
207 |
|
} |