1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package mc_view; |
22 |
|
|
23 |
|
import java.awt.Color; |
24 |
|
import java.util.List; |
25 |
|
import java.util.Locale; |
26 |
|
import java.util.Vector; |
27 |
|
|
28 |
|
import jalview.analysis.AlignSeq; |
29 |
|
import jalview.datamodel.AlignmentAnnotation; |
30 |
|
import jalview.datamodel.Annotation; |
31 |
|
import jalview.datamodel.ContactMatrixI; |
32 |
|
import jalview.datamodel.Mapping; |
33 |
|
import jalview.datamodel.Sequence; |
34 |
|
import jalview.datamodel.SequenceFeature; |
35 |
|
import jalview.datamodel.SequenceI; |
36 |
|
import jalview.datamodel.annotations.AnnotationRowBuilder; |
37 |
|
import jalview.schemes.ColourSchemeI; |
38 |
|
import jalview.schemes.ResidueProperties; |
39 |
|
import jalview.structure.StructureImportSettings; |
40 |
|
import jalview.structure.StructureMapping; |
41 |
|
import jalview.util.Comparison; |
42 |
|
import jalview.ws.datamodel.MappableContactMatrixI; |
43 |
|
|
|
|
| 69.5% |
Uncovered Elements: 117 (384) |
Complexity: 99 |
Complexity Density: 0.4 |
|
44 |
|
public class PDBChain |
45 |
|
{ |
46 |
|
public static final String RESNUM_FEATURE = "RESNUM"; |
47 |
|
|
48 |
|
private static final String IEASTATUS = "IEA:jalview"; |
49 |
|
|
50 |
|
public String id; |
51 |
|
|
52 |
|
public Vector<Bond> bonds = new Vector<>(); |
53 |
|
|
54 |
|
public Vector<Atom> atoms = new Vector<>(); |
55 |
|
|
56 |
|
public Vector<Residue> residues = new Vector<>(); |
57 |
|
|
58 |
|
public int offset; |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
public SequenceI sequence; |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
public SequenceI shadow = null; |
70 |
|
|
71 |
|
public boolean isNa = false; |
72 |
|
|
73 |
|
public boolean isVisible = true; |
74 |
|
|
75 |
|
public int pdbstart = 0; |
76 |
|
|
77 |
|
public int pdbend = 0; |
78 |
|
|
79 |
|
public int seqstart = 0; |
80 |
|
|
81 |
|
public int seqend = 0; |
82 |
|
|
83 |
|
public String pdbid = ""; |
84 |
|
|
85 |
|
AnnotationRowBuilder tfacTemplate = new AnnotationRowBuilder( |
86 |
|
"Temperature Factor"); |
87 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
88 |
104 |
public PDBChain(String thePdbid, String theId,... |
89 |
|
AnnotationRowBuilder template) |
90 |
|
{ |
91 |
104 |
this(thePdbid, theId); |
92 |
104 |
if (template != null) |
93 |
|
{ |
94 |
6 |
tfacTemplate = template; |
95 |
|
} |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
@param |
103 |
|
@param |
104 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
105 |
148 |
public PDBChain(String thePdbid, String theId)... |
106 |
|
{ |
107 |
148 |
this.pdbid = thePdbid == null ? thePdbid |
108 |
|
: thePdbid.toLowerCase(Locale.ROOT); |
109 |
148 |
this.id = theId; |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
protected String newline = System.getProperty("line.separator"); |
116 |
|
|
117 |
|
public Mapping shadowMap; |
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
119 |
1 |
public void setNewlineString(String nl)... |
120 |
|
{ |
121 |
1 |
newline = nl; |
122 |
|
} |
123 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
124 |
2 |
public String getNewlineString()... |
125 |
|
{ |
126 |
2 |
return newline; |
127 |
|
} |
128 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
129 |
1 |
public String print()... |
130 |
|
{ |
131 |
1 |
StringBuilder tmp = new StringBuilder(256); |
132 |
|
|
133 |
1 |
for (Bond b : bonds) |
134 |
|
{ |
135 |
3 |
tmp.append(b.at1.resName).append(" ").append(b.at1.resNumber) |
136 |
|
.append(" ").append(offset).append(newline); |
137 |
|
} |
138 |
|
|
139 |
1 |
return tmp.toString(); |
140 |
|
} |
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
@param |
148 |
|
@param |
149 |
|
|
|
|
| 84.6% |
Uncovered Elements: 4 (26) |
Complexity: 6 |
Complexity Density: 0.38 |
|
150 |
33 |
public void makeExactMapping(AlignSeq as, SequenceI s1)... |
151 |
|
{ |
152 |
33 |
int pdbpos = as.getSeq2Start() - 2; |
153 |
33 |
int alignpos = s1.getStart() + as.getSeq1Start() - 3; |
154 |
|
|
155 |
33 |
for (Atom atom : atoms) |
156 |
|
{ |
157 |
3487 |
atom.alignmentMapping = -1; |
158 |
|
} |
159 |
|
|
160 |
3517 |
for (int i = 0; i < as.astr1.length(); i++) |
161 |
|
{ |
162 |
3484 |
if (as.astr1.charAt(i) != '-') |
163 |
|
{ |
164 |
3484 |
alignpos++; |
165 |
|
} |
166 |
|
|
167 |
3484 |
if (as.astr2.charAt(i) != '-') |
168 |
|
{ |
169 |
3484 |
pdbpos++; |
170 |
|
} |
171 |
|
|
172 |
3484 |
boolean sameResidue = Comparison.isSameResidue(as.astr1.charAt(i), |
173 |
|
as.astr2.charAt(i), false); |
174 |
3484 |
if (sameResidue) |
175 |
|
{ |
176 |
3483 |
if (pdbpos >= residues.size()) |
177 |
|
{ |
178 |
0 |
continue; |
179 |
|
} |
180 |
3483 |
Residue res = residues.elementAt(pdbpos); |
181 |
3483 |
for (Atom atom : res.atoms) |
182 |
|
{ |
183 |
3486 |
atom.alignmentMapping = alignpos; |
184 |
|
} |
185 |
|
} |
186 |
|
} |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
@param |
193 |
|
@param |
194 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
195 |
0 |
public void mapChainWith(Mapping sqmpping, SequenceI seq)... |
196 |
|
{ |
197 |
0 |
for (Atom atom : atoms) |
198 |
|
{ |
199 |
0 |
atom.alignmentMapping = -1; |
200 |
|
} |
201 |
|
|
202 |
0 |
int[] range = sqmpping.locateRange(seq.getStart(), seq.getEnd()); |
203 |
0 |
int r = 0, from, to; |
204 |
0 |
while (r < range.length) |
205 |
|
{ |
206 |
0 |
from = range[r++]; |
207 |
0 |
to = range[r++]; |
208 |
0 |
for (int pdbpos = from; pdbpos <= to; pdbpos++) |
209 |
|
{ |
210 |
0 |
if (pdbpos >= residues.size()) |
211 |
|
{ |
212 |
0 |
continue; |
213 |
|
} |
214 |
0 |
Residue res = residues.elementAt(pdbpos); |
215 |
0 |
for (Atom atom : res.atoms) |
216 |
|
{ |
217 |
0 |
atom.alignmentMapping = sqmpping.getPosition(pdbpos); |
218 |
|
} |
219 |
|
} |
220 |
|
} |
221 |
|
} |
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
@param |
229 |
|
@param |
230 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 4 |
Complexity Density: 0.25 |
|
231 |
0 |
public void makeExactMapping(StructureMapping mapping, SequenceI s1)... |
232 |
|
{ |
233 |
|
|
234 |
0 |
for (Atom atom : atoms) |
235 |
|
{ |
236 |
0 |
atom.alignmentMapping = -1; |
237 |
|
} |
238 |
0 |
SequenceI ds = s1; |
239 |
0 |
while (ds.getDatasetSequence() != null) |
240 |
|
{ |
241 |
0 |
ds = ds.getDatasetSequence(); |
242 |
|
} |
243 |
0 |
int pdboffset = 0; |
244 |
0 |
for (Residue res : residues) |
245 |
|
{ |
246 |
|
|
247 |
0 |
int seqpos = mapping.getSeqPos(res.atoms.get(0).resNumber); |
248 |
0 |
char strchar = sequence.getCharAt(pdboffset++); |
249 |
0 |
if (seqpos == StructureMapping.UNASSIGNED_VALUE) |
250 |
|
{ |
251 |
0 |
continue; |
252 |
|
} |
253 |
0 |
char seqchar = ds.getCharAt(seqpos - ds.getStart()); |
254 |
|
|
255 |
0 |
boolean sameResidue = Comparison.isSameResidue(seqchar, strchar, |
256 |
|
false); |
257 |
0 |
if (sameResidue) |
258 |
|
{ |
259 |
0 |
for (Atom atom : res.atoms) |
260 |
|
{ |
261 |
0 |
atom.alignmentMapping = seqpos - 1; |
262 |
|
} |
263 |
|
} |
264 |
|
} |
265 |
|
} |
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
@param |
272 |
|
@param |
273 |
|
|
274 |
|
|
275 |
|
@param |
276 |
|
|
277 |
|
|
278 |
|
|
|
|
| 78.1% |
Uncovered Elements: 7 (32) |
Complexity: 12 |
Complexity Density: 0.67 |
|
279 |
32 |
public void transferRESNUMFeatures(SequenceI seq, String status,... |
280 |
|
String altPDBID) |
281 |
|
{ |
282 |
32 |
if (altPDBID == null) |
283 |
|
{ |
284 |
0 |
altPDBID = pdbid; |
285 |
|
} |
286 |
32 |
SequenceI sq = seq; |
287 |
62 |
while (sq != null && sq.getDatasetSequence() != null) |
288 |
|
{ |
289 |
30 |
sq = sq.getDatasetSequence(); |
290 |
30 |
if (sq == sequence) |
291 |
|
{ |
292 |
0 |
return; |
293 |
|
} |
294 |
|
} |
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
|
302 |
32 |
if (status == null) |
303 |
|
{ |
304 |
32 |
status = PDBChain.IEASTATUS; |
305 |
|
} |
306 |
|
|
307 |
32 |
List<SequenceFeature> features = sequence.getSequenceFeatures(); |
308 |
32 |
for (SequenceFeature feature : features) |
309 |
|
{ |
310 |
3481 |
if (feature.getFeatureGroup() != null |
311 |
|
&& feature.getFeatureGroup().equals(pdbid)) |
312 |
|
{ |
313 |
3481 |
int newBegin = 1 |
314 |
|
+ residues.elementAt(feature.getBegin() - offset).atoms |
315 |
|
.elementAt(0).alignmentMapping; |
316 |
3481 |
int newEnd = 1 + residues.elementAt(feature.getEnd() - offset).atoms |
317 |
|
.elementAt(0).alignmentMapping; |
318 |
3481 |
SequenceFeature tx = new SequenceFeature(feature, newBegin, newEnd, |
319 |
|
altPDBID, feature.getScore()); |
320 |
3481 |
tx.setStatus(status |
321 |
3481 |
+ ((tx.getStatus() == null || tx.getStatus().length() == 0) |
322 |
|
? "" |
323 |
|
: ":" + tx.getStatus())); |
324 |
3481 |
if (tx.begin != 0 && tx.end != 0) |
325 |
|
{ |
326 |
3480 |
sq.addSequenceFeature(tx); |
327 |
|
} |
328 |
|
} |
329 |
|
} |
330 |
|
} |
331 |
|
|
332 |
|
|
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
|
|
|
| 90.6% |
Uncovered Elements: 3 (32) |
Complexity: 10 |
Complexity Density: 0.5 |
|
337 |
138 |
public void makeCaBondList()... |
338 |
|
{ |
339 |
138 |
boolean na = false; |
340 |
138 |
int numNa = 0; |
341 |
25853 |
for (int i = 0; i < (residues.size() - 1); i++) |
342 |
|
{ |
343 |
25715 |
Residue tmpres = residues.elementAt(i); |
344 |
25715 |
Residue tmpres2 = residues.elementAt(i + 1); |
345 |
25715 |
Atom at1 = tmpres.findAtom("CA"); |
346 |
25715 |
Atom at2 = tmpres2.findAtom("CA"); |
347 |
25715 |
na = false; |
348 |
25715 |
if ((at1 == null) && (at2 == null)) |
349 |
|
{ |
350 |
2 |
na = true; |
351 |
2 |
at1 = tmpres.findAtom("P"); |
352 |
2 |
at2 = tmpres2.findAtom("P"); |
353 |
|
} |
354 |
25715 |
if ((at1 != null) && (at2 != null)) |
355 |
|
{ |
356 |
25715 |
if (at1.chain.equals(at2.chain)) |
357 |
|
{ |
358 |
25715 |
if (na) |
359 |
|
{ |
360 |
2 |
numNa++; |
361 |
|
} |
362 |
25715 |
makeBond(at1, at2); |
363 |
|
} |
364 |
|
} |
365 |
|
else |
366 |
|
{ |
367 |
0 |
System.out.println("not found " + i); |
368 |
|
} |
369 |
|
} |
370 |
|
|
371 |
|
|
372 |
|
|
373 |
|
|
374 |
|
|
375 |
138 |
if (residues.size() > 1 && (numNa / (residues.size() - 1) > 0.99)) |
376 |
|
{ |
377 |
1 |
isNa = true; |
378 |
|
} |
379 |
|
} |
380 |
|
|
381 |
|
|
382 |
|
|
383 |
|
|
384 |
|
|
385 |
|
@param |
386 |
|
@param |
387 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
388 |
25725 |
public void makeBond(Atom at1, Atom at2)... |
389 |
|
{ |
390 |
25725 |
bonds.addElement(new Bond(at1, at2)); |
391 |
|
} |
392 |
|
|
393 |
|
|
394 |
|
|
395 |
|
|
396 |
|
|
397 |
|
|
398 |
|
|
399 |
|
|
400 |
|
|
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
|
@param |
406 |
|
|
|
|
| 87.1% |
Uncovered Elements: 15 (116) |
Complexity: 24 |
Complexity Density: 0.3 |
|
407 |
141 |
public void makeResidueList(boolean visibleChainAnnotation)... |
408 |
|
{ |
409 |
141 |
int count = 0; |
410 |
141 |
Object symbol; |
411 |
141 |
boolean deoxyn = false; |
412 |
141 |
boolean nucleotide = false; |
413 |
141 |
StringBuilder seq = new StringBuilder(256); |
414 |
141 |
Vector<SequenceFeature> resFeatures = new Vector<>(); |
415 |
141 |
Vector<Annotation> resAnnotation = new Vector<>(); |
416 |
141 |
int iSize = atoms.size() - 1; |
417 |
141 |
int resNumber = -1; |
418 |
141 |
char insCode = ' '; |
419 |
|
|
420 |
26003 |
for (int i = 0; i <= iSize; i++) |
421 |
|
{ |
422 |
25862 |
Atom tmp = atoms.elementAt(i); |
423 |
25862 |
resNumber = tmp.resNumber; |
424 |
25862 |
insCode = tmp.insCode; |
425 |
|
|
426 |
25862 |
int res = resNumber; |
427 |
25862 |
char ins = insCode; |
428 |
|
|
429 |
25862 |
if (i == 0) |
430 |
|
{ |
431 |
141 |
offset = resNumber; |
432 |
|
} |
433 |
|
|
434 |
25862 |
Vector<Atom> resAtoms = new Vector<>(); |
435 |
|
|
436 |
|
|
437 |
51745 |
while ((resNumber == res) && (ins == insCode) && (i < atoms.size())) |
438 |
|
{ |
439 |
25883 |
resAtoms.add(atoms.elementAt(i)); |
440 |
25883 |
i++; |
441 |
|
|
442 |
25883 |
if (i < atoms.size()) |
443 |
|
{ |
444 |
25742 |
resNumber = atoms.elementAt(i).resNumber; |
445 |
25742 |
insCode = atoms.elementAt(i).insCode; |
446 |
|
} |
447 |
|
else |
448 |
|
{ |
449 |
141 |
resNumber++; |
450 |
|
} |
451 |
|
} |
452 |
|
|
453 |
|
|
454 |
25862 |
i--; |
455 |
|
|
456 |
|
|
457 |
25862 |
Atom currAtom = resAtoms.get(0); |
458 |
25862 |
if (currAtom.insCode != ' ' && !residues.isEmpty() |
459 |
|
&& residues.lastElement().atoms |
460 |
|
.get(0).resNumber == currAtom.resNumber) |
461 |
|
{ |
462 |
0 |
String desc = currAtom.resName + ":" + currAtom.resNumIns + " " |
463 |
|
+ pdbid + id; |
464 |
0 |
SequenceFeature sf = new SequenceFeature("INSERTION", desc, |
465 |
|
offset + count - 1, offset + count - 1, "PDB_INS"); |
466 |
0 |
resFeatures.addElement(sf); |
467 |
0 |
residues.lastElement().atoms.addAll(resAtoms); |
468 |
|
} |
469 |
|
else |
470 |
|
{ |
471 |
|
|
472 |
25862 |
residues.addElement(new Residue(resAtoms, resNumber - 1, count)); |
473 |
|
|
474 |
25862 |
Residue tmpres = residues.lastElement(); |
475 |
25862 |
Atom tmpat = tmpres.atoms.get(0); |
476 |
|
|
477 |
25862 |
String desc = tmpat.resName + ":" + tmpat.resNumIns + " " + pdbid |
478 |
|
+ id; |
479 |
25862 |
SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, desc, |
480 |
|
offset + count, offset + count, pdbid); |
481 |
25862 |
resFeatures.addElement(sf); |
482 |
25862 |
resAnnotation.addElement(new Annotation(tmpat.tfactor)); |
483 |
|
|
484 |
|
|
485 |
? |
if ((symbol = ResidueProperties.getAA3Hash() |
486 |
|
.get(tmpat.resName)) == null) |
487 |
|
{ |
488 |
7 |
String nucname = tmpat.resName.trim(); |
489 |
|
|
490 |
|
|
491 |
7 |
deoxyn = nucname.length() == 2 |
492 |
|
&& ResidueProperties.aaIndex[nucname |
493 |
|
.charAt(0)] == ResidueProperties.aaIndex['D']; |
494 |
7 |
if (tmpat.name.equalsIgnoreCase("CA") |
495 |
|
|| ResidueProperties.nucleotideIndex[nucname |
496 |
3 |
.charAt((deoxyn ? 1 : 0))] == -1) |
497 |
|
{ |
498 |
4 |
char r = ResidueProperties.getSingleCharacterCode( |
499 |
|
ResidueProperties.getCanonicalAminoAcid(tmpat.resName)); |
500 |
4 |
seq.append(r == '0' ? 'X' : r); |
501 |
|
|
502 |
|
|
503 |
|
} |
504 |
|
else |
505 |
|
{ |
506 |
|
|
507 |
3 |
nucleotide = true; |
508 |
3 |
seq.append(nucname.charAt((deoxyn ? 1 : 0))); |
509 |
|
} |
510 |
|
} |
511 |
|
else |
512 |
|
{ |
513 |
25855 |
if (nucleotide) |
514 |
|
{ |
515 |
0 |
System.err.println( |
516 |
|
"Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!"); |
517 |
|
} |
518 |
25855 |
seq.append(ResidueProperties.aa[((Integer) symbol).intValue()]); |
519 |
|
} |
520 |
25862 |
count++; |
521 |
|
} |
522 |
|
} |
523 |
|
|
524 |
141 |
if (id.length() < 1) |
525 |
|
{ |
526 |
0 |
id = " "; |
527 |
|
} |
528 |
141 |
isNa = nucleotide; |
529 |
141 |
sequence = new Sequence(id, seq.toString(), offset, resNumber - 1); |
530 |
|
|
531 |
|
|
532 |
|
|
533 |
|
|
534 |
|
|
535 |
|
|
536 |
|
|
537 |
|
|
538 |
|
|
539 |
141 |
if (StructureImportSettings.isShowSeqFeatures()) |
540 |
|
{ |
541 |
127 |
iSize = resFeatures.size(); |
542 |
22637 |
for (int i = 0; i < iSize; i++) |
543 |
|
{ |
544 |
22510 |
sequence.addSequenceFeature(resFeatures.elementAt(i)); |
545 |
22510 |
resFeatures.setElementAt(null, i); |
546 |
|
} |
547 |
|
} |
548 |
141 |
if (visibleChainAnnotation) |
549 |
|
{ |
550 |
89 |
Annotation[] annots = new Annotation[resAnnotation.size()]; |
551 |
89 |
float max = 0f; |
552 |
89 |
float min = 0f; |
553 |
89 |
iSize = annots.length; |
554 |
15554 |
for (int i = 0; i < iSize; i++) |
555 |
|
{ |
556 |
15465 |
annots[i] = resAnnotation.elementAt(i); |
557 |
15465 |
tfacTemplate.processAnnotation(annots[i]); |
558 |
15465 |
max = Math.max(max, annots[i].value); |
559 |
15465 |
min = Math.min(min, annots[i].value); |
560 |
15465 |
resAnnotation.setElementAt(null, i); |
561 |
|
} |
562 |
89 |
if (tfacTemplate.isHasMinMax()) |
563 |
|
{ |
564 |
6 |
max = tfacTemplate.getMax(); |
565 |
6 |
min = tfacTemplate.getMin(); |
566 |
|
} |
567 |
|
|
568 |
89 |
AlignmentAnnotation tfactorann = new AlignmentAnnotation( |
569 |
|
tfacTemplate.getName(), |
570 |
89 |
(tfacTemplate.isHasDescription() |
571 |
|
? tfacTemplate.getDescription() |
572 |
|
: tfacTemplate.getName()) + " for " + pdbid + id, |
573 |
|
annots, min, max, AlignmentAnnotation.LINE_GRAPH); |
574 |
89 |
tfactorann.setTFType(tfacTemplate.getTFType()); |
575 |
89 |
tfactorann.setCalcId(getClass().getName()); |
576 |
|
|
577 |
89 |
tfactorann.setSequenceRef(sequence); |
578 |
89 |
sequence.addAlignmentAnnotation(tfactorann); |
579 |
|
} |
580 |
|
} |
581 |
|
|
582 |
|
|
583 |
|
|
584 |
|
|
585 |
|
|
586 |
|
|
587 |
|
|
588 |
|
|
589 |
|
|
590 |
|
|
|
|
| 62.5% |
Uncovered Elements: 3 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
591 |
1 |
public void setChargeColours()... |
592 |
|
{ |
593 |
1 |
for (Bond b : bonds) |
594 |
|
{ |
595 |
3 |
if (b.at1 != null && b.at2 != null) |
596 |
|
{ |
597 |
3 |
b.startCol = getChargeColour(b.at1.resName); |
598 |
3 |
b.endCol = getChargeColour(b.at2.resName); |
599 |
|
} |
600 |
|
else |
601 |
|
{ |
602 |
0 |
b.startCol = Color.gray; |
603 |
0 |
b.endCol = Color.gray; |
604 |
|
} |
605 |
|
} |
606 |
|
} |
607 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 6 |
Complexity Density: 0.75 |
|
608 |
13 |
public static Color getChargeColour(String resName)... |
609 |
|
{ |
610 |
13 |
Color result = Color.lightGray; |
611 |
13 |
if ("ASP".equals(resName) || "GLU".equals(resName)) |
612 |
|
{ |
613 |
3 |
result = Color.red; |
614 |
|
} |
615 |
10 |
else if ("LYS".equals(resName) || "ARG".equals(resName)) |
616 |
|
{ |
617 |
4 |
result = Color.blue; |
618 |
|
} |
619 |
6 |
else if ("CYS".equals(resName)) |
620 |
|
{ |
621 |
3 |
result = Color.yellow; |
622 |
|
} |
623 |
13 |
return result; |
624 |
|
} |
625 |
|
|
626 |
|
|
627 |
|
|
628 |
|
|
629 |
|
|
630 |
|
|
631 |
|
@param |
632 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.22 |
|
633 |
1 |
public void setChainColours(ColourSchemeI cs)... |
634 |
|
{ |
635 |
1 |
int index; |
636 |
1 |
for (Bond b : bonds) |
637 |
|
{ |
638 |
3 |
try |
639 |
|
{ |
640 |
3 |
index = ResidueProperties.aa3Hash.get(b.at1.resName).intValue(); |
641 |
3 |
b.startCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0, |
642 |
|
null, null, 0f); |
643 |
|
|
644 |
3 |
index = ResidueProperties.aa3Hash.get(b.at2.resName).intValue(); |
645 |
2 |
b.endCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0, |
646 |
|
null, null, 0f); |
647 |
|
|
648 |
|
} catch (Exception e) |
649 |
|
{ |
650 |
1 |
b.startCol = Color.gray; |
651 |
1 |
b.endCol = Color.gray; |
652 |
|
} |
653 |
|
} |
654 |
|
} |
655 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
656 |
1 |
public void setChainColours(Color col)... |
657 |
|
{ |
658 |
1 |
for (Bond b : bonds) |
659 |
|
{ |
660 |
2 |
b.startCol = col; |
661 |
2 |
b.endCol = col; |
662 |
|
} |
663 |
|
} |
664 |
|
|
665 |
|
|
666 |
|
|
667 |
|
|
668 |
|
|
669 |
|
@param |
670 |
|
|
671 |
|
@param |
672 |
|
|
673 |
|
|
|
|
| 41.4% |
Uncovered Elements: 41 (70) |
Complexity: 19 |
Complexity Density: 0.43 |
|
674 |
32 |
public void transferResidueAnnotation(StructureMapping mapping,... |
675 |
|
jalview.datamodel.Mapping sqmpping) |
676 |
|
{ |
677 |
32 |
SequenceI sq = mapping.getSequence(); |
678 |
32 |
SequenceI dsq = sq; |
679 |
32 |
if (sqmpping == null) |
680 |
|
{ |
681 |
|
|
682 |
|
|
683 |
0 |
sqmpping = mapping.getSeqToPdbMapping(); |
684 |
|
} |
685 |
32 |
if (sq != null) |
686 |
|
{ |
687 |
62 |
while (dsq.getDatasetSequence() != null) |
688 |
|
{ |
689 |
30 |
dsq = dsq.getDatasetSequence(); |
690 |
|
} |
691 |
|
|
692 |
|
|
693 |
32 |
if (shadow != null && shadow.getAnnotation() != null) |
694 |
|
{ |
695 |
|
|
696 |
0 |
for (AlignmentAnnotation ana : shadow.getAnnotation()) |
697 |
|
{ |
698 |
|
|
699 |
|
|
700 |
0 |
List<AlignmentAnnotation> transfer = sq.getAlignmentAnnotations( |
701 |
|
ana.getCalcId(), ana.label, ana.description); |
702 |
0 |
if (transfer == null || transfer.size() == 0) |
703 |
|
{ |
704 |
0 |
ContactMatrixI cm = shadow.getContactMatrixFor(ana); |
705 |
0 |
ana = new AlignmentAnnotation(ana); |
706 |
|
|
707 |
0 |
ana.liftOver(sequence, shadowMap); |
708 |
0 |
ana.liftOver(dsq, sqmpping); |
709 |
0 |
dsq.addAlignmentAnnotation(ana); |
710 |
0 |
if (cm != null) |
711 |
|
{ |
712 |
0 |
dsq.addContactListFor(ana, cm); |
713 |
|
} |
714 |
|
} |
715 |
|
else |
716 |
|
{ |
717 |
0 |
continue; |
718 |
|
} |
719 |
|
} |
720 |
|
} |
721 |
|
else |
722 |
|
{ |
723 |
32 |
if (sequence != null && sequence.getAnnotation() != null) |
724 |
|
{ |
725 |
32 |
for (AlignmentAnnotation ana : sequence.getAnnotation()) |
726 |
|
{ |
727 |
|
|
728 |
|
|
729 |
54 |
List<AlignmentAnnotation> transfer = dsq |
730 |
|
.getAlignmentAnnotations(ana.getCalcId(), ana.label, |
731 |
|
ana.description); |
732 |
54 |
if (transfer == null || transfer.size() == 0) |
733 |
|
{ |
734 |
46 |
ContactMatrixI cm = sequence.getContactMatrixFor(ana); |
735 |
46 |
ana = new AlignmentAnnotation(ana); |
736 |
46 |
ana.liftOver(dsq, sqmpping); |
737 |
46 |
dsq.addAlignmentAnnotation(ana); |
738 |
46 |
if (cm != null && cm instanceof MappableContactMatrixI) |
739 |
|
{ |
740 |
6 |
dsq.addContactListFor(ana, ((MappableContactMatrixI) cm) |
741 |
|
.liftOver(dsq, sqmpping)); |
742 |
|
} |
743 |
|
} |
744 |
|
else |
745 |
|
{ |
746 |
8 |
continue; |
747 |
|
} |
748 |
|
} |
749 |
|
} |
750 |
|
} |
751 |
32 |
if (false) |
752 |
|
{ |
753 |
|
|
754 |
0 |
float min = -1, max = 0; |
755 |
0 |
Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1]; |
756 |
0 |
for (int i = sq.getStart(), j = sq.getEnd(), |
757 |
0 |
k = 0; i <= j; i++, k++) |
758 |
|
{ |
759 |
0 |
int prn = mapping.getPDBResNum(k + 1); |
760 |
|
|
761 |
0 |
an[k] = new Annotation(prn); |
762 |
0 |
if (min == -1) |
763 |
|
{ |
764 |
0 |
min = k; |
765 |
0 |
max = k; |
766 |
|
} |
767 |
|
else |
768 |
|
{ |
769 |
0 |
if (min > k) |
770 |
|
{ |
771 |
0 |
min = k; |
772 |
|
} |
773 |
0 |
else if (max < k) |
774 |
|
{ |
775 |
0 |
max = k; |
776 |
|
} |
777 |
|
} |
778 |
|
} |
779 |
0 |
sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM", |
780 |
|
"PDB Residue Numbering for " + this.pdbid + ":" + this.id, |
781 |
|
an, min, max, AlignmentAnnotation.LINE_GRAPH)); |
782 |
|
} |
783 |
|
} |
784 |
|
} |
785 |
|
} |