1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
package jalview.ws.dbsources; |
23 |
|
|
24 |
|
import java.io.File; |
25 |
|
import java.io.FileInputStream; |
26 |
|
import java.io.FileNotFoundException; |
27 |
|
import java.io.IOException; |
28 |
|
import java.io.InputStream; |
29 |
|
import java.util.ArrayList; |
30 |
|
import java.util.Date; |
31 |
|
import java.util.HashMap; |
32 |
|
import java.util.List; |
33 |
|
import java.util.Map; |
34 |
|
|
35 |
|
import org.json.simple.JSONArray; |
36 |
|
import org.json.simple.JSONObject; |
37 |
|
import org.json.simple.parser.ParseException; |
38 |
|
|
39 |
|
import com.stevesoft.pat.Regex; |
40 |
|
|
41 |
|
import jalview.api.FeatureSettingsModelI; |
42 |
|
import jalview.bin.Console; |
43 |
|
import jalview.datamodel.AlignmentAnnotation; |
44 |
|
import jalview.datamodel.AlignmentI; |
45 |
|
import jalview.datamodel.ContactMatrixI; |
46 |
|
import jalview.datamodel.DBRefEntry; |
47 |
|
import jalview.datamodel.GroupSet; |
48 |
|
import jalview.datamodel.PDBEntry; |
49 |
|
import jalview.datamodel.SequenceFeature; |
50 |
|
import jalview.datamodel.SequenceI; |
51 |
|
import jalview.gui.Desktop; |
52 |
|
import jalview.io.DataSourceType; |
53 |
|
import jalview.io.FileFormat; |
54 |
|
import jalview.io.FileFormatI; |
55 |
|
import jalview.io.FormatAdapter; |
56 |
|
import jalview.io.PDBFeatureSettings; |
57 |
|
import jalview.structure.StructureImportSettings.TFType; |
58 |
|
import jalview.structure.StructureMapping; |
59 |
|
import jalview.structure.StructureSelectionManager; |
60 |
|
import jalview.util.MessageManager; |
61 |
|
import jalview.util.Platform; |
62 |
|
import jalview.ws.datamodel.alphafold.PAEContactMatrix; |
63 |
|
import jalview.ws.utils.UrlDownloadClient; |
64 |
|
|
65 |
|
|
66 |
|
@author |
67 |
|
|
68 |
|
|
|
|
| 30.2% |
Uncovered Elements: 187 (268) |
Complexity: 82 |
Complexity Density: 0.48 |
|
69 |
|
public class EBIAlfaFold extends EbiFileRetrievedProxy |
70 |
|
{ |
71 |
|
private static final String SEPARATOR = "|"; |
72 |
|
|
73 |
|
private static final String COLON = ":"; |
74 |
|
|
75 |
|
private static final int PDB_ID_LENGTH = 4; |
76 |
|
|
77 |
|
private static String AF_VERSION = "3"; |
78 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
0 |
public EBIAlfaFold()... |
80 |
|
{ |
81 |
0 |
super(); |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
@see |
88 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
0 |
@Override... |
90 |
|
public String getAccessionSeparator() |
91 |
|
{ |
92 |
0 |
return null; |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
@see |
99 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
100 |
0 |
@Override... |
101 |
|
public Regex getAccessionValidator() |
102 |
|
{ |
103 |
0 |
Regex validator = new Regex("(AF-[A-Z]+[0-9]+[A-Z0-9]+-F1)"); |
104 |
0 |
validator.setIgnoreCase(true); |
105 |
0 |
return validator; |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
@see |
112 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
113 |
0 |
@Override... |
114 |
|
public String getDbSource() |
115 |
|
{ |
116 |
0 |
return "ALPHAFOLD"; |
117 |
|
} |
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
@see |
123 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
124 |
0 |
@Override... |
125 |
|
public String getDbVersion() |
126 |
|
{ |
127 |
0 |
return "1"; |
128 |
|
} |
129 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
130 |
0 |
public static String getAlphaFoldCifDownloadUrl(String id, String vnum)... |
131 |
|
{ |
132 |
0 |
if (vnum == null || vnum.length() == 0) |
133 |
|
{ |
134 |
0 |
vnum = AF_VERSION; |
135 |
|
} |
136 |
0 |
return "https://alphafold.ebi.ac.uk/files/" + id + "-model_v" + vnum |
137 |
|
+ ".cif"; |
138 |
|
} |
139 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
140 |
6 |
public static String getAlphaFoldPaeDownloadUrl(String id, String vnum)... |
141 |
|
{ |
142 |
6 |
if (vnum == null || vnum.length() == 0) |
143 |
|
{ |
144 |
0 |
vnum = AF_VERSION; |
145 |
|
} |
146 |
6 |
return "https://alphafold.ebi.ac.uk/files/" + id |
147 |
|
+ "-predicted_aligned_error_v" + vnum + ".json"; |
148 |
|
} |
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
@see |
154 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
155 |
0 |
@Override... |
156 |
|
public AlignmentI getSequenceRecords(String queries) throws Exception |
157 |
|
{ |
158 |
0 |
return getSequenceRecords(queries, null); |
159 |
|
} |
160 |
|
|
|
|
| 0% |
Uncovered Elements: 39 (39) |
Complexity: 9 |
Complexity Density: 0.33 |
|
161 |
0 |
public AlignmentI getSequenceRecords(String queries, String retrievalUrl)... |
162 |
|
throws Exception |
163 |
|
{ |
164 |
0 |
AlignmentI pdbAlignment = null; |
165 |
0 |
String chain = null; |
166 |
0 |
String id = null; |
167 |
0 |
if (queries.indexOf(COLON) > -1) |
168 |
|
{ |
169 |
0 |
chain = queries.substring(queries.indexOf(COLON) + 1); |
170 |
0 |
id = queries.substring(0, queries.indexOf(COLON)); |
171 |
|
} |
172 |
|
else |
173 |
|
{ |
174 |
0 |
id = queries; |
175 |
|
} |
176 |
|
|
177 |
0 |
if (!isValidReference(id)) |
178 |
|
{ |
179 |
0 |
jalview.bin.Console.errPrintln( |
180 |
|
"(AFClient) Ignoring invalid alphafold query: '" + id + "'"); |
181 |
0 |
stopQuery(); |
182 |
0 |
return null; |
183 |
|
} |
184 |
0 |
String alphaFoldCif = getAlphaFoldCifDownloadUrl(id, AF_VERSION); |
185 |
0 |
if (retrievalUrl != null) |
186 |
|
{ |
187 |
0 |
alphaFoldCif = retrievalUrl; |
188 |
|
} |
189 |
|
|
190 |
0 |
try |
191 |
|
{ |
192 |
0 |
File tmpFile = File.createTempFile(id, ".cif"); |
193 |
0 |
Console.debug("Retrieving structure file for " + id + " from " |
194 |
|
+ alphaFoldCif); |
195 |
0 |
UrlDownloadClient.download(alphaFoldCif, tmpFile); |
196 |
|
|
197 |
|
|
198 |
0 |
file = tmpFile.getAbsolutePath(); |
199 |
0 |
if (file == null) |
200 |
|
{ |
201 |
0 |
return null; |
202 |
|
} |
203 |
|
|
204 |
|
|
205 |
0 |
pdbAlignment = importDownloadedStructureFromUrl(alphaFoldCif, tmpFile, |
206 |
|
id, chain, getDbSource(), getDbVersion()); |
207 |
|
|
208 |
0 |
if (pdbAlignment == null || pdbAlignment.getHeight() < 1) |
209 |
|
{ |
210 |
0 |
throw new Exception(MessageManager.formatMessage( |
211 |
|
"exception.no_pdb_records_for_chain", new String[] |
212 |
0 |
{ id, ((chain == null) ? "' '" : chain) })); |
213 |
|
} |
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
} catch (Exception ex) |
218 |
|
{ |
219 |
0 |
stopQuery(); |
220 |
0 |
throw (ex); |
221 |
|
} |
222 |
0 |
return pdbAlignment; |
223 |
|
} |
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
@param |
230 |
|
@param |
231 |
|
@param |
232 |
|
|
233 |
|
|
234 |
|
@throws |
235 |
|
@throws |
236 |
|
|
|
|
| 77.3% |
Uncovered Elements: 5 (22) |
Complexity: 8 |
Complexity Density: 0.5 |
|
237 |
6 |
public static File fetchAlphaFoldPAE(String id, String retrievalUrl)... |
238 |
|
throws IOException |
239 |
|
{ |
240 |
|
|
241 |
|
|
242 |
6 |
String paeURL = getAlphaFoldPaeDownloadUrl(id, AF_VERSION); |
243 |
|
|
244 |
6 |
if (retrievalUrl != null) |
245 |
|
{ |
246 |
|
|
247 |
0 |
paeURL = retrievalUrl.replace("model", "predicted_aligned_error") |
248 |
|
.replace(".cif", ".json"); |
249 |
|
} |
250 |
|
|
251 |
|
|
252 |
6 |
File pae = paeDownloadCache.get(paeURL); |
253 |
6 |
if (pae != null && pae.exists() && (new Date().getTime() |
254 |
|
- pae.lastModified()) < PAE_CACHE_STALE_TIME) |
255 |
|
{ |
256 |
5 |
Console.debug( |
257 |
|
"Using existing file in PAE cache for '" + paeURL + "'"); |
258 |
5 |
return pae; |
259 |
|
} |
260 |
|
|
261 |
1 |
try |
262 |
|
{ |
263 |
1 |
pae = File.createTempFile(id == null ? "af_pae" : id, "pae_json"); |
264 |
|
} catch (IOException e) |
265 |
|
{ |
266 |
0 |
e.printStackTrace(); |
267 |
|
} |
268 |
1 |
Console.debug("Downloading pae from " + paeURL + " to " + pae.toString() |
269 |
|
+ ""); |
270 |
1 |
try |
271 |
|
{ |
272 |
1 |
UrlDownloadClient.download(paeURL, pae); |
273 |
|
} catch (IOException e) |
274 |
|
{ |
275 |
0 |
throw e; |
276 |
|
} |
277 |
|
|
278 |
1 |
paeDownloadCache.put(paeURL, pae); |
279 |
1 |
return pae; |
280 |
|
} |
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
@param |
287 |
|
@param |
288 |
|
@param |
289 |
|
|
290 |
|
|
291 |
|
@throws |
292 |
|
@throws |
293 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
294 |
0 |
public static void retrieve_AlphaFold_pAE(String id,... |
295 |
|
AlignmentI pdbAlignment, String retrievalUrl) throws IOException |
296 |
|
{ |
297 |
0 |
File pae = fetchAlphaFoldPAE(id, retrievalUrl); |
298 |
0 |
addAlphaFoldPAE(pdbAlignment, pae, 0, null, false, false, null); |
299 |
|
} |
300 |
|
|
|
|
| 34.8% |
Uncovered Elements: 15 (23) |
Complexity: 8 |
Complexity Density: 0.53 |
|
301 |
42 |
public static void addAlphaFoldPAE(AlignmentI pdbAlignment, File pae,... |
302 |
|
int index, String id, boolean isStruct, boolean isStructId, |
303 |
|
String label) |
304 |
|
{ |
305 |
42 |
FileInputStream paeInput = null; |
306 |
42 |
try |
307 |
|
{ |
308 |
42 |
paeInput = new FileInputStream(pae); |
309 |
|
} catch (FileNotFoundException e) |
310 |
|
{ |
311 |
0 |
Console.error( |
312 |
|
"Could not find pAE file '" + pae.getAbsolutePath() + "'", e); |
313 |
0 |
return; |
314 |
|
} |
315 |
|
|
316 |
42 |
if (isStruct) |
317 |
|
{ |
318 |
|
|
319 |
|
|
320 |
0 |
StructureSelectionManager ssm = StructureSelectionManager |
321 |
|
.getStructureSelectionManager(Desktop.instance); |
322 |
0 |
if (ssm != null) |
323 |
|
{ |
324 |
0 |
String structFilename = isStructId ? ssm.findFileForPDBId(id) : id; |
325 |
0 |
addPAEToStructure(ssm, structFilename, pae, label); |
326 |
|
} |
327 |
|
|
328 |
|
} |
329 |
|
else |
330 |
|
{ |
331 |
|
|
332 |
42 |
try |
333 |
|
{ |
334 |
42 |
if (!importPaeJSONAsContactMatrixToSequence(pdbAlignment, paeInput, |
335 |
|
index, id, label)) |
336 |
|
{ |
337 |
0 |
Console.warn("Could not import contact matrix from '" |
338 |
|
+ pae.getAbsolutePath() + "' to sequence."); |
339 |
|
} |
340 |
|
} catch (IOException e1) |
341 |
|
{ |
342 |
0 |
Console.error("Error when importing pAE file '" |
343 |
|
+ pae.getAbsolutePath() + "'", e1); |
344 |
|
} catch (ParseException e2) |
345 |
|
{ |
346 |
0 |
Console.error("Error when parsing pAE file '" |
347 |
|
+ pae.getAbsolutePath() + "'", e2); |
348 |
|
} |
349 |
|
} |
350 |
|
|
351 |
|
} |
352 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 7 |
Complexity Density: 0.5 |
|
353 |
0 |
public static void addPAEToStructure(StructureSelectionManager ssm,... |
354 |
|
String structFilename, File pae, String label) |
355 |
|
{ |
356 |
0 |
FileInputStream paeInput = null; |
357 |
0 |
try |
358 |
|
{ |
359 |
0 |
paeInput = new FileInputStream(pae); |
360 |
|
} catch (FileNotFoundException e) |
361 |
|
{ |
362 |
0 |
Console.error( |
363 |
|
"Could not find pAE file '" + pae.getAbsolutePath() + "'", e); |
364 |
0 |
return; |
365 |
|
} |
366 |
0 |
if (ssm == null) |
367 |
|
{ |
368 |
0 |
ssm = StructureSelectionManager |
369 |
|
.getStructureSelectionManager(Desktop.instance); |
370 |
|
} |
371 |
0 |
if (ssm != null) |
372 |
|
{ |
373 |
0 |
StructureMapping[] smArray = ssm.getMapping(structFilename); |
374 |
|
|
375 |
0 |
try |
376 |
|
{ |
377 |
0 |
if (!importPaeJSONAsContactMatrixToStructure(smArray, paeInput, |
378 |
|
label)) |
379 |
|
{ |
380 |
0 |
Console.warn("Could not import contact matrix from '" |
381 |
|
+ pae.getAbsolutePath() + "' to structure."); |
382 |
|
} |
383 |
|
} catch (IOException e1) |
384 |
|
{ |
385 |
0 |
Console.error("Error when importing pAE file '" |
386 |
|
+ pae.getAbsolutePath() + "'", e1); |
387 |
|
} catch (ParseException e2) |
388 |
|
{ |
389 |
0 |
Console.error("Error when parsing pAE file '" |
390 |
|
+ pae.getAbsolutePath() + "'", e2); |
391 |
|
} |
392 |
|
} |
393 |
|
} |
394 |
|
|
395 |
|
|
396 |
|
|
397 |
|
|
398 |
|
|
399 |
|
@param |
400 |
|
@param |
401 |
|
@return |
402 |
|
@throws |
403 |
|
@throws |
404 |
|
@throws |
405 |
|
|
|
|
| 47.8% |
Uncovered Elements: 12 (23) |
Complexity: 7 |
Complexity Density: 0.54 |
|
406 |
42 |
public static boolean importPaeJSONAsContactMatrixToSequence(... |
407 |
|
AlignmentI pdbAlignment, InputStream pae_input, int index, |
408 |
|
String seqId, String label) throws IOException, ParseException |
409 |
|
{ |
410 |
42 |
SequenceI sequence = null; |
411 |
42 |
if (seqId == null) |
412 |
|
{ |
413 |
42 |
int seqToGet = index > 0 ? index : 0; |
414 |
42 |
sequence = pdbAlignment.getSequenceAt(seqToGet); |
415 |
|
} |
416 |
42 |
if (sequence == null) |
417 |
|
{ |
418 |
0 |
SequenceI[] sequences = pdbAlignment.findSequenceMatch(seqId); |
419 |
0 |
if (sequences == null || sequences.length < 1) |
420 |
|
{ |
421 |
0 |
Console.warn("Could not find sequence with id '" + seqId |
422 |
|
+ "' to attach pAE matrix to. Ignoring matrix."); |
423 |
0 |
return false; |
424 |
|
} |
425 |
|
else |
426 |
|
{ |
427 |
0 |
sequence = sequences[0]; |
428 |
|
} |
429 |
|
} |
430 |
42 |
if (sequence == null) |
431 |
|
{ |
432 |
0 |
return false; |
433 |
|
} |
434 |
42 |
return importPaeJSONAsContactMatrixToSequence(pdbAlignment, pae_input, |
435 |
|
sequence, label); |
436 |
|
} |
437 |
|
|
|
|
| 64.3% |
Uncovered Elements: 5 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
438 |
42 |
public static boolean importPaeJSONAsContactMatrixToSequence(... |
439 |
|
AlignmentI pdbAlignment, InputStream pae_input, |
440 |
|
SequenceI sequence, String label) |
441 |
|
throws IOException, ParseException |
442 |
|
{ |
443 |
42 |
JSONObject paeDict = parseJSONtoPAEContactMatrix(pae_input); |
444 |
42 |
if (paeDict == null) |
445 |
|
{ |
446 |
0 |
Console.debug("JSON file did not parse properly."); |
447 |
0 |
return false; |
448 |
|
} |
449 |
42 |
ContactMatrixI matrix = new PAEContactMatrix(sequence, |
450 |
|
(Map<String, Object>) paeDict); |
451 |
|
|
452 |
42 |
AlignmentAnnotation cmannot = sequence.addContactList(matrix); |
453 |
42 |
if (label != null) |
454 |
0 |
cmannot.label = label; |
455 |
42 |
pdbAlignment.addAnnotation(cmannot); |
456 |
|
|
457 |
42 |
return true; |
458 |
|
} |
459 |
|
|
|
|
| 86.7% |
Uncovered Elements: 2 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
460 |
48 |
public static JSONObject parseJSONtoPAEContactMatrix(... |
461 |
|
InputStream pae_input) throws IOException, ParseException |
462 |
|
{ |
463 |
48 |
Object paeJson = Platform.parseJSON(pae_input); |
464 |
48 |
JSONObject paeDict = null; |
465 |
48 |
if (paeJson instanceof JSONObject) |
466 |
|
{ |
467 |
15 |
paeDict = (JSONObject) paeJson; |
468 |
|
} |
469 |
33 |
else if (paeJson instanceof JSONArray) |
470 |
|
{ |
471 |
33 |
JSONArray jsonArray = (JSONArray) paeJson; |
472 |
33 |
if (jsonArray.size() > 0) |
473 |
33 |
paeDict = (JSONObject) jsonArray.get(0); |
474 |
|
} |
475 |
|
|
476 |
48 |
return paeDict; |
477 |
|
} |
478 |
|
|
479 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
480 |
3 |
public static boolean importPaeJSONAsContactMatrixToStructure(... |
481 |
|
StructureMapping[] smArray, InputStream paeInput, String label) |
482 |
|
throws IOException, ParseException |
483 |
|
{ |
484 |
3 |
boolean someDone = false; |
485 |
3 |
for (StructureMapping sm : smArray) |
486 |
|
{ |
487 |
3 |
boolean thisDone = importPaeJSONAsContactMatrixToStructure(sm, |
488 |
|
paeInput, label); |
489 |
3 |
someDone |= thisDone; |
490 |
|
} |
491 |
3 |
return someDone; |
492 |
|
} |
493 |
|
|
|
|
| 70% |
Uncovered Elements: 3 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
494 |
3 |
public static boolean importPaeJSONAsContactMatrixToStructure(... |
495 |
|
StructureMapping sm, InputStream paeInput, String label) |
496 |
|
throws IOException, ParseException |
497 |
|
{ |
498 |
3 |
JSONObject pae_obj = parseJSONtoPAEContactMatrix(paeInput); |
499 |
3 |
if (pae_obj == null) |
500 |
|
{ |
501 |
0 |
Console.debug("JSON file did not parse properly."); |
502 |
0 |
return false; |
503 |
|
} |
504 |
|
|
505 |
3 |
SequenceI seq = sm.getSequence(); |
506 |
3 |
ContactMatrixI matrix = new PAEContactMatrix(seq, |
507 |
|
(Map<String, Object>) pae_obj); |
508 |
3 |
AlignmentAnnotation cmannot = sm.getSequence().addContactList(matrix); |
509 |
|
|
510 |
|
|
511 |
|
|
512 |
3 |
return true; |
513 |
|
} |
514 |
|
|
515 |
|
|
516 |
|
|
517 |
|
|
518 |
|
|
519 |
|
@param |
520 |
|
@param |
521 |
|
@param |
522 |
|
@param |
523 |
|
@param |
524 |
|
@param |
525 |
|
@return |
526 |
|
@throws |
527 |
|
|
|
|
| 0% |
Uncovered Elements: 47 (47) |
Complexity: 15 |
Complexity Density: 0.48 |
|
528 |
0 |
public static AlignmentI importDownloadedStructureFromUrl(... |
529 |
|
String alphaFoldCif, File tmpFile, String id, String chain, |
530 |
|
String dbSource, String dbVersion) throws Exception |
531 |
|
{ |
532 |
0 |
String file = tmpFile.getAbsolutePath(); |
533 |
|
|
534 |
0 |
FileFormatI fileFormat = FileFormat.MMCif; |
535 |
0 |
TFType tempfacType = TFType.PLDDT; |
536 |
0 |
AlignmentI pdbAlignment = new FormatAdapter().readFile(tmpFile, file, |
537 |
|
DataSourceType.FILE, fileFormat, tempfacType); |
538 |
|
|
539 |
0 |
if (pdbAlignment != null) |
540 |
|
{ |
541 |
0 |
List<SequenceI> toremove = new ArrayList<SequenceI>(); |
542 |
0 |
for (SequenceI pdbcs : pdbAlignment.getSequences()) |
543 |
|
{ |
544 |
0 |
String chid = null; |
545 |
|
|
546 |
0 |
for (PDBEntry pid : pdbcs.getAllPDBEntries()) |
547 |
|
{ |
548 |
0 |
if (pid.getFile() == file) |
549 |
|
{ |
550 |
0 |
chid = pid.getChainCode(); |
551 |
|
} |
552 |
|
} |
553 |
0 |
if (chain == null || (chid != null && (chid.equals(chain) |
554 |
|
|| chid.trim().equals(chain.trim()) |
555 |
|
|| (chain.trim().length() == 0 && chid.equals("_"))))) |
556 |
|
{ |
557 |
|
|
558 |
|
|
559 |
0 |
pdbcs.setName(id + SEPARATOR + pdbcs.getName()); |
560 |
|
|
561 |
|
|
562 |
|
|
563 |
|
|
564 |
|
|
565 |
|
|
566 |
|
|
567 |
|
|
568 |
|
|
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
|
573 |
|
|
574 |
|
|
575 |
|
|
576 |
0 |
if (dbSource != null) |
577 |
|
{ |
578 |
0 |
DBRefEntry dbentry = new DBRefEntry(dbSource, |
579 |
|
|
580 |
0 |
dbVersion, (chid == null ? id : id + chid)); |
581 |
|
|
582 |
0 |
pdbcs.addDBRef(dbentry); |
583 |
|
|
584 |
0 |
List<SequenceFeature> allsf = pdbcs.getFeatures() |
585 |
|
.getAllFeatures(); |
586 |
0 |
List<SequenceFeature> newsf = new ArrayList<SequenceFeature>(); |
587 |
0 |
if (allsf != null && allsf.size() > 0) |
588 |
|
{ |
589 |
0 |
for (SequenceFeature f : allsf) |
590 |
|
{ |
591 |
0 |
if (file.equals(f.getFeatureGroup())) |
592 |
|
{ |
593 |
0 |
f = new SequenceFeature(f, f.type, f.begin, f.end, id, |
594 |
|
f.score); |
595 |
|
} |
596 |
0 |
newsf.add(f); |
597 |
|
} |
598 |
0 |
pdbcs.setSequenceFeatures(newsf); |
599 |
|
} |
600 |
|
} |
601 |
|
} |
602 |
|
else |
603 |
|
{ |
604 |
|
|
605 |
|
|
606 |
0 |
toremove.add(pdbcs); |
607 |
|
} |
608 |
|
} |
609 |
|
|
610 |
0 |
for (SequenceI pdbcs : toremove) |
611 |
|
{ |
612 |
0 |
pdbAlignment.deleteSequence(pdbcs); |
613 |
0 |
if (pdbcs.getAnnotation() != null) |
614 |
|
{ |
615 |
0 |
for (AlignmentAnnotation aa : pdbcs.getAnnotation()) |
616 |
|
{ |
617 |
0 |
pdbAlignment.deleteAnnotation(aa); |
618 |
|
} |
619 |
|
} |
620 |
|
} |
621 |
|
} |
622 |
0 |
return pdbAlignment; |
623 |
|
} |
624 |
|
|
625 |
|
|
626 |
|
|
627 |
|
|
628 |
|
@see |
629 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
630 |
0 |
@Override... |
631 |
|
public boolean isValidReference(String accession) |
632 |
|
{ |
633 |
0 |
Regex r = getAccessionValidator(); |
634 |
0 |
return r.search(accession.trim()); |
635 |
|
} |
636 |
|
|
637 |
|
|
638 |
|
|
639 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
640 |
0 |
@Override... |
641 |
|
public String getTestQuery() |
642 |
|
{ |
643 |
0 |
return "AF-O15552-F1"; |
644 |
|
} |
645 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
646 |
0 |
@Override... |
647 |
|
public String getDbName() |
648 |
|
{ |
649 |
0 |
return "ALPHAFOLD"; |
650 |
|
} |
651 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
652 |
0 |
@Override... |
653 |
|
public int getTier() |
654 |
|
{ |
655 |
0 |
return 0; |
656 |
|
} |
657 |
|
|
658 |
|
|
659 |
|
|
660 |
|
|
661 |
|
|
662 |
|
|
663 |
|
|
664 |
|
|
665 |
|
|
666 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
667 |
0 |
@Override... |
668 |
|
public FeatureSettingsModelI getFeatureColourScheme() |
669 |
|
{ |
670 |
0 |
return new PDBFeatureSettings(); |
671 |
|
} |
672 |
|
|
673 |
|
|
674 |
|
private static final long PAE_CACHE_STALE_TIME = 1 * 86400000; |
675 |
|
|
676 |
|
private static Map<String, File> paeDownloadCache = new HashMap<>(); |
677 |
|
|
678 |
|
} |