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.8% |
Uncovered Elements: 116 (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 |
264 |
public PDBChain(String thePdbid, String theId,... |
89 |
|
AnnotationRowBuilder template) |
90 |
|
{ |
91 |
264 |
this(thePdbid, theId); |
92 |
264 |
if (template != null) |
93 |
|
{ |
94 |
34 |
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 |
311 |
public PDBChain(String thePdbid, String theId)... |
106 |
|
{ |
107 |
311 |
this.pdbid = thePdbid == null ? thePdbid |
108 |
|
: thePdbid.toLowerCase(Locale.ROOT); |
109 |
311 |
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 |
188 |
public void makeExactMapping(AlignSeq as, SequenceI s1)... |
151 |
|
{ |
152 |
188 |
int pdbpos = as.getSeq2Start() - 2; |
153 |
188 |
int alignpos = s1.getStart() + as.getSeq1Start() - 3; |
154 |
|
|
155 |
188 |
for (Atom atom : atoms) |
156 |
|
{ |
157 |
20634 |
atom.alignmentMapping = -1; |
158 |
|
} |
159 |
|
|
160 |
20815 |
for (int i = 0; i < as.astr1.length(); i++) |
161 |
|
{ |
162 |
20627 |
if (as.astr1.charAt(i) != '-') |
163 |
|
{ |
164 |
20627 |
alignpos++; |
165 |
|
} |
166 |
|
|
167 |
20627 |
if (as.astr2.charAt(i) != '-') |
168 |
|
{ |
169 |
20627 |
pdbpos++; |
170 |
|
} |
171 |
|
|
172 |
20627 |
boolean sameResidue = Comparison.isSameResidue(as.astr1.charAt(i), |
173 |
|
as.astr2.charAt(i), false); |
174 |
20627 |
if (sameResidue) |
175 |
|
{ |
176 |
20585 |
if (pdbpos >= residues.size()) |
177 |
|
{ |
178 |
0 |
continue; |
179 |
|
} |
180 |
20585 |
Residue res = residues.elementAt(pdbpos); |
181 |
20585 |
for (Atom atom : res.atoms) |
182 |
|
{ |
183 |
20588 |
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 |
187 |
public void transferRESNUMFeatures(SequenceI seq, String status,... |
280 |
|
String altPDBID) |
281 |
|
{ |
282 |
187 |
if (altPDBID == null) |
283 |
|
{ |
284 |
0 |
altPDBID = pdbid; |
285 |
|
} |
286 |
187 |
SequenceI sq = seq; |
287 |
372 |
while (sq != null && sq.getDatasetSequence() != null) |
288 |
|
{ |
289 |
185 |
sq = sq.getDatasetSequence(); |
290 |
185 |
if (sq == sequence) |
291 |
|
{ |
292 |
0 |
return; |
293 |
|
} |
294 |
|
} |
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
|
302 |
187 |
if (status == null) |
303 |
|
{ |
304 |
187 |
status = PDBChain.IEASTATUS; |
305 |
|
} |
306 |
|
|
307 |
187 |
List<SequenceFeature> features = sequence.getSequenceFeatures(); |
308 |
187 |
for (SequenceFeature feature : features) |
309 |
|
{ |
310 |
20628 |
if (feature.getFeatureGroup() != null |
311 |
|
&& feature.getFeatureGroup().equals(pdbid)) |
312 |
|
{ |
313 |
20628 |
int newBegin = 1 |
314 |
|
+ residues.elementAt(feature.getBegin() - offset).atoms |
315 |
|
.elementAt(0).alignmentMapping; |
316 |
20628 |
int newEnd = 1 + residues.elementAt(feature.getEnd() - offset).atoms |
317 |
|
.elementAt(0).alignmentMapping; |
318 |
20628 |
SequenceFeature tx = new SequenceFeature(feature, newBegin, newEnd, |
319 |
|
altPDBID, feature.getScore()); |
320 |
20628 |
tx.setStatus(status |
321 |
20628 |
+ ((tx.getStatus() == null || tx.getStatus().length() == 0) |
322 |
|
? "" |
323 |
|
: ":" + tx.getStatus())); |
324 |
20628 |
if (tx.begin != 0 && tx.end != 0) |
325 |
|
{ |
326 |
20582 |
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 |
301 |
public void makeCaBondList()... |
338 |
|
{ |
339 |
301 |
boolean na = false; |
340 |
301 |
int numNa = 0; |
341 |
47760 |
for (int i = 0; i < (residues.size() - 1); i++) |
342 |
|
{ |
343 |
47459 |
Residue tmpres = residues.elementAt(i); |
344 |
47459 |
Residue tmpres2 = residues.elementAt(i + 1); |
345 |
47459 |
Atom at1 = tmpres.findAtom("CA"); |
346 |
47459 |
Atom at2 = tmpres2.findAtom("CA"); |
347 |
47459 |
na = false; |
348 |
47459 |
if ((at1 == null) && (at2 == null)) |
349 |
|
{ |
350 |
2 |
na = true; |
351 |
2 |
at1 = tmpres.findAtom("P"); |
352 |
2 |
at2 = tmpres2.findAtom("P"); |
353 |
|
} |
354 |
47459 |
if ((at1 != null) && (at2 != null)) |
355 |
|
{ |
356 |
47459 |
if (at1.chain.equals(at2.chain)) |
357 |
|
{ |
358 |
47459 |
if (na) |
359 |
|
{ |
360 |
2 |
numNa++; |
361 |
|
} |
362 |
47459 |
makeBond(at1, at2); |
363 |
|
} |
364 |
|
} |
365 |
|
else |
366 |
|
{ |
367 |
0 |
System.out.println("not found " + i); |
368 |
|
} |
369 |
|
} |
370 |
|
|
371 |
|
|
372 |
|
|
373 |
|
|
374 |
|
|
375 |
301 |
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 |
47469 |
public void makeBond(Atom at1, Atom at2)... |
389 |
|
{ |
390 |
47469 |
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 |
304 |
public void makeResidueList(boolean visibleChainAnnotation)... |
408 |
|
{ |
409 |
304 |
int count = 0; |
410 |
304 |
Object symbol; |
411 |
304 |
boolean deoxyn = false; |
412 |
304 |
boolean nucleotide = false; |
413 |
304 |
StringBuilder seq = new StringBuilder(256); |
414 |
304 |
Vector<SequenceFeature> resFeatures = new Vector<>(); |
415 |
304 |
Vector<Annotation> resAnnotation = new Vector<>(); |
416 |
304 |
int iSize = atoms.size() - 1; |
417 |
304 |
int resNumber = -1; |
418 |
304 |
char insCode = ' '; |
419 |
|
|
420 |
48073 |
for (int i = 0; i <= iSize; i++) |
421 |
|
{ |
422 |
47769 |
Atom tmp = atoms.elementAt(i); |
423 |
47769 |
resNumber = tmp.resNumber; |
424 |
47769 |
insCode = tmp.insCode; |
425 |
|
|
426 |
47769 |
int res = resNumber; |
427 |
47769 |
char ins = insCode; |
428 |
|
|
429 |
47769 |
if (i == 0) |
430 |
|
{ |
431 |
304 |
offset = resNumber; |
432 |
|
} |
433 |
|
|
434 |
47769 |
Vector<Atom> resAtoms = new Vector<>(); |
435 |
|
|
436 |
|
|
437 |
95559 |
while ((resNumber == res) && (ins == insCode) && (i < atoms.size())) |
438 |
|
{ |
439 |
47790 |
resAtoms.add(atoms.elementAt(i)); |
440 |
47790 |
i++; |
441 |
|
|
442 |
47790 |
if (i < atoms.size()) |
443 |
|
{ |
444 |
47486 |
resNumber = atoms.elementAt(i).resNumber; |
445 |
47486 |
insCode = atoms.elementAt(i).insCode; |
446 |
|
} |
447 |
|
else |
448 |
|
{ |
449 |
304 |
resNumber++; |
450 |
|
} |
451 |
|
} |
452 |
|
|
453 |
|
|
454 |
47769 |
i--; |
455 |
|
|
456 |
|
|
457 |
47769 |
Atom currAtom = resAtoms.get(0); |
458 |
47769 |
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 |
47769 |
residues.addElement(new Residue(resAtoms, resNumber - 1, count)); |
473 |
|
|
474 |
47769 |
Residue tmpres = residues.lastElement(); |
475 |
47769 |
Atom tmpat = tmpres.atoms.get(0); |
476 |
|
|
477 |
47769 |
String desc = tmpat.resName + ":" + tmpat.resNumIns + " " + pdbid |
478 |
|
+ id; |
479 |
47769 |
SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, desc, |
480 |
|
offset + count, offset + count, pdbid); |
481 |
47769 |
resFeatures.addElement(sf); |
482 |
47769 |
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 |
47762 |
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 |
47762 |
seq.append(ResidueProperties.aa[((Integer) symbol).intValue()]); |
519 |
|
} |
520 |
47769 |
count++; |
521 |
|
} |
522 |
|
} |
523 |
|
|
524 |
304 |
if (id.length() < 1) |
525 |
|
{ |
526 |
0 |
id = " "; |
527 |
|
} |
528 |
304 |
isNa = nucleotide; |
529 |
304 |
sequence = new Sequence(id, seq.toString(), offset, resNumber - 1); |
530 |
|
|
531 |
|
|
532 |
|
|
533 |
|
|
534 |
|
|
535 |
|
|
536 |
|
|
537 |
|
|
538 |
|
|
539 |
304 |
if (StructureImportSettings.isShowSeqFeatures()) |
540 |
|
{ |
541 |
290 |
iSize = resFeatures.size(); |
542 |
44707 |
for (int i = 0; i < iSize; i++) |
543 |
|
{ |
544 |
44417 |
sequence.addSequenceFeature(resFeatures.elementAt(i)); |
545 |
44417 |
resFeatures.setElementAt(null, i); |
546 |
|
} |
547 |
|
} |
548 |
304 |
if (visibleChainAnnotation) |
549 |
|
{ |
550 |
219 |
Annotation[] annots = new Annotation[resAnnotation.size()]; |
551 |
219 |
float max = 0f; |
552 |
219 |
float min = 0f; |
553 |
219 |
iSize = annots.length; |
554 |
34034 |
for (int i = 0; i < iSize; i++) |
555 |
|
{ |
556 |
33815 |
annots[i] = resAnnotation.elementAt(i); |
557 |
33815 |
tfacTemplate.processAnnotation(annots[i]); |
558 |
33815 |
max = Math.max(max, annots[i].value); |
559 |
33815 |
min = Math.min(min, annots[i].value); |
560 |
33815 |
resAnnotation.setElementAt(null, i); |
561 |
|
} |
562 |
219 |
if (tfacTemplate.isHasMinMax()) |
563 |
|
{ |
564 |
27 |
max = tfacTemplate.getMax(); |
565 |
27 |
min = tfacTemplate.getMin(); |
566 |
|
} |
567 |
|
|
568 |
219 |
AlignmentAnnotation tfactorann = new AlignmentAnnotation( |
569 |
|
tfacTemplate.getName(), |
570 |
219 |
(tfacTemplate.isHasDescription() |
571 |
|
? tfacTemplate.getDescription() |
572 |
|
: tfacTemplate.getName()) + " for " + pdbid + id, |
573 |
|
annots, min, max, AlignmentAnnotation.LINE_GRAPH); |
574 |
219 |
tfactorann.setTFType(tfacTemplate.getTFType()); |
575 |
219 |
tfactorann.setCalcId(getClass().getName()); |
576 |
|
|
577 |
219 |
tfactorann.setSequenceRef(sequence); |
578 |
219 |
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 |
|
|
|
|
| 42.9% |
Uncovered Elements: 40 (70) |
Complexity: 19 |
Complexity Density: 0.43 |
|
674 |
187 |
public void transferResidueAnnotation(StructureMapping mapping,... |
675 |
|
jalview.datamodel.Mapping sqmpping) |
676 |
|
{ |
677 |
187 |
SequenceI sq = mapping.getSequence(); |
678 |
187 |
SequenceI dsq = sq; |
679 |
187 |
if (sqmpping == null) |
680 |
|
{ |
681 |
|
|
682 |
|
|
683 |
0 |
sqmpping = mapping.getSeqToPdbMapping(); |
684 |
|
} |
685 |
187 |
if (sq != null) |
686 |
|
{ |
687 |
372 |
while (dsq.getDatasetSequence() != null) |
688 |
|
{ |
689 |
185 |
dsq = dsq.getDatasetSequence(); |
690 |
|
} |
691 |
|
|
692 |
|
|
693 |
187 |
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 |
187 |
if (sequence != null && sequence.getAnnotation() != null) |
724 |
|
{ |
725 |
164 |
for (AlignmentAnnotation ana : sequence.getAnnotation()) |
726 |
|
{ |
727 |
|
|
728 |
|
|
729 |
340 |
List<AlignmentAnnotation> transfer = dsq |
730 |
|
.getAlignmentAnnotations(ana.getCalcId(), ana.label, |
731 |
|
ana.description); |
732 |
340 |
if (transfer == null || transfer.size() == 0) |
733 |
|
{ |
734 |
194 |
ContactMatrixI cm = sequence.getContactMatrixFor(ana); |
735 |
194 |
ana = new AlignmentAnnotation(ana); |
736 |
194 |
ana.liftOver(dsq, sqmpping); |
737 |
194 |
dsq.addAlignmentAnnotation(ana); |
738 |
194 |
if (cm != null && cm instanceof MappableContactMatrixI) |
739 |
|
{ |
740 |
36 |
dsq.addContactListFor(ana, ((MappableContactMatrixI) cm) |
741 |
|
.liftOver(dsq, sqmpping)); |
742 |
|
} |
743 |
|
} |
744 |
|
else |
745 |
|
{ |
746 |
146 |
continue; |
747 |
|
} |
748 |
|
} |
749 |
|
} |
750 |
|
} |
751 |
187 |
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 |
|
} |