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 |
|
|
|
|
| 20.4% |
Uncovered Elements: 43 (54) |
Complexity: 18 |
Complexity Density: 0.53 |
|
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 |
|
@param |
47 |
|
@return |
48 |
|
|
49 |
|
|
50 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 9 |
Complexity Density: 0.47 |
|
51 |
0 |
public static AtomSpec fromChimeraAtomspec(String spec)... |
52 |
|
{ |
53 |
0 |
int colonPos = spec.indexOf(":"); |
54 |
0 |
if (colonPos == -1) |
55 |
|
{ |
56 |
0 |
throw new IllegalArgumentException(spec); |
57 |
|
} |
58 |
|
|
59 |
0 |
int hashPos = spec.indexOf("#"); |
60 |
0 |
if (hashPos == -1 && colonPos != 0) |
61 |
|
{ |
62 |
|
|
63 |
0 |
throw new IllegalArgumentException(spec); |
64 |
|
} |
65 |
|
|
66 |
0 |
String modelSubmodel = spec.substring(hashPos + 1, colonPos); |
67 |
0 |
int dotPos = modelSubmodel.indexOf("."); |
68 |
0 |
int modelId = 0; |
69 |
0 |
try |
70 |
|
{ |
71 |
0 |
modelId = Integer.valueOf(dotPos == -1 ? modelSubmodel |
72 |
|
: modelSubmodel.substring(0, dotPos)); |
73 |
|
} catch (NumberFormatException e) |
74 |
|
{ |
75 |
|
|
76 |
|
} |
77 |
|
|
78 |
0 |
String residueChain = spec.substring(colonPos + 1); |
79 |
0 |
dotPos = residueChain.indexOf("."); |
80 |
0 |
int resNum = 0; |
81 |
0 |
try |
82 |
|
{ |
83 |
0 |
resNum = Integer.parseInt(dotPos == -1 ? residueChain |
84 |
|
: residueChain.substring(0, dotPos)); |
85 |
|
} catch (NumberFormatException e) |
86 |
|
{ |
87 |
|
|
88 |
0 |
throw new IllegalArgumentException(spec); |
89 |
|
} |
90 |
|
|
91 |
0 |
String chainId = dotPos == -1 ? "" : residueChain.substring(dotPos + 1); |
92 |
|
|
93 |
0 |
return new AtomSpec(modelId, chainId, resNum, 0); |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
@param |
100 |
|
@param |
101 |
|
@param |
102 |
|
@param |
103 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
104 |
1 |
public AtomSpec(String pdbFile, String chain, int resNo, int atomNo)... |
105 |
|
{ |
106 |
1 |
this.pdbFile = pdbFile; |
107 |
1 |
this.chain = chain; |
108 |
1 |
this.pdbResNum = resNo; |
109 |
1 |
this.atomIndex = atomNo; |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
@param |
116 |
|
@param |
117 |
|
@param |
118 |
|
@param |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
120 |
0 |
public AtomSpec(int modelId, String chainId, int resNo, int atomNo)... |
121 |
|
{ |
122 |
0 |
this.modelNo = modelId; |
123 |
0 |
this.chain = chainId; |
124 |
0 |
this.pdbResNum = resNo; |
125 |
0 |
this.atomIndex = atomNo; |
126 |
|
} |
127 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
128 |
2 |
public String getPdbFile()... |
129 |
|
{ |
130 |
2 |
return pdbFile; |
131 |
|
} |
132 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
133 |
1 |
public String getChain()... |
134 |
|
{ |
135 |
1 |
return chain; |
136 |
|
} |
137 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
138 |
1 |
public int getPdbResNum()... |
139 |
|
{ |
140 |
1 |
return pdbResNum; |
141 |
|
} |
142 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
143 |
0 |
public int getAtomIndex()... |
144 |
|
{ |
145 |
0 |
return atomIndex; |
146 |
|
} |
147 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
148 |
0 |
public int getModelNumber()... |
149 |
|
{ |
150 |
0 |
return modelNo; |
151 |
|
} |
152 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
153 |
0 |
public void setPdbFile(String file)... |
154 |
|
{ |
155 |
0 |
pdbFile = file; |
156 |
|
} |
157 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
158 |
0 |
@Override... |
159 |
|
public String toString() |
160 |
|
{ |
161 |
0 |
return "pdbFile: " + pdbFile + ", chain: " + chain + ", res: " |
162 |
|
+ pdbResNum + ", atom: " + atomIndex; |
163 |
|
} |
164 |
|
} |