1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ws.sifts; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertTrue; |
25 |
|
|
26 |
|
import jalview.api.DBRefEntryI; |
27 |
|
import jalview.bin.Cache; |
28 |
|
import jalview.datamodel.DBRefEntry; |
29 |
|
import jalview.datamodel.DBRefSource; |
30 |
|
import jalview.datamodel.Sequence; |
31 |
|
import jalview.datamodel.SequenceI; |
32 |
|
import jalview.gui.JvOptionPane; |
33 |
|
import jalview.io.DataSourceType; |
34 |
|
import jalview.structure.StructureMapping; |
35 |
|
import jalview.xml.binding.sifts.Entry.Entity; |
36 |
|
|
37 |
|
import java.io.File; |
38 |
|
import java.io.IOException; |
39 |
|
import java.util.ArrayList; |
40 |
|
import java.util.HashMap; |
41 |
|
import java.util.Iterator; |
42 |
|
import java.util.Map; |
43 |
|
|
44 |
|
import org.testng.Assert; |
45 |
|
import org.testng.FileAssert; |
46 |
|
import org.testng.annotations.AfterTest; |
47 |
|
import org.testng.annotations.BeforeClass; |
48 |
|
import org.testng.annotations.BeforeTest; |
49 |
|
import org.testng.annotations.Test; |
50 |
|
|
51 |
|
import mc_view.Atom; |
52 |
|
import mc_view.PDBfile; |
53 |
|
|
|
|
| 41% |
Uncovered Elements: 158 (268) |
Complexity: 30 |
Complexity Density: 0.13 |
|
54 |
|
public class SiftsClientTest |
55 |
|
{ |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
57 |
0 |
@BeforeClass(alwaysRun = true)... |
58 |
|
public void setUpJvOptionPane() |
59 |
|
{ |
60 |
0 |
JvOptionPane.setInteractiveMode(false); |
61 |
0 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
62 |
|
} |
63 |
|
|
64 |
|
public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = System |
65 |
|
.getProperty("user.home") |
66 |
|
+ File.separatorChar |
67 |
|
+ ".sifts_downloads" + File.separatorChar; |
68 |
|
|
69 |
|
private String testPDBId = "1a70"; |
70 |
|
|
71 |
|
private SiftsClient siftsClient = null; |
72 |
|
|
73 |
|
SequenceI testSeq = new Sequence( |
74 |
|
"P00221", |
75 |
|
"MAAT..TTTMMG..MATTFVPKPQAPPMMAALPSNTGR..SLFGLKT.GSR..GGRMTMA" |
76 |
|
+ "AYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDD" |
77 |
|
+ "QSFLDDDQIDEGWVLTCAAYPVSDVTIETHKEEELTA.", 1, 147); |
78 |
|
|
79 |
|
int u = SiftsClient.UNASSIGNED; |
80 |
|
|
81 |
|
HashMap<Integer, int[]> expectedMapping = new HashMap<Integer, int[]>(); |
82 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (97) |
Complexity: 1 |
Complexity Density: 0.01 |
|
83 |
1 |
@BeforeTest(alwaysRun = true)... |
84 |
|
public void populateExpectedMapping() throws SiftsException |
85 |
|
{ |
86 |
1 |
expectedMapping.put(51, new int[] { 1, 2, 1 }); |
87 |
1 |
expectedMapping.put(52, new int[] { 2, 7, 2 }); |
88 |
1 |
expectedMapping.put(53, new int[] { 3, 12, 3 }); |
89 |
1 |
expectedMapping.put(54, new int[] { 4, 24, 4 }); |
90 |
1 |
expectedMapping.put(55, new int[] { 5, 33, 5 }); |
91 |
1 |
expectedMapping.put(56, new int[] { 6, 40, 6 }); |
92 |
1 |
expectedMapping.put(57, new int[] { 7, 47, 7 }); |
93 |
1 |
expectedMapping.put(58, new int[] { 8, 55, 8 }); |
94 |
1 |
expectedMapping.put(59, new int[] { 9, 62, 9 }); |
95 |
1 |
expectedMapping.put(60, new int[] { 10, 69, 10 }); |
96 |
1 |
expectedMapping.put(61, new int[] { 11, 76, 11 }); |
97 |
1 |
expectedMapping.put(62, new int[] { 12, 83, 12 }); |
98 |
1 |
expectedMapping.put(63, new int[] { 13, 87, 13 }); |
99 |
1 |
expectedMapping.put(64, new int[] { 14, 95, 14 }); |
100 |
1 |
expectedMapping.put(65, new int[] { 15, 102, 15 }); |
101 |
1 |
expectedMapping.put(66, new int[] { 16, 111, 16 }); |
102 |
1 |
expectedMapping.put(67, new int[] { 17, 122, 17 }); |
103 |
1 |
expectedMapping.put(68, new int[] { 18, 131, 18 }); |
104 |
1 |
expectedMapping.put(69, new int[] { 19, 137, 19 }); |
105 |
1 |
expectedMapping.put(70, new int[] { 20, 144, 20 }); |
106 |
1 |
expectedMapping.put(71, new int[] { 21, 152, 21 }); |
107 |
1 |
expectedMapping.put(72, new int[] { 22, 160, 22 }); |
108 |
1 |
expectedMapping.put(73, new int[] { 23, 167, 23 }); |
109 |
1 |
expectedMapping.put(74, new int[] { 24, 179, 24 }); |
110 |
1 |
expectedMapping.put(75, new int[] { 25, 187, 25 }); |
111 |
1 |
expectedMapping.put(76, new int[] { 26, 195, 26 }); |
112 |
1 |
expectedMapping.put(77, new int[] { 27, 203, 27 }); |
113 |
1 |
expectedMapping.put(78, new int[] { 28, 208, 28 }); |
114 |
1 |
expectedMapping.put(79, new int[] { 29, 213, 29 }); |
115 |
1 |
expectedMapping.put(80, new int[] { 30, 222, 30 }); |
116 |
1 |
expectedMapping.put(81, new int[] { 31, 231, 31 }); |
117 |
1 |
expectedMapping.put(82, new int[] { 32, 240, 32 }); |
118 |
1 |
expectedMapping.put(83, new int[] { 33, 244, 33 }); |
119 |
1 |
expectedMapping.put(84, new int[] { 34, 252, 34 }); |
120 |
1 |
expectedMapping.put(85, new int[] { 35, 260, 35 }); |
121 |
1 |
expectedMapping.put(86, new int[] { 36, 268, 36 }); |
122 |
1 |
expectedMapping.put(87, new int[] { 37, 275, 37 }); |
123 |
1 |
expectedMapping.put(88, new int[] { 38, 287, 38 }); |
124 |
1 |
expectedMapping.put(89, new int[] { 39, 293, 39 }); |
125 |
1 |
expectedMapping.put(90, new int[] { 40, 299, 40 }); |
126 |
1 |
expectedMapping.put(91, new int[] { 41, 310, 41 }); |
127 |
1 |
expectedMapping.put(92, new int[] { 42, 315, 42 }); |
128 |
1 |
expectedMapping.put(93, new int[] { 43, 319, 43 }); |
129 |
1 |
expectedMapping.put(94, new int[] { 44, 325, 44 }); |
130 |
1 |
expectedMapping.put(95, new int[] { 45, 331, 45 }); |
131 |
1 |
expectedMapping.put(96, new int[] { 46, 337, 46 }); |
132 |
1 |
expectedMapping.put(97, new int[] { 47, 343, 47 }); |
133 |
1 |
expectedMapping.put(98, new int[] { 48, 349, 48 }); |
134 |
1 |
expectedMapping.put(99, new int[] { 49, 354, 49 }); |
135 |
1 |
expectedMapping.put(100, new int[] { 50, 358, 50 }); |
136 |
1 |
expectedMapping.put(101, new int[] { 51, 367, 51 }); |
137 |
1 |
expectedMapping.put(102, new int[] { 52, 375, 52 }); |
138 |
1 |
expectedMapping.put(103, new int[] { 53, 384, 53 }); |
139 |
1 |
expectedMapping.put(104, new int[] { 54, 391, 54 }); |
140 |
1 |
expectedMapping.put(105, new int[] { 55, 395, 55 }); |
141 |
1 |
expectedMapping.put(106, new int[] { 56, 401, 56 }); |
142 |
1 |
expectedMapping.put(107, new int[] { 57, 409, 57 }); |
143 |
1 |
expectedMapping.put(108, new int[] { 58, 417, 58 }); |
144 |
1 |
expectedMapping.put(109, new int[] { 59, 426, 59 }); |
145 |
1 |
expectedMapping.put(110, new int[] { 60, 434, 60 }); |
146 |
1 |
expectedMapping.put(111, new int[] { 61, 442, 61 }); |
147 |
1 |
expectedMapping.put(112, new int[] { 62, 451, 62 }); |
148 |
1 |
expectedMapping.put(113, new int[] { 63, 457, 63 }); |
149 |
1 |
expectedMapping.put(114, new int[] { 64, 468, 64 }); |
150 |
1 |
expectedMapping.put(115, new int[] { 65, 476, 65 }); |
151 |
1 |
expectedMapping.put(116, new int[] { 66, 484, 66 }); |
152 |
1 |
expectedMapping.put(117, new int[] { 67, 492, 67 }); |
153 |
1 |
expectedMapping.put(118, new int[] { 68, 500, 68 }); |
154 |
1 |
expectedMapping.put(119, new int[] { 69, 509, 69 }); |
155 |
1 |
expectedMapping.put(120, new int[] { 70, 517, 70 }); |
156 |
1 |
expectedMapping.put(121, new int[] { 71, 525, 71 }); |
157 |
1 |
expectedMapping.put(122, new int[] { 72, 534, 72 }); |
158 |
1 |
expectedMapping.put(123, new int[] { 73, 538, 73 }); |
159 |
1 |
expectedMapping.put(124, new int[] { 74, 552, 74 }); |
160 |
1 |
expectedMapping.put(125, new int[] { 75, 559, 75 }); |
161 |
1 |
expectedMapping.put(126, new int[] { 76, 567, 76 }); |
162 |
1 |
expectedMapping.put(127, new int[] { 77, 574, 77 }); |
163 |
1 |
expectedMapping.put(128, new int[] { 78, 580, 78 }); |
164 |
1 |
expectedMapping.put(129, new int[] { 79, 585, 79 }); |
165 |
1 |
expectedMapping.put(130, new int[] { 80, 590, 80 }); |
166 |
1 |
expectedMapping.put(131, new int[] { 81, 602, 81 }); |
167 |
1 |
expectedMapping.put(132, new int[] { 82, 609, 82 }); |
168 |
1 |
expectedMapping.put(133, new int[] { 83, 616, 83 }); |
169 |
1 |
expectedMapping.put(134, new int[] { 84, 622, 84 }); |
170 |
1 |
expectedMapping.put(135, new int[] { 85, 630, 85 }); |
171 |
1 |
expectedMapping.put(136, new int[] { 86, 637, 86 }); |
172 |
1 |
expectedMapping.put(137, new int[] { 87, 644, 87 }); |
173 |
1 |
expectedMapping.put(138, new int[] { 88, 652, 88 }); |
174 |
1 |
expectedMapping.put(139, new int[] { 89, 661, 89 }); |
175 |
1 |
expectedMapping.put(140, new int[] { 90, 668, 90 }); |
176 |
1 |
expectedMapping.put(141, new int[] { 91, 678, 91 }); |
177 |
1 |
expectedMapping.put(142, new int[] { 92, 687, 92 }); |
178 |
1 |
expectedMapping.put(143, new int[] { 93, 696, 93 }); |
179 |
1 |
expectedMapping.put(144, new int[] { 94, 705, 94 }); |
180 |
1 |
expectedMapping.put(145, new int[] { 95, 714, 95 }); |
181 |
1 |
expectedMapping.put(146, new int[] { 96, 722, 96 }); |
182 |
1 |
expectedMapping.put(147, new int[] { 97, 729, 97 }); |
183 |
|
} |
184 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
185 |
1 |
@BeforeTest(alwaysRun = true)... |
186 |
|
public void setUpSiftsClient() throws SiftsException, IOException |
187 |
|
{ |
188 |
|
|
189 |
1 |
Cache.loadProperties("test/jalview/io/testProps.jvprops"); |
190 |
|
|
191 |
|
|
192 |
1 |
new SiftsSettings(); |
193 |
1 |
SiftsSettings.setSiftDownloadDirectory(jalview.bin.Cache.getDefault( |
194 |
|
"sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR)); |
195 |
1 |
SiftsSettings.setMapWithSifts(true); |
196 |
1 |
SiftsSettings.setCacheThresholdInDays("2"); |
197 |
1 |
SiftsSettings.setFailSafePIDThreshold("70"); |
198 |
1 |
PDBfile pdbFile; |
199 |
1 |
pdbFile = new PDBfile(false, false, false, "test/jalview/io/" |
200 |
|
+ testPDBId + ".pdb", DataSourceType.FILE); |
201 |
1 |
siftsClient = new SiftsClient(pdbFile); |
202 |
|
} |
203 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
204 |
1 |
@AfterTest(alwaysRun = true)... |
205 |
|
public void cleanUpSiftsClient() |
206 |
|
{ |
207 |
1 |
siftsClient = null; |
208 |
|
} |
209 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 2 |
Complexity Density: 0.12 |
4-
|
|
210 |
0 |
@Test(groups = { "Network" })... |
211 |
|
public void getSIFTsFileTest() throws SiftsException, IOException |
212 |
|
{ |
213 |
0 |
File siftsFile; |
214 |
0 |
siftsFile = SiftsClient.downloadSiftsFile(testPDBId); |
215 |
0 |
FileAssert.assertFile(siftsFile); |
216 |
0 |
long t1 = siftsFile.lastModified(); |
217 |
|
|
218 |
|
|
219 |
0 |
siftsFile = SiftsClient.downloadSiftsFile(testPDBId); |
220 |
0 |
FileAssert.assertFile(siftsFile); |
221 |
0 |
long t2 = siftsFile.lastModified(); |
222 |
0 |
assertEquals(t1, t2); |
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
0 |
synchronized (this) |
230 |
|
{ |
231 |
0 |
try |
232 |
|
{ |
233 |
0 |
wait(1000); |
234 |
|
} catch (InterruptedException e) |
235 |
|
{ |
236 |
|
} |
237 |
|
} |
238 |
0 |
SiftsSettings.setCacheThresholdInDays("0"); |
239 |
0 |
siftsFile = SiftsClient.getSiftsFile(testPDBId); |
240 |
0 |
FileAssert.assertFile(siftsFile); |
241 |
0 |
long t3 = siftsFile.lastModified(); |
242 |
0 |
assertTrue(t3 > t2, "file timestamp unchanged at " + t3); |
243 |
|
|
244 |
0 |
SiftsSettings.setCacheThresholdInDays("2"); |
245 |
|
} |
246 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
4-
|
|
247 |
0 |
@Test(groups = { "Network" })... |
248 |
|
public void downloadSiftsFileTest() throws SiftsException, IOException |
249 |
|
{ |
250 |
|
|
251 |
|
|
252 |
0 |
Assert.assertTrue(SiftsClient.deleteSiftsFileByPDBId(testPDBId)); |
253 |
0 |
File siftsFile; |
254 |
0 |
siftsFile = SiftsClient.downloadSiftsFile(testPDBId); |
255 |
0 |
FileAssert.assertFile(siftsFile); |
256 |
0 |
SiftsClient.downloadSiftsFile(testPDBId); |
257 |
|
} |
258 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
4-
|
|
259 |
0 |
@Test(groups = { "Network" })... |
260 |
|
public void getAllMappingAccessionTest() |
261 |
|
{ |
262 |
0 |
Assert.assertNotNull(siftsClient); |
263 |
0 |
Assert.assertNotNull(siftsClient.getAllMappingAccession()); |
264 |
0 |
Assert.assertTrue(siftsClient.getAllMappingAccession().size() > 1); |
265 |
|
} |
266 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 3 |
Complexity Density: 0.18 |
4-
|
|
267 |
0 |
@Test(groups = { "Network" })... |
268 |
|
public void getGreedyMappingTest() |
269 |
|
{ |
270 |
0 |
Assert.assertNotNull(siftsClient); |
271 |
0 |
Assert.assertNotNull(testSeq); |
272 |
0 |
Assert.assertNotNull(expectedMapping); |
273 |
|
|
274 |
|
|
275 |
0 |
DBRefEntry dbRef = new DBRefEntry("uniprot", "", "P00221"); |
276 |
0 |
testSeq.addDBRef(dbRef); |
277 |
|
|
278 |
|
|
279 |
0 |
try |
280 |
|
{ |
281 |
0 |
HashMap<Integer, int[]> actualMapping = siftsClient.getGreedyMapping( |
282 |
|
"A", testSeq, null); |
283 |
0 |
Assert.assertEquals(testSeq.getStart(), 1); |
284 |
0 |
Assert.assertEquals(testSeq.getEnd(), 147); |
285 |
|
|
286 |
|
|
287 |
0 |
Assert.assertEquals(actualMapping.size(), expectedMapping.size()); |
288 |
0 |
Iterator<Map.Entry<Integer, int[]>> it = expectedMapping.entrySet() |
289 |
|
.iterator(); |
290 |
0 |
while (it.hasNext()) |
291 |
|
{ |
292 |
0 |
Map.Entry<Integer, int[]> pair = it.next(); |
293 |
0 |
Assert.assertTrue(actualMapping.containsKey(pair.getKey())); |
294 |
0 |
Assert.assertEquals(actualMapping.get(pair.getKey()), |
295 |
|
pair.getValue()); |
296 |
|
} |
297 |
|
|
298 |
|
} catch (Exception e) |
299 |
|
{ |
300 |
0 |
e.printStackTrace(); |
301 |
0 |
Assert.fail("Exception thrown while generating mapping..."); |
302 |
|
} |
303 |
|
} |
304 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
305 |
0 |
@Test(groups = { "Network" })... |
306 |
|
private void getAtomIndexTest() |
307 |
|
{ |
308 |
0 |
ArrayList<Atom> atoms = new ArrayList<Atom>(); |
309 |
0 |
Atom atom = new Atom(u, u, u); |
310 |
0 |
atom.resNumber = 43; |
311 |
0 |
atom.atomIndex = 7; |
312 |
0 |
atoms.add(atom); |
313 |
0 |
int actualAtomIndex = siftsClient.getAtomIndex(1, atoms); |
314 |
0 |
Assert.assertEquals(actualAtomIndex, siftsClient.UNASSIGNED); |
315 |
0 |
actualAtomIndex = siftsClient.getAtomIndex(43, atoms); |
316 |
0 |
Assert.assertEquals(actualAtomIndex, 7); |
317 |
|
} |
318 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
319 |
0 |
@Test(... |
320 |
|
groups = { "Network" }, |
321 |
|
expectedExceptions = IllegalArgumentException.class) |
322 |
|
private void getAtomIndexNullTest() |
323 |
|
{ |
324 |
0 |
siftsClient.getAtomIndex(1, null); |
325 |
|
} |
326 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
327 |
0 |
@Test(groups = { "Network" })... |
328 |
|
private void padWithGapsTest() |
329 |
|
{ |
330 |
|
|
331 |
|
} |
332 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
333 |
0 |
@Test(... |
334 |
|
groups = { "Network" }, |
335 |
|
expectedExceptions = SiftsException.class) |
336 |
|
private void populateAtomPositionsNullTest1() |
337 |
|
throws IllegalArgumentException, SiftsException |
338 |
|
{ |
339 |
0 |
siftsClient.populateAtomPositions(null, null); |
340 |
|
} |
341 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
342 |
0 |
@Test(... |
343 |
|
groups = { "Network" }, |
344 |
|
expectedExceptions = SiftsException.class) |
345 |
|
private void populateAtomPositionsNullTest2() |
346 |
|
throws IllegalArgumentException, SiftsException |
347 |
|
{ |
348 |
0 |
siftsClient.populateAtomPositions("A", null); |
349 |
|
} |
350 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
4-
|
|
351 |
0 |
@Test(groups = { "Network" })... |
352 |
|
public void getValidSourceDBRefTest() throws SiftsException |
353 |
|
{ |
354 |
0 |
DBRefEntryI actualValidSrcDBRef = siftsClient |
355 |
|
.getValidSourceDBRef(testSeq); |
356 |
0 |
DBRefEntryI expectedDBRef = new DBRefEntry(); |
357 |
0 |
expectedDBRef.setSource(DBRefSource.UNIPROT); |
358 |
0 |
expectedDBRef.setAccessionId("P00221"); |
359 |
0 |
expectedDBRef.setVersion(""); |
360 |
0 |
Assert.assertEquals(actualValidSrcDBRef, expectedDBRef); |
361 |
|
} |
362 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
4-
|
|
363 |
0 |
@Test(... |
364 |
|
groups = { "Network" }, |
365 |
|
expectedExceptions = SiftsException.class) |
366 |
|
public void getValidSourceDBRefExceptionTest() throws SiftsException |
367 |
|
{ |
368 |
0 |
SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH"); |
369 |
0 |
siftsClient.getValidSourceDBRef(invalidTestSeq); |
370 |
|
} |
371 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
4-
|
|
372 |
0 |
@Test(... |
373 |
|
groups = { "Network" }, |
374 |
|
expectedExceptions = SiftsException.class) |
375 |
|
public void getValidSourceDBRefExceptionXTest() throws SiftsException |
376 |
|
{ |
377 |
0 |
SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH"); |
378 |
0 |
DBRefEntry invalidDBRef = new DBRefEntry(); |
379 |
0 |
invalidDBRef.setAccessionId("BLAR"); |
380 |
0 |
invalidTestSeq.addDBRef(invalidDBRef); |
381 |
0 |
siftsClient.getValidSourceDBRef(invalidTestSeq); |
382 |
|
} |
383 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
4-
|
|
384 |
0 |
@Test(groups = { "Network" })... |
385 |
|
public void isValidDBRefEntryTest() |
386 |
|
{ |
387 |
0 |
DBRefEntryI validDBRef = new DBRefEntry(); |
388 |
0 |
validDBRef.setSource(DBRefSource.UNIPROT); |
389 |
0 |
validDBRef.setAccessionId("P00221"); |
390 |
0 |
validDBRef.setVersion(""); |
391 |
0 |
Assert.assertTrue(siftsClient.isValidDBRefEntry(validDBRef)); |
392 |
|
} |
393 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
4-
|
|
394 |
0 |
@Test(groups = { "Network" })... |
395 |
|
public void getSiftsStructureMappingTest() throws SiftsException |
396 |
|
{ |
397 |
0 |
Assert.assertTrue(SiftsSettings.isMapWithSifts()); |
398 |
0 |
StructureMapping strucMapping = siftsClient.getSiftsStructureMapping( |
399 |
|
testSeq, testPDBId, "A"); |
400 |
0 |
String expectedMappingOutput = "\nSequence ⟷ Structure mapping details\n" |
401 |
|
+ "Method: SIFTS\n\n" |
402 |
|
+ "P00221 : 51 - 147 Maps to \n" |
403 |
|
+ "1A70|A : 1 - 97\n\n" |
404 |
|
+ "P00221 AAYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLD\n" |
405 |
|
+ " |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n" |
406 |
|
+ "1A70|A AAYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLD\n\n" |
407 |
|
|
408 |
|
+ "P00221 DDQIDEGWVLTCAAYPVSDVTIETHKEEELTA\n" |
409 |
|
+ " |||||||||||||||||||||||||| |||||\n" |
410 |
|
+ "1A70|A DDQIDEGWVLTCAAYPVSDVTIETHKKEELTA\n\n" + |
411 |
|
|
412 |
|
"Length of alignment = 97\n" + "Percentage ID = 98.97\n"; |
413 |
|
|
414 |
0 |
Assert.assertEquals(strucMapping.getMappingDetailsOutput(), |
415 |
|
expectedMappingOutput); |
416 |
|
|
417 |
|
|
418 |
|
|
419 |
0 |
Assert.assertEquals(strucMapping.getMapping().size(), |
420 |
|
expectedMapping.size()); |
421 |
0 |
Iterator<Map.Entry<Integer, int[]>> it = expectedMapping.entrySet() |
422 |
|
.iterator(); |
423 |
0 |
while (it.hasNext()) |
424 |
|
{ |
425 |
0 |
Map.Entry<Integer, int[]> pair = it.next(); |
426 |
0 |
Assert.assertTrue(strucMapping.getMapping() |
427 |
|
.containsKey(pair.getKey())); |
428 |
0 |
Assert.assertEquals(strucMapping.getMapping().get(pair.getKey()), |
429 |
|
pair.getValue()); |
430 |
|
} |
431 |
|
} |
432 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
4-
|
|
433 |
0 |
@Test(groups = { "Network" })... |
434 |
|
public void getEntityCountTest() |
435 |
|
{ |
436 |
0 |
int actualEntityCount = siftsClient.getEntityCount(); |
437 |
0 |
System.out.println("actual entity count : " + actualEntityCount); |
438 |
0 |
Assert.assertEquals(actualEntityCount, 1); |
439 |
|
} |
440 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
4-
|
|
441 |
0 |
@Test(groups = { "Network" })... |
442 |
|
public void getDbAccessionIdTest() |
443 |
|
{ |
444 |
0 |
String actualDbAccId = siftsClient.getDbAccessionId(); |
445 |
0 |
System.out.println("Actual Db Accession Id: " + actualDbAccId); |
446 |
0 |
Assert.assertEquals(actualDbAccId, "1a70"); |
447 |
|
} |
448 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
4-
|
|
449 |
0 |
@Test(groups = { "Network" })... |
450 |
|
public void getDbCoordSysTest() |
451 |
|
{ |
452 |
0 |
String actualDbCoordSys = siftsClient.getDbCoordSys(); |
453 |
0 |
System.out.println("Actual DbCoordSys: " + actualDbCoordSys); |
454 |
0 |
Assert.assertEquals(actualDbCoordSys, "PDBe"); |
455 |
|
} |
456 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
4-
|
|
457 |
0 |
@Test(groups = { "Network" })... |
458 |
|
public void getDbSourceTest() |
459 |
|
{ |
460 |
0 |
String actualDbSource = siftsClient.getDbSource(); |
461 |
0 |
System.out.println("Actual DbSource: " + actualDbSource); |
462 |
0 |
Assert.assertEquals(actualDbSource, "PDBe"); |
463 |
|
} |
464 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
4-
|
|
465 |
0 |
@Test(groups = { "Network" })... |
466 |
|
public void getDbVersionTest() |
467 |
|
{ |
468 |
0 |
String actualDbVersion = siftsClient.getDbVersion(); |
469 |
0 |
System.out.println("Actual DbVersion: " + actualDbVersion); |
470 |
0 |
Assert.assertEquals(actualDbVersion, "2.0"); |
471 |
|
} |
472 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
4-
|
|
473 |
0 |
@Test(groups = { "Network" })... |
474 |
|
public void getEntityByMostOptimalMatchedIdTest1() throws IOException, |
475 |
|
SiftsException |
476 |
|
{ |
477 |
0 |
SiftsClient siftsClientX = null; |
478 |
0 |
PDBfile pdbFile; |
479 |
0 |
pdbFile = new PDBfile(false, false, false, "test/jalview/io/2nq2" |
480 |
|
+ ".pdb", DataSourceType.FILE); |
481 |
0 |
siftsClientX = new SiftsClient(pdbFile); |
482 |
0 |
Entity entityA = siftsClientX.getEntityByMostOptimalMatchedId("A"); |
483 |
0 |
Assert.assertEquals(entityA.getEntityId(), "A"); |
484 |
0 |
Entity entityB = siftsClientX.getEntityByMostOptimalMatchedId("B"); |
485 |
0 |
Assert.assertEquals(entityB.getEntityId(), "C"); |
486 |
0 |
Entity entityC = siftsClientX.getEntityByMostOptimalMatchedId("C"); |
487 |
0 |
Assert.assertEquals(entityC.getEntityId(), "B"); |
488 |
0 |
Entity entityD = siftsClientX.getEntityByMostOptimalMatchedId("D"); |
489 |
0 |
Assert.assertEquals(entityD.getEntityId(), "D"); |
490 |
|
|
491 |
|
} |
492 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
4-
|
|
493 |
0 |
@Test(groups = { "Network" })... |
494 |
|
public void getEntityByMostOptimalMatchedIdTest2() throws IOException, |
495 |
|
SiftsException |
496 |
|
{ |
497 |
|
|
498 |
|
|
499 |
|
|
500 |
0 |
SiftsClient siftsClientX = null; |
501 |
0 |
PDBfile pdbFile; |
502 |
0 |
pdbFile = new PDBfile(false, false, false, "test/jalview/io/3ucu.cif", |
503 |
|
DataSourceType.FILE); |
504 |
0 |
siftsClientX = new SiftsClient(pdbFile); |
505 |
0 |
Entity entityA = siftsClientX.getEntityByMostOptimalMatchedId("P"); |
506 |
0 |
Entity entityP = siftsClientX.getEntityByMostOptimalMatchedId("A"); |
507 |
0 |
Entity entityR = siftsClientX.getEntityByMostOptimalMatchedId("R"); |
508 |
0 |
Assert.assertEquals(entityA.getEntityId(), "A"); |
509 |
0 |
Assert.assertNotEquals(entityR, "A"); |
510 |
0 |
Assert.assertNotEquals(entityP, "A"); |
511 |
0 |
Assert.assertNotEquals(entityR, "R"); |
512 |
0 |
Assert.assertNotEquals(entityP, "P"); |
513 |
0 |
Assert.assertNull(entityR); |
514 |
0 |
Assert.assertNull(entityP); |
515 |
|
|
516 |
|
} |
517 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
4-
|
|
518 |
0 |
@Test(groups = { "Network" })... |
519 |
|
public void getLeadingIntegerFromString() |
520 |
|
{ |
521 |
0 |
Assert.assertEquals( |
522 |
|
SiftsClient.getLeadingIntegerValue("1234abcd", -1), 1234); |
523 |
0 |
Assert.assertEquals( |
524 |
|
SiftsClient.getLeadingIntegerValue("1234", -1), |
525 |
|
1234); |
526 |
0 |
Assert.assertEquals( |
527 |
|
SiftsClient.getLeadingIntegerValue("abcd", -1), -1); |
528 |
0 |
Assert.assertEquals( |
529 |
|
SiftsClient.getLeadingIntegerValue("abcd1234", -1), -1); |
530 |
0 |
Assert.assertEquals( |
531 |
|
SiftsClient.getLeadingIntegerValue("None", -1), -1); |
532 |
0 |
Assert.assertEquals( |
533 |
|
SiftsClient.getLeadingIntegerValue("Null", -1), -1); |
534 |
|
} |
535 |
|
} |