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 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
@author |
28 |
|
|
29 |
|
|
|
|
| 12.8% |
Uncovered Elements: 75 (86) |
Complexity: 27 |
Complexity Density: 0.49 |
|
30 |
|
public class AtomSpec |
31 |
|
{ |
32 |
|
int modelNo; |
33 |
|
|
34 |
|
private String pdbFile; |
35 |
|
|
36 |
|
private String chain; |
37 |
|
|
38 |
|
private int pdbResNum; |
39 |
|
|
40 |
|
private int atomIndex; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@param |
52 |
|
@return |
53 |
|
|
54 |
|
|
55 |
|
@see |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 9 |
Complexity Density: 0.45 |
|
57 |
0 |
public static AtomSpec fromChimeraAtomspec(String spec)... |
58 |
|
{ |
59 |
0 |
int modelSeparatorPos = spec.indexOf(":"); |
60 |
0 |
if (modelSeparatorPos == -1) |
61 |
|
{ |
62 |
0 |
throw new IllegalArgumentException(spec); |
63 |
|
} |
64 |
|
|
65 |
0 |
int hashPos = spec.indexOf("#"); |
66 |
0 |
if (hashPos == -1 && modelSeparatorPos != 0) |
67 |
|
{ |
68 |
|
|
69 |
0 |
throw new IllegalArgumentException(spec); |
70 |
|
} |
71 |
|
|
72 |
0 |
String modelSubmodel = spec.substring(hashPos + 1, modelSeparatorPos); |
73 |
0 |
int modelId = 0; |
74 |
0 |
try |
75 |
|
{ |
76 |
0 |
int subModelPos = modelSubmodel.indexOf("."); |
77 |
0 |
modelId = Integer.valueOf( |
78 |
0 |
subModelPos > 0 ? modelSubmodel.substring(0, subModelPos) |
79 |
|
: modelSubmodel); |
80 |
|
} catch (NumberFormatException e) |
81 |
|
{ |
82 |
|
|
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
0 |
String atomsAndChain = spec.substring(modelSeparatorPos + 1); |
91 |
0 |
String[] tokens = atomsAndChain.split("\\."); |
92 |
0 |
String atoms = tokens.length == 1 ? atomsAndChain : (tokens[0]); |
93 |
0 |
int resNum = 0; |
94 |
0 |
try |
95 |
|
{ |
96 |
0 |
resNum = Integer.parseInt(atoms); |
97 |
|
} catch (NumberFormatException e) |
98 |
|
{ |
99 |
|
|
100 |
0 |
throw new IllegalArgumentException(spec); |
101 |
|
} |
102 |
|
|
103 |
0 |
String chainId = tokens.length == 1 ? "" : (tokens[1]); |
104 |
|
|
105 |
0 |
return new AtomSpec(modelId, chainId, resNum, 0); |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
@param |
112 |
|
@param |
113 |
|
@param |
114 |
|
@param |
115 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
116 |
1 |
public AtomSpec(String pdbFile, String chain, int resNo, int atomNo)... |
117 |
|
{ |
118 |
1 |
this.pdbFile = pdbFile; |
119 |
1 |
this.chain = chain; |
120 |
1 |
this.pdbResNum = resNo; |
121 |
1 |
this.atomIndex = atomNo; |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
@param |
128 |
|
@param |
129 |
|
@param |
130 |
|
@param |
131 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
132 |
0 |
public AtomSpec(int modelId, String chainId, int resNo, int atomNo)... |
133 |
|
{ |
134 |
0 |
this.modelNo = modelId; |
135 |
0 |
this.chain = chainId; |
136 |
0 |
this.pdbResNum = resNo; |
137 |
0 |
this.atomIndex = atomNo; |
138 |
|
} |
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
140 |
2 |
public String getPdbFile()... |
141 |
|
{ |
142 |
2 |
return pdbFile; |
143 |
|
} |
144 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
145 |
1 |
public String getChain()... |
146 |
|
{ |
147 |
1 |
return chain; |
148 |
|
} |
149 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
1 |
public int getPdbResNum()... |
151 |
|
{ |
152 |
1 |
return pdbResNum; |
153 |
|
} |
154 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
155 |
0 |
public int getAtomIndex()... |
156 |
|
{ |
157 |
0 |
return atomIndex; |
158 |
|
} |
159 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
160 |
0 |
public int getModelNumber()... |
161 |
|
{ |
162 |
0 |
return modelNo; |
163 |
|
} |
164 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
165 |
0 |
public void setPdbFile(String file)... |
166 |
|
{ |
167 |
0 |
pdbFile = file; |
168 |
|
} |
169 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
170 |
0 |
@Override... |
171 |
|
public String toString() |
172 |
|
{ |
173 |
0 |
return "pdbFile: " + pdbFile + ", chain: " + chain + ", res: " |
174 |
|
+ pdbResNum + ", atom: " + atomIndex; |
175 |
|
} |
176 |
|
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
@param |
187 |
|
@return |
188 |
|
|
189 |
|
|
190 |
|
@see |
191 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 9 |
Complexity Density: 0.45 |
|
192 |
0 |
public static AtomSpec fromChimeraXAtomspec(String spec)... |
193 |
|
{ |
194 |
0 |
int modelSeparatorPos = spec.indexOf("/"); |
195 |
0 |
if (modelSeparatorPos == -1) |
196 |
|
{ |
197 |
0 |
throw new IllegalArgumentException(spec); |
198 |
|
} |
199 |
|
|
200 |
0 |
int hashPos = spec.indexOf("#"); |
201 |
0 |
if (hashPos == -1 && modelSeparatorPos != 0) |
202 |
|
{ |
203 |
|
|
204 |
0 |
throw new IllegalArgumentException(spec); |
205 |
|
} |
206 |
|
|
207 |
0 |
String modelSubmodel = spec.substring(hashPos + 1, modelSeparatorPos); |
208 |
0 |
int modelId = 0; |
209 |
0 |
try |
210 |
|
{ |
211 |
0 |
int subModelPos = modelSubmodel.indexOf("."); |
212 |
0 |
modelId = Integer.valueOf( |
213 |
0 |
subModelPos > 0 ? modelSubmodel.substring(0, subModelPos) |
214 |
|
: modelSubmodel); |
215 |
|
} catch (NumberFormatException e) |
216 |
|
{ |
217 |
|
|
218 |
|
} |
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
0 |
String atomsAndChain = spec.substring(modelSeparatorPos + 1); |
226 |
0 |
String[] tokens = atomsAndChain.split("\\:"); |
227 |
0 |
String atoms = tokens.length == 1 ? atomsAndChain : (tokens[1]); |
228 |
0 |
int resNum = 0; |
229 |
0 |
try |
230 |
|
{ |
231 |
0 |
resNum = Integer.parseInt(atoms); |
232 |
|
} catch (NumberFormatException e) |
233 |
|
{ |
234 |
|
|
235 |
0 |
throw new IllegalArgumentException(spec); |
236 |
|
} |
237 |
|
|
238 |
0 |
String chainId = tokens.length == 1 ? "" : (tokens[0]); |
239 |
|
|
240 |
0 |
return new AtomSpec(modelId, chainId, resNum, 0); |
241 |
|
} |
242 |
|
} |