1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.structures.models; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertFalse; |
25 |
|
import static org.testng.Assert.assertNotNull; |
26 |
|
import static org.testng.Assert.assertTrue; |
27 |
|
|
28 |
|
import java.awt.Color; |
29 |
|
import java.io.IOException; |
30 |
|
import java.util.Arrays; |
31 |
|
import java.util.BitSet; |
32 |
|
import java.util.HashMap; |
33 |
|
import java.util.List; |
34 |
|
import java.util.Map; |
35 |
|
|
36 |
|
import org.testng.annotations.BeforeClass; |
37 |
|
import org.testng.annotations.BeforeMethod; |
38 |
|
import org.testng.annotations.Test; |
39 |
|
|
40 |
|
import jalview.api.AlignmentViewPanel; |
41 |
|
import jalview.api.SequenceRenderer; |
42 |
|
import jalview.datamodel.Alignment; |
43 |
|
import jalview.datamodel.AlignmentI; |
44 |
|
import jalview.datamodel.ColumnSelection; |
45 |
|
import jalview.datamodel.PDBEntry; |
46 |
|
import jalview.datamodel.PDBEntry.Type; |
47 |
|
import jalview.datamodel.Sequence; |
48 |
|
import jalview.datamodel.SequenceI; |
49 |
|
import jalview.ext.rbvi.chimera.ChimeraCommands; |
50 |
|
import jalview.gui.AlignFrame; |
51 |
|
import jalview.gui.JvOptionPane; |
52 |
|
import jalview.gui.StructureViewer.ViewerType; |
53 |
|
import jalview.io.DataSourceType; |
54 |
|
import jalview.io.FileFormats; |
55 |
|
import jalview.io.FileLoader; |
56 |
|
import jalview.schemes.JalviewColourScheme; |
57 |
|
import jalview.structure.AtomSpec; |
58 |
|
import jalview.structure.AtomSpecModel; |
59 |
|
import jalview.structure.StructureCommandI; |
60 |
|
import jalview.structure.StructureCommandsI.AtomSpecType; |
61 |
|
import jalview.structure.StructureMapping; |
62 |
|
import jalview.structure.StructureSelectionManager; |
63 |
|
import junit.extensions.PA; |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@author |
69 |
|
|
70 |
|
|
|
|
| 86.8% |
Uncovered Elements: 23 (174) |
Complexity: 32 |
Complexity Density: 0.24 |
|
71 |
|
public class AAStructureBindingModelTest |
72 |
|
{ |
73 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
74 |
1 |
@BeforeClass(alwaysRun = true)... |
75 |
|
public void setUpJvOptionPane() |
76 |
|
{ |
77 |
1 |
JvOptionPane.setInteractiveMode(false); |
78 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
79 |
|
} |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
private static final String PDB_1 = "HEADER COMPLEX (ANTI-ONCOGENE/ANKYRIN REPEATS) 30-SEP-96 1YCS \n" |
85 |
|
+ "ATOM 2 CA VAL A 97 24.134 4.926 45.821 1.00 47.43 C \n" |
86 |
|
+ "ATOM 9 CA PRO A 98 25.135 8.584 46.217 1.00 41.60 C \n" |
87 |
|
+ "ATOM 16 CA SER A 99 28.243 9.596 44.271 1.00 39.63 C \n" |
88 |
|
+ "ATOM 22 CA GLN A 100 31.488 10.133 46.156 1.00 35.60 C \n" |
89 |
|
|
90 |
|
|
91 |
|
+ "ATOM 31 CA LYS A 102 33.323 11.587 43.115 1.00 41.69 C \n" |
92 |
|
+ "ATOM 1857 CA GLU B 374 9.193 -16.005 95.870 1.00 54.22 C \n" |
93 |
|
+ "ATOM 1866 CA ILE B 375 7.101 -14.921 92.847 1.00 46.82 C \n" |
94 |
|
+ "ATOM 1874 CA VAL B 376 10.251 -13.625 91.155 1.00 47.80 C \n" |
95 |
|
+ "ATOM 1881 CA LYS B 377 11.767 -17.068 91.763 1.00 50.21 C \n" |
96 |
|
+ "ATOM 1890 CA PHE B 378 8.665 -18.948 90.632 1.00 44.85 C \n"; |
97 |
|
|
98 |
|
private static final String PDB_2 = "HEADER HYDROLASE 09-SEP-09 3A6S \n" |
99 |
|
+ "ATOM 2 CA MET B 1 15.366 -11.648 24.854 1.00 32.05 C \n" |
100 |
|
+ "ATOM 10 CA LYS B 2 16.846 -9.215 22.340 1.00 25.68 C \n" |
101 |
|
+ "ATOM 19 CA LYS B 3 15.412 -6.335 20.343 1.00 19.42 C \n" |
102 |
|
+ "ATOM 28 CA LEU B 4 15.629 -5.719 16.616 1.00 15.49 C \n" |
103 |
|
+ "ATOM 36 CA GLN B 5 14.412 -2.295 15.567 1.00 12.19 C \n"; |
104 |
|
|
105 |
|
private static final String PDB_3 = "HEADER STRUCTURAL GENOMICS 04-MAR-03 1OOT \n" |
106 |
|
+ "ATOM 2 CA SER A 7 29.427 3.330 -6.578 1.00 32.50 C \n" |
107 |
|
+ "ATOM 8 CA PRO A 8 29.975 3.340 -2.797 1.00 17.62 C \n" |
108 |
|
+ "ATOM 16 CA ALYS A 9 26.958 3.024 -0.410 0.50 8.78 C \n" |
109 |
|
+ "ATOM 33 CA ALA A 10 26.790 4.320 3.172 1.00 11.98 C \n" |
110 |
|
+ "ATOM 39 CA AVAL A 12 24.424 3.853 6.106 0.50 13.83 C \n"; |
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
private static final String PDB_4_MC = "HEADER HYDROLASE 09-SEP-09 3A6S \n" |
117 |
|
+ "ATOM 2 CA MET A 1 15.366 -11.648 24.854 1.00 32.05 C \n" |
118 |
|
+ "ATOM 10 CA LYS A 2 16.846 -9.215 22.340 1.00 25.68 C \n" |
119 |
|
+ "ATOM 19 CA LYS A 3 15.412 -6.335 20.343 1.00 19.42 C \n" |
120 |
|
+ "ATOM 28 CA LEU A 4 15.629 -5.719 16.616 1.00 15.49 C \n" |
121 |
|
+ "ATOM 36 CA GLN A 5 14.412 -2.295 15.567 1.00 12.19 C \n" |
122 |
|
+ "ATOM 1030 CA MET B 1 18.869 -7.572 3.432 1.00 31.52 C \n" |
123 |
|
+ "ATOM 1038 CA LYS B 2 19.182 -10.025 6.313 1.00 26.41 C \n" |
124 |
|
+ "ATOM 1047 CA LYS B 3 17.107 -12.963 7.534 1.00 19.71 C \n" |
125 |
|
+ "ATOM 1056 CA LEU B 4 16.142 -13.579 11.164 1.00 14.81 C \n" |
126 |
|
+ "ATOM 1064 CA GLN B 5 14.648 -17.005 11.785 1.00 13.38 C \n"; |
127 |
|
|
128 |
|
|
129 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
130 |
1 |
@Test(groups = { "Functional" })... |
131 |
|
public void testImportPDBPreservesChainMappings() throws IOException |
132 |
|
{ |
133 |
1 |
AlignmentI importedAl = new jalview.io.FormatAdapter().readFile( |
134 |
|
PDB_4_MC, DataSourceType.PASTE, FileFormats.getInstance() |
135 |
|
.forName(jalview.io.FileFormat.PDB.toString())); |
136 |
|
|
137 |
|
|
138 |
|
|
139 |
1 |
PDBEntry importedPDB = new PDBEntry("3A6S", "", Type.PDB, "Paste"); |
140 |
1 |
AAStructureBindingModel binder = new AAStructureBindingModel( |
141 |
|
new StructureSelectionManager(), new PDBEntry[] |
142 |
|
{ importedPDB }, |
143 |
|
new SequenceI[][] |
144 |
|
{ importedAl.getSequencesArray() }, null) |
145 |
|
{ |
146 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
147 |
0 |
@Override... |
148 |
|
public void updateColours(Object source) |
149 |
|
{ |
150 |
|
} |
151 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
152 |
0 |
@Override... |
153 |
|
public void releaseReferences(Object svl) |
154 |
|
{ |
155 |
|
} |
156 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
157 |
0 |
@Override... |
158 |
|
public String[] getStructureFiles() |
159 |
|
{ |
160 |
0 |
return null; |
161 |
|
} |
162 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
163 |
0 |
@Override... |
164 |
|
public void highlightAtoms(List<AtomSpec> atoms) |
165 |
|
{ |
166 |
|
} |
167 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
168 |
0 |
@Override... |
169 |
|
public SequenceRenderer getSequenceRenderer( |
170 |
|
AlignmentViewPanel alignment) |
171 |
|
{ |
172 |
0 |
return null; |
173 |
|
} |
174 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
175 |
0 |
@Override... |
176 |
|
protected List<String> executeCommand(StructureCommandI command, |
177 |
|
boolean getReply) |
178 |
|
{ |
179 |
0 |
return null; |
180 |
|
} |
181 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
182 |
0 |
@Override... |
183 |
|
protected String getModelIdForFile(String chainId) |
184 |
|
{ |
185 |
0 |
return ""; |
186 |
|
} |
187 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
188 |
0 |
@Override... |
189 |
|
protected ViewerType getViewerType() |
190 |
|
{ |
191 |
0 |
return null; |
192 |
|
} |
193 |
|
}; |
194 |
1 |
String[][] chains = binder.getChains(); |
195 |
1 |
assertFalse(chains == null || chains[0] == null, |
196 |
|
"No chains discovered by binding"); |
197 |
1 |
assertEquals(chains[0].length, 2); |
198 |
1 |
assertEquals(chains[0][0], "A"); |
199 |
1 |
assertEquals(chains[0][1], "B"); |
200 |
|
} |
201 |
|
|
202 |
|
AAStructureBindingModel testee; |
203 |
|
|
204 |
|
AlignmentI al = null; |
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
|
209 |
4 |
@BeforeMethod(alwaysRun = true)... |
210 |
|
public void setUp() |
211 |
|
{ |
212 |
4 |
SequenceI seq1a = new Sequence("1YCS|A", "-VPSQK"); |
213 |
4 |
SequenceI seq1b = new Sequence("1YCS|B", "EIVKF-"); |
214 |
4 |
SequenceI seq2 = new Sequence("3A6S", "MK-KLQ"); |
215 |
4 |
SequenceI seq3 = new Sequence("1OOT", "SPK-AV"); |
216 |
4 |
al = new Alignment(new SequenceI[] { seq1a, seq1b, seq2, seq3 }); |
217 |
4 |
al.setDataset(null); |
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
4 |
PDBEntry[] pdbFiles = new PDBEntry[3]; |
223 |
4 |
pdbFiles[0] = new PDBEntry("1YCS", "A", Type.PDB, "INLINE1YCS"); |
224 |
4 |
pdbFiles[1] = new PDBEntry("3A6S", "B", Type.PDB, "INLINE3A6S"); |
225 |
4 |
pdbFiles[2] = new PDBEntry("1OOT", "A", Type.PDB, "INLINE1OOT"); |
226 |
4 |
SequenceI[][] seqs = new SequenceI[3][]; |
227 |
4 |
seqs[0] = new SequenceI[] { seq1a, seq1b }; |
228 |
4 |
seqs[1] = new SequenceI[] { seq2 }; |
229 |
4 |
seqs[2] = new SequenceI[] { seq3 }; |
230 |
4 |
StructureSelectionManager ssm = new StructureSelectionManager(); |
231 |
|
|
232 |
4 |
ssm.setMapping(new SequenceI[] { seq1a, seq1b }, null, PDB_1, |
233 |
|
DataSourceType.PASTE, null); |
234 |
4 |
ssm.setMapping(new SequenceI[] { seq2 }, null, PDB_2, |
235 |
|
DataSourceType.PASTE, null); |
236 |
4 |
ssm.setMapping(new SequenceI[] { seq3 }, null, PDB_3, |
237 |
|
DataSourceType.PASTE, null); |
238 |
|
|
239 |
4 |
testee = newBindingModel(pdbFiles, seqs, ssm, null); |
240 |
|
} |
241 |
|
|
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
@param |
246 |
|
@param |
247 |
|
@param |
248 |
|
@param |
249 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
250 |
5 |
protected AAStructureBindingModel newBindingModel(PDBEntry[] pdbFiles,... |
251 |
|
SequenceI[][] seqs, StructureSelectionManager ssm, |
252 |
|
AlignmentViewPanel avp) |
253 |
|
{ |
254 |
5 |
AAStructureBindingModel model = new AAStructureBindingModel(ssm, |
255 |
|
pdbFiles, seqs, null) |
256 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
257 |
4 |
@Override... |
258 |
|
public String[] getStructureFiles() |
259 |
|
{ |
260 |
4 |
String[] files = new String[getPdbCount()]; |
261 |
15 |
for (int i = 0; i < this.getPdbCount(); i++) |
262 |
|
{ |
263 |
11 |
files[i] = getPdbEntry(i).getFile(); |
264 |
|
} |
265 |
4 |
return files; |
266 |
|
} |
267 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
268 |
0 |
@Override... |
269 |
|
public void updateColours(Object source) |
270 |
|
{ |
271 |
|
} |
272 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
273 |
0 |
@Override... |
274 |
|
public void releaseReferences(Object svl) |
275 |
|
{ |
276 |
|
} |
277 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
278 |
0 |
@Override... |
279 |
|
public void highlightAtoms(List<AtomSpec> atoms) |
280 |
|
{ |
281 |
|
} |
282 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
283 |
1 |
@Override... |
284 |
|
public SequenceRenderer getSequenceRenderer(AlignmentViewPanel avp) |
285 |
|
{ |
286 |
1 |
return avp == null ? null |
287 |
|
: new jalview.gui.SequenceRenderer(avp.getAlignViewport()); |
288 |
|
} |
289 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
290 |
0 |
@Override... |
291 |
|
protected List<String> executeCommand(StructureCommandI command, |
292 |
|
boolean getReply) |
293 |
|
{ |
294 |
0 |
return null; |
295 |
|
} |
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
|
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
301 |
2 |
@Override... |
302 |
|
protected String getModelIdForFile(String pdbfile) |
303 |
|
{ |
304 |
3 |
for (int i = 0; i < this.getPdbCount(); i++) |
305 |
|
{ |
306 |
3 |
if (pdbfile.equals(this.getPdbEntry(i).getFile())) |
307 |
|
{ |
308 |
2 |
return String.valueOf(i); |
309 |
|
} |
310 |
|
} |
311 |
0 |
return ""; |
312 |
|
} |
313 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
314 |
0 |
@Override... |
315 |
|
protected ViewerType getViewerType() |
316 |
|
{ |
317 |
0 |
return null; |
318 |
|
} |
319 |
|
}; |
320 |
5 |
PA.setValue(model, "commandGenerator", new ChimeraCommands()); |
321 |
5 |
return model; |
322 |
|
} |
323 |
|
|
324 |
|
|
325 |
|
|
326 |
|
|
327 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (27) |
Complexity: 3 |
Complexity Density: 0.13 |
1PASS
|
|
328 |
1 |
@Test(groups = { "Functional" })... |
329 |
|
public void testFindSuperposableResidues() |
330 |
|
{ |
331 |
|
|
332 |
|
|
333 |
|
|
334 |
1 |
AAStructureBindingModel.SuperposeData[] structs = new AAStructureBindingModel.SuperposeData[testee |
335 |
|
.getStructureFiles().length]; |
336 |
4 |
for (int i = 0; i < structs.length; i++) |
337 |
|
{ |
338 |
3 |
structs[i] = new AAStructureBindingModel.SuperposeData(al.getWidth(), |
339 |
|
"0"); |
340 |
|
} |
341 |
|
|
342 |
|
|
343 |
|
|
344 |
|
|
345 |
1 |
BitSet matched = new BitSet(); |
346 |
7 |
for (int i = 0; i < al.getWidth(); i++) |
347 |
|
{ |
348 |
6 |
matched.set(i); |
349 |
|
} |
350 |
|
|
351 |
1 |
int refStructure = testee.findSuperposableResidues(al, matched, |
352 |
|
structs); |
353 |
|
|
354 |
1 |
assertEquals(refStructure, 0); |
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
|
359 |
1 |
assertFalse(matched.get(0)); |
360 |
1 |
assertTrue(matched.get(1)); |
361 |
1 |
assertFalse(matched.get(2)); |
362 |
1 |
assertFalse(matched.get(3)); |
363 |
1 |
assertTrue(matched.get(4)); |
364 |
1 |
assertTrue(matched.get(5)); |
365 |
|
|
366 |
1 |
assertEquals(structs[0].pdbId, "1YCS"); |
367 |
1 |
assertEquals(structs[1].pdbId, "3A6S"); |
368 |
1 |
assertEquals(structs[2].pdbId, "1OOT"); |
369 |
1 |
assertEquals(structs[0].chain, "A"); |
370 |
1 |
assertEquals(structs[1].chain, "B"); |
371 |
1 |
assertEquals(structs[2].chain, "A"); |
372 |
|
|
373 |
1 |
assertEquals(Arrays.toString(structs[0].pdbResNo), |
374 |
|
"[0, 97, 98, 99, 100, 102]"); |
375 |
1 |
assertEquals(Arrays.toString(structs[1].pdbResNo), |
376 |
|
"[0, 2, 0, 3, 4, 5]"); |
377 |
1 |
assertEquals(Arrays.toString(structs[2].pdbResNo), |
378 |
|
"[0, 8, 0, 0, 10, 12]"); |
379 |
|
} |
380 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 3 |
Complexity Density: 0.2 |
1PASS
|
|
381 |
1 |
@Test(groups = { "Functional" })... |
382 |
|
public void testFindSuperposableResidues_hiddenColumn() |
383 |
|
{ |
384 |
1 |
AAStructureBindingModel.SuperposeData[] structs = new AAStructureBindingModel.SuperposeData[al |
385 |
|
.getHeight()]; |
386 |
5 |
for (int i = 0; i < structs.length; i++) |
387 |
|
{ |
388 |
4 |
structs[i] = new AAStructureBindingModel.SuperposeData(al.getWidth(), |
389 |
|
"0"); |
390 |
|
} |
391 |
|
|
392 |
|
|
393 |
|
|
394 |
|
|
395 |
1 |
BitSet matched = new BitSet(); |
396 |
7 |
for (int i = 0; i < al.getWidth(); i++) |
397 |
|
{ |
398 |
6 |
matched.set(i); |
399 |
|
} |
400 |
|
|
401 |
|
|
402 |
1 |
matched.clear(4); |
403 |
|
|
404 |
1 |
int refStructure = testee.findSuperposableResidues(al, matched, |
405 |
|
structs); |
406 |
|
|
407 |
1 |
assertEquals(refStructure, 0); |
408 |
|
|
409 |
|
|
410 |
1 |
assertFalse(matched.get(0)); |
411 |
1 |
assertTrue(matched.get(1)); |
412 |
1 |
assertFalse(matched.get(2)); |
413 |
1 |
assertFalse(matched.get(3)); |
414 |
1 |
assertFalse(matched.get(4)); |
415 |
1 |
assertTrue(matched.get(5)); |
416 |
|
} |
417 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (49) |
Complexity: 2 |
Complexity Density: 0.04 |
1PASS
|
|
418 |
1 |
@Test(groups = { "Functional" })... |
419 |
|
public void testBuildColoursMap() |
420 |
|
{ |
421 |
|
|
422 |
|
|
423 |
|
|
424 |
|
|
425 |
1 |
String fasta = ">seq1\nMHRSQSSSGG\n>seq2\nMVRSNGGSSS"; |
426 |
1 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(fasta, |
427 |
|
DataSourceType.PASTE); |
428 |
1 |
AlignmentI al = af.getViewport().getAlignment(); |
429 |
1 |
af.changeColour_actionPerformed(JalviewColourScheme.Strand.toString()); |
430 |
1 |
ColumnSelection cs = new ColumnSelection(); |
431 |
1 |
cs.addElement(2); |
432 |
1 |
cs.addElement(3); |
433 |
1 |
cs.addElement(4); |
434 |
1 |
af.getViewport().setColumnSelection(cs); |
435 |
1 |
af.hideSelColumns_actionPerformed(null); |
436 |
1 |
SequenceI seq1 = al.getSequenceAt(0); |
437 |
1 |
SequenceI seq2 = al.getSequenceAt(1); |
438 |
1 |
SequenceI[][] seqs = new SequenceI[][] { { seq1 }, { seq2 } }; |
439 |
1 |
PDBEntry[] pdbFiles = new PDBEntry[2]; |
440 |
1 |
pdbFiles[0] = new PDBEntry("PDB1", "A", Type.PDB, "seq1.pdb"); |
441 |
1 |
pdbFiles[1] = new PDBEntry("PDB2", "B", Type.PDB, "seq2.pdb"); |
442 |
1 |
StructureSelectionManager ssm = new StructureSelectionManager(); |
443 |
|
|
444 |
|
|
445 |
|
|
446 |
|
|
447 |
1 |
HashMap<Integer, int[]> map = new HashMap<>(); |
448 |
11 |
for (int pos = 1; pos <= seq1.getLength(); pos++) |
449 |
|
{ |
450 |
10 |
map.put(pos, new int[] { 20 + pos, 5 * (20 + pos) }); |
451 |
|
} |
452 |
1 |
StructureMapping sm1 = new StructureMapping(seq1, "seq1.pdb", "pdb1", |
453 |
|
"A", map, null); |
454 |
1 |
ssm.addStructureMapping(sm1); |
455 |
1 |
StructureMapping sm2 = new StructureMapping(seq2, "seq2.pdb", "pdb2", |
456 |
|
"B", map, null); |
457 |
1 |
ssm.addStructureMapping(sm2); |
458 |
|
|
459 |
1 |
AAStructureBindingModel binding = newBindingModel(pdbFiles, seqs, ssm, |
460 |
|
af.alignPanel); |
461 |
|
|
462 |
|
|
463 |
|
|
464 |
|
|
465 |
|
|
466 |
1 |
Map<Object, AtomSpecModel> colours = binding.buildColoursMap(ssm, seqs, |
467 |
|
af.alignPanel); |
468 |
1 |
ChimeraCommands helper = new ChimeraCommands(); |
469 |
|
|
470 |
|
|
471 |
|
|
472 |
|
|
473 |
|
|
474 |
1 |
Color mColor = new Color(0x82827d); |
475 |
1 |
AtomSpecModel atomSpec = colours.get(mColor); |
476 |
1 |
assertNotNull(atomSpec); |
477 |
1 |
assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY), |
478 |
|
"#0:21.A|#1:21.B"); |
479 |
|
|
480 |
|
|
481 |
|
|
482 |
|
|
483 |
1 |
Color hColor = new Color(0x60609f); |
484 |
1 |
atomSpec = colours.get(hColor); |
485 |
1 |
assertNotNull(atomSpec); |
486 |
1 |
assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY), |
487 |
|
"#0:22.A"); |
488 |
|
|
489 |
|
|
490 |
|
|
491 |
|
|
492 |
1 |
Color vColor = new Color(0xffff00); |
493 |
1 |
atomSpec = colours.get(vColor); |
494 |
1 |
assertNotNull(atomSpec); |
495 |
1 |
assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY), |
496 |
|
"#1:22.B"); |
497 |
|
|
498 |
|
|
499 |
|
|
500 |
|
|
501 |
|
|
502 |
1 |
Color gray = new Color(128, 128, 128); |
503 |
1 |
atomSpec = colours.get(gray); |
504 |
1 |
assertNotNull(atomSpec); |
505 |
1 |
assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY), |
506 |
|
"#0:23-25.A|#1:23-25.B"); |
507 |
|
|
508 |
|
|
509 |
|
|
510 |
|
|
511 |
1 |
Color sgColour = new Color(0x4949b6); |
512 |
1 |
atomSpec = colours.get(sgColour); |
513 |
1 |
assertNotNull(atomSpec); |
514 |
1 |
assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY), |
515 |
|
"#0:26-30.A|#1:26-30.B"); |
516 |
|
} |
517 |
|
} |