1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.structure; |
22 |
|
|
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.HashSet; |
25 |
|
import java.util.List; |
26 |
|
import java.util.Set; |
27 |
|
import java.util.regex.Matcher; |
28 |
|
import java.util.regex.Pattern; |
29 |
|
|
30 |
|
import jalview.datamodel.PDBEntry; |
31 |
|
import jalview.datamodel.SequenceI; |
32 |
|
import jalview.io.StructureFile; |
33 |
|
import mc_view.PDBChain; |
34 |
|
|
|
|
| 89% |
Uncovered Elements: 8 (73) |
Complexity: 17 |
Complexity Density: 0.39 |
|
35 |
|
public class PDBEntryUtils |
36 |
|
{ |
37 |
|
|
|
|
| 86.7% |
Uncovered Elements: 2 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
38 |
29 |
public static String inferChainId(SequenceI seq)... |
39 |
|
{ |
40 |
29 |
String targetChainId; |
41 |
29 |
if (seq.getName().indexOf("|") > -1) |
42 |
|
{ |
43 |
14 |
targetChainId = seq.getName() |
44 |
|
.substring(seq.getName().lastIndexOf("|") + 1); |
45 |
14 |
if (targetChainId.length() > 1) |
46 |
|
{ |
47 |
1 |
if (targetChainId.trim().length() == 0) |
48 |
|
{ |
49 |
0 |
targetChainId = " "; |
50 |
|
} |
51 |
|
else |
52 |
|
{ |
53 |
|
|
54 |
1 |
targetChainId = ""; |
55 |
|
} |
56 |
|
} |
57 |
|
} |
58 |
|
else |
59 |
|
{ |
60 |
15 |
targetChainId = ""; |
61 |
|
} |
62 |
29 |
return targetChainId; |
63 |
|
} |
64 |
|
protected static Pattern id_and_chain=Pattern.compile("(\\d[0-9A-Za-z]{3})[_:|]?([0-9A-Za-z]{1,2})?.*"); |
65 |
|
|
|
|
| 92.3% |
Uncovered Elements: 1 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
66 |
75 |
public static List<PDBEntry> inferPDBEntry(SequenceI seq)... |
67 |
|
{ |
68 |
75 |
Matcher matcher = id_and_chain.matcher(seq.getName()); |
69 |
|
|
70 |
75 |
if (matcher.matches()) |
71 |
|
{ |
72 |
49 |
String id = matcher.group(1); |
73 |
49 |
PDBEntry pdbe = new PDBEntry(); |
74 |
49 |
pdbe.setId(id); |
75 |
49 |
if (matcher.groupCount() > 1) |
76 |
|
{ |
77 |
49 |
pdbe.setChainCode(matcher.group(2)); |
78 |
|
} |
79 |
|
|
80 |
49 |
return List.of(pdbe); |
81 |
|
} |
82 |
26 |
return List.of(); |
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
@param |
89 |
|
@param |
90 |
|
@param |
91 |
|
@return |
92 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
93 |
32 |
public static List<PDBEntry> selectPutativePDBe(SequenceI seq,... |
94 |
|
SequenceI ds, StructureFile pdb) |
95 |
|
{ |
96 |
32 |
List<PDBEntry> putativePDBe = new ArrayList<PDBEntry>(); |
97 |
32 |
Set<PDBEntry> possiblePDBe=PDBEntryUtils.gatherPDBEntries(seq,true); |
98 |
32 |
for (PDBEntry infPDBe: possiblePDBe) |
99 |
|
{ |
100 |
52 |
if (infPDBe.getId().equalsIgnoreCase(pdb.getId())) |
101 |
|
{ |
102 |
52 |
putativePDBe.add(infPDBe); |
103 |
|
} |
104 |
|
} |
105 |
32 |
return putativePDBe; |
106 |
|
} |
107 |
|
|
108 |
|
|
|
|
| 85.7% |
Uncovered Elements: 2 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
109 |
38 |
public static Set<PDBEntry> gatherPDBEntries(SequenceI seq,boolean inferFromName)... |
110 |
|
{ |
111 |
38 |
Set<PDBEntry> possiblePDBe=new HashSet<PDBEntry>(); |
112 |
112 |
while (seq!=null) |
113 |
|
{ |
114 |
74 |
if (seq.getAllPDBEntries()!=null) { |
115 |
74 |
possiblePDBe.addAll(seq.getAllPDBEntries()); |
116 |
|
} |
117 |
74 |
if (inferFromName) |
118 |
|
{ |
119 |
74 |
possiblePDBe.addAll(PDBEntryUtils.inferPDBEntry(seq)); |
120 |
|
} |
121 |
74 |
seq = seq.getDatasetSequence(); |
122 |
|
} |
123 |
38 |
return possiblePDBe; |
124 |
|
} |
125 |
|
|
126 |
|
|
|
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
127 |
44 |
public static PDBEntry selectPutativePDBEntry(List<PDBEntry> putativePDBe,... |
128 |
|
PDBChain chain) |
129 |
|
{ |
130 |
44 |
if (putativePDBe.isEmpty()) |
131 |
|
{ |
132 |
0 |
return null; |
133 |
|
} |
134 |
|
|
135 |
|
|
136 |
44 |
PDBEntry putativeEntry = null; |
137 |
44 |
boolean hasChainCodes; |
138 |
|
|
139 |
44 |
for (PDBEntry pdbe : putativePDBe) |
140 |
|
{ |
141 |
64 |
if (pdbe.getChainCode() != null) |
142 |
|
{ |
143 |
56 |
hasChainCodes = true; |
144 |
56 |
if (pdbe.getChainCode().equals(chain.id)) |
145 |
|
{ |
146 |
17 |
putativeEntry = pdbe; |
147 |
17 |
return putativeEntry; |
148 |
|
} |
149 |
|
} else { |
150 |
8 |
return pdbe; |
151 |
|
} |
152 |
|
} |
153 |
19 |
return null; |
154 |
|
} |
155 |
|
} |