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 |
|
|
|
|
| 73.6% |
Uncovered Elements: 96 (364) |
Complexity: 95 |
Complexity Density: 0.41 |
|
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 |
267 |
public PDBChain(String thePdbid, String theId,... |
89 |
|
AnnotationRowBuilder template) |
90 |
|
{ |
91 |
267 |
this(thePdbid, theId); |
92 |
267 |
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 |
314 |
public PDBChain(String thePdbid, String theId)... |
106 |
|
{ |
107 |
314 |
this.pdbid = thePdbid == null ? thePdbid |
108 |
|
: thePdbid.toLowerCase(Locale.ROOT); |
109 |
314 |
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 |
194 |
public void makeExactMapping(AlignSeq as, SequenceI s1)... |
151 |
|
{ |
152 |
194 |
int pdbpos = as.getSeq2Start() - 2; |
153 |
194 |
int alignpos = s1.getStart() + as.getSeq1Start() - 3; |
154 |
|
|
155 |
194 |
for (Atom atom : atoms) |
156 |
|
{ |
157 |
21216 |
atom.alignmentMapping = -1; |
158 |
|
} |
159 |
|
|
160 |
21403 |
for (int i = 0; i < as.astr1.length(); i++) |
161 |
|
{ |
162 |
21209 |
if (as.astr1.charAt(i) != '-') |
163 |
|
{ |
164 |
21209 |
alignpos++; |
165 |
|
} |
166 |
|
|
167 |
21209 |
if (as.astr2.charAt(i) != '-') |
168 |
|
{ |
169 |
21209 |
pdbpos++; |
170 |
|
} |
171 |
|
|
172 |
21209 |
boolean sameResidue = Comparison.isSameResidue(as.astr1.charAt(i), |
173 |
|
as.astr2.charAt(i), false); |
174 |
21209 |
if (sameResidue) |
175 |
|
{ |
176 |
21164 |
if (pdbpos >= residues.size()) |
177 |
|
{ |
178 |
0 |
continue; |
179 |
|
} |
180 |
21164 |
Residue res = residues.elementAt(pdbpos); |
181 |
21164 |
for (Atom atom : res.atoms) |
182 |
|
{ |
183 |
21167 |
atom.alignmentMapping = alignpos; |
184 |
|
} |
185 |
|
} |
186 |
|
} |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
@param |
195 |
|
@param |
196 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 4 |
Complexity Density: 0.25 |
|
197 |
0 |
public void makeExactMapping(StructureMapping mapping, SequenceI s1)... |
198 |
|
{ |
199 |
|
|
200 |
0 |
for (Atom atom : atoms) |
201 |
|
{ |
202 |
0 |
atom.alignmentMapping = -1; |
203 |
|
} |
204 |
0 |
SequenceI ds = s1; |
205 |
0 |
while (ds.getDatasetSequence() != null) |
206 |
|
{ |
207 |
0 |
ds = ds.getDatasetSequence(); |
208 |
|
} |
209 |
0 |
int pdboffset = 0; |
210 |
0 |
for (Residue res : residues) |
211 |
|
{ |
212 |
|
|
213 |
0 |
int seqpos = mapping.getSeqPos(res.atoms.get(0).resNumber); |
214 |
0 |
char strchar = sequence.getCharAt(pdboffset++); |
215 |
0 |
if (seqpos == StructureMapping.UNASSIGNED_VALUE) |
216 |
|
{ |
217 |
0 |
continue; |
218 |
|
} |
219 |
0 |
char seqchar = ds.getCharAt(seqpos - ds.getStart()); |
220 |
|
|
221 |
0 |
boolean sameResidue = Comparison.isSameResidue(seqchar, strchar, |
222 |
|
false); |
223 |
0 |
if (sameResidue) |
224 |
|
{ |
225 |
0 |
for (Atom atom : res.atoms) |
226 |
|
{ |
227 |
0 |
atom.alignmentMapping = seqpos - 1; |
228 |
|
} |
229 |
|
} |
230 |
|
} |
231 |
|
} |
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
|
237 |
|
@param |
238 |
|
@param |
239 |
|
|
240 |
|
|
241 |
|
@param |
242 |
|
|
243 |
|
|
244 |
|
|
|
|
| 78.1% |
Uncovered Elements: 7 (32) |
Complexity: 12 |
Complexity Density: 0.67 |
|
245 |
193 |
public void transferRESNUMFeatures(SequenceI seq, String status,... |
246 |
|
String altPDBID) |
247 |
|
{ |
248 |
193 |
if (altPDBID == null) |
249 |
|
{ |
250 |
0 |
altPDBID = pdbid; |
251 |
|
} |
252 |
193 |
SequenceI sq = seq; |
253 |
384 |
while (sq != null && sq.getDatasetSequence() != null) |
254 |
|
{ |
255 |
191 |
sq = sq.getDatasetSequence(); |
256 |
191 |
if (sq == sequence) |
257 |
|
{ |
258 |
0 |
return; |
259 |
|
} |
260 |
|
} |
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
|
|
268 |
193 |
if (status == null) |
269 |
|
{ |
270 |
193 |
status = PDBChain.IEASTATUS; |
271 |
|
} |
272 |
|
|
273 |
193 |
List<SequenceFeature> features = sequence.getSequenceFeatures(); |
274 |
193 |
for (SequenceFeature feature : features) |
275 |
|
{ |
276 |
21210 |
if (feature.getFeatureGroup() != null |
277 |
|
&& feature.getFeatureGroup().equals(pdbid)) |
278 |
|
{ |
279 |
21210 |
int newBegin = 1 |
280 |
|
+ residues.elementAt(feature.getBegin() - offset).atoms |
281 |
|
.elementAt(0).alignmentMapping; |
282 |
21210 |
int newEnd = 1 + residues.elementAt(feature.getEnd() - offset).atoms |
283 |
|
.elementAt(0).alignmentMapping; |
284 |
21210 |
SequenceFeature tx = new SequenceFeature(feature, newBegin, newEnd, |
285 |
|
altPDBID, feature.getScore()); |
286 |
21210 |
tx.setStatus(status |
287 |
21210 |
+ ((tx.getStatus() == null || tx.getStatus().length() == 0) |
288 |
|
? "" |
289 |
|
: ":" + tx.getStatus())); |
290 |
21210 |
if (tx.begin != 0 && tx.end != 0) |
291 |
|
{ |
292 |
21161 |
sq.addSequenceFeature(tx); |
293 |
|
} |
294 |
|
} |
295 |
|
} |
296 |
|
} |
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
|
302 |
|
|
|
|
| 90.6% |
Uncovered Elements: 3 (32) |
Complexity: 10 |
Complexity Density: 0.5 |
|
303 |
304 |
public void makeCaBondList()... |
304 |
|
{ |
305 |
304 |
boolean na = false; |
306 |
304 |
int numNa = 0; |
307 |
48051 |
for (int i = 0; i < (residues.size() - 1); i++) |
308 |
|
{ |
309 |
47747 |
Residue tmpres = residues.elementAt(i); |
310 |
47747 |
Residue tmpres2 = residues.elementAt(i + 1); |
311 |
47747 |
Atom at1 = tmpres.findAtom("CA"); |
312 |
47747 |
Atom at2 = tmpres2.findAtom("CA"); |
313 |
47747 |
na = false; |
314 |
47747 |
if ((at1 == null) && (at2 == null)) |
315 |
|
{ |
316 |
2 |
na = true; |
317 |
2 |
at1 = tmpres.findAtom("P"); |
318 |
2 |
at2 = tmpres2.findAtom("P"); |
319 |
|
} |
320 |
47747 |
if ((at1 != null) && (at2 != null)) |
321 |
|
{ |
322 |
47747 |
if (at1.chain.equals(at2.chain)) |
323 |
|
{ |
324 |
47747 |
if (na) |
325 |
|
{ |
326 |
2 |
numNa++; |
327 |
|
} |
328 |
47747 |
makeBond(at1, at2); |
329 |
|
} |
330 |
|
} |
331 |
|
else |
332 |
|
{ |
333 |
0 |
System.out.println("not found " + i); |
334 |
|
} |
335 |
|
} |
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
|
340 |
|
|
341 |
304 |
if (residues.size() > 1 && (numNa / (residues.size() - 1) > 0.99)) |
342 |
|
{ |
343 |
1 |
isNa = true; |
344 |
|
} |
345 |
|
} |
346 |
|
|
347 |
|
|
348 |
|
|
349 |
|
|
350 |
|
|
351 |
|
@param |
352 |
|
@param |
353 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
354 |
47757 |
public void makeBond(Atom at1, Atom at2)... |
355 |
|
{ |
356 |
47757 |
bonds.addElement(new Bond(at1, at2)); |
357 |
|
} |
358 |
|
|
359 |
|
|
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
|
|
369 |
|
|
370 |
|
|
371 |
|
@param |
372 |
|
|
|
|
| 87.1% |
Uncovered Elements: 15 (116) |
Complexity: 24 |
Complexity Density: 0.3 |
|
373 |
307 |
public void makeResidueList(boolean visibleChainAnnotation)... |
374 |
|
{ |
375 |
307 |
int count = 0; |
376 |
307 |
Object symbol; |
377 |
307 |
boolean deoxyn = false; |
378 |
307 |
boolean nucleotide = false; |
379 |
307 |
StringBuilder seq = new StringBuilder(256); |
380 |
307 |
Vector<SequenceFeature> resFeatures = new Vector<>(); |
381 |
307 |
Vector<Annotation> resAnnotation = new Vector<>(); |
382 |
307 |
int iSize = atoms.size() - 1; |
383 |
307 |
int resNumber = -1; |
384 |
307 |
char insCode = ' '; |
385 |
|
|
386 |
48367 |
for (int i = 0; i <= iSize; i++) |
387 |
|
{ |
388 |
48060 |
Atom tmp = atoms.elementAt(i); |
389 |
48060 |
resNumber = tmp.resNumber; |
390 |
48060 |
insCode = tmp.insCode; |
391 |
|
|
392 |
48060 |
int res = resNumber; |
393 |
48060 |
char ins = insCode; |
394 |
|
|
395 |
48060 |
if (i == 0) |
396 |
|
{ |
397 |
307 |
offset = resNumber; |
398 |
|
} |
399 |
|
|
400 |
48060 |
Vector<Atom> resAtoms = new Vector<>(); |
401 |
|
|
402 |
|
|
403 |
96141 |
while ((resNumber == res) && (ins == insCode) && (i < atoms.size())) |
404 |
|
{ |
405 |
48081 |
resAtoms.add(atoms.elementAt(i)); |
406 |
48081 |
i++; |
407 |
|
|
408 |
48081 |
if (i < atoms.size()) |
409 |
|
{ |
410 |
47774 |
resNumber = atoms.elementAt(i).resNumber; |
411 |
47774 |
insCode = atoms.elementAt(i).insCode; |
412 |
|
} |
413 |
|
else |
414 |
|
{ |
415 |
307 |
resNumber++; |
416 |
|
} |
417 |
|
} |
418 |
|
|
419 |
|
|
420 |
48060 |
i--; |
421 |
|
|
422 |
|
|
423 |
48060 |
Atom currAtom = resAtoms.get(0); |
424 |
48060 |
if (currAtom.insCode != ' ' && !residues.isEmpty() |
425 |
|
&& residues.lastElement().atoms |
426 |
|
.get(0).resNumber == currAtom.resNumber) |
427 |
|
{ |
428 |
0 |
String desc = currAtom.resName + ":" + currAtom.resNumIns + " " |
429 |
|
+ pdbid + id; |
430 |
0 |
SequenceFeature sf = new SequenceFeature("INSERTION", desc, |
431 |
|
offset + count - 1, offset + count - 1, "PDB_INS"); |
432 |
0 |
resFeatures.addElement(sf); |
433 |
0 |
residues.lastElement().atoms.addAll(resAtoms); |
434 |
|
} |
435 |
|
else |
436 |
|
{ |
437 |
|
|
438 |
48060 |
residues.addElement(new Residue(resAtoms, resNumber - 1, count)); |
439 |
|
|
440 |
48060 |
Residue tmpres = residues.lastElement(); |
441 |
48060 |
Atom tmpat = tmpres.atoms.get(0); |
442 |
|
|
443 |
48060 |
String desc = tmpat.resName + ":" + tmpat.resNumIns + " " + pdbid |
444 |
|
+ id; |
445 |
48060 |
SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, desc, |
446 |
|
offset + count, offset + count, pdbid); |
447 |
48060 |
resFeatures.addElement(sf); |
448 |
48060 |
resAnnotation.addElement(new Annotation(tmpat.tfactor)); |
449 |
|
|
450 |
|
|
451 |
? |
if ((symbol = ResidueProperties.getAA3Hash() |
452 |
|
.get(tmpat.resName)) == null) |
453 |
|
{ |
454 |
7 |
String nucname = tmpat.resName.trim(); |
455 |
|
|
456 |
|
|
457 |
7 |
deoxyn = nucname.length() == 2 |
458 |
|
&& ResidueProperties.aaIndex[nucname |
459 |
|
.charAt(0)] == ResidueProperties.aaIndex['D']; |
460 |
7 |
if (tmpat.name.equalsIgnoreCase("CA") |
461 |
|
|| ResidueProperties.nucleotideIndex[nucname |
462 |
3 |
.charAt((deoxyn ? 1 : 0))] == -1) |
463 |
|
{ |
464 |
4 |
char r = ResidueProperties.getSingleCharacterCode( |
465 |
|
ResidueProperties.getCanonicalAminoAcid(tmpat.resName)); |
466 |
4 |
seq.append(r == '0' ? 'X' : r); |
467 |
|
|
468 |
|
|
469 |
|
} |
470 |
|
else |
471 |
|
{ |
472 |
|
|
473 |
3 |
nucleotide = true; |
474 |
3 |
seq.append(nucname.charAt((deoxyn ? 1 : 0))); |
475 |
|
} |
476 |
|
} |
477 |
|
else |
478 |
|
{ |
479 |
48053 |
if (nucleotide) |
480 |
|
{ |
481 |
0 |
System.err.println( |
482 |
|
"Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!"); |
483 |
|
} |
484 |
48053 |
seq.append(ResidueProperties.aa[((Integer) symbol).intValue()]); |
485 |
|
} |
486 |
48060 |
count++; |
487 |
|
} |
488 |
|
} |
489 |
|
|
490 |
307 |
if (id.length() < 1) |
491 |
|
{ |
492 |
0 |
id = " "; |
493 |
|
} |
494 |
307 |
isNa = nucleotide; |
495 |
307 |
sequence = new Sequence(id, seq.toString(), offset, resNumber - 1); |
496 |
|
|
497 |
|
|
498 |
|
|
499 |
|
|
500 |
|
|
501 |
|
|
502 |
|
|
503 |
|
|
504 |
|
|
505 |
307 |
if (StructureImportSettings.isShowSeqFeatures()) |
506 |
|
{ |
507 |
293 |
iSize = resFeatures.size(); |
508 |
45001 |
for (int i = 0; i < iSize; i++) |
509 |
|
{ |
510 |
44708 |
sequence.addSequenceFeature(resFeatures.elementAt(i)); |
511 |
44708 |
resFeatures.setElementAt(null, i); |
512 |
|
} |
513 |
|
} |
514 |
307 |
if (visibleChainAnnotation) |
515 |
|
{ |
516 |
203 |
Annotation[] annots = new Annotation[resAnnotation.size()]; |
517 |
203 |
float max = 0f; |
518 |
203 |
float min = 0f; |
519 |
203 |
iSize = annots.length; |
520 |
33539 |
for (int i = 0; i < iSize; i++) |
521 |
|
{ |
522 |
33336 |
annots[i] = resAnnotation.elementAt(i); |
523 |
33336 |
tfacTemplate.processAnnotation(annots[i]); |
524 |
33336 |
max = Math.max(max, annots[i].value); |
525 |
33336 |
min = Math.min(min, annots[i].value); |
526 |
33336 |
resAnnotation.setElementAt(null, i); |
527 |
|
} |
528 |
203 |
if (tfacTemplate.isHasMinMax()) |
529 |
|
{ |
530 |
27 |
max = tfacTemplate.getMax(); |
531 |
27 |
min = tfacTemplate.getMin(); |
532 |
|
} |
533 |
|
|
534 |
203 |
AlignmentAnnotation tfactorann = new AlignmentAnnotation( |
535 |
|
tfacTemplate.getName(), |
536 |
203 |
(tfacTemplate.isHasDescription() |
537 |
|
? tfacTemplate.getDescription() |
538 |
|
: tfacTemplate.getName()) + " for " + pdbid + id, |
539 |
|
annots, min, max, AlignmentAnnotation.LINE_GRAPH); |
540 |
203 |
tfactorann.setTFType(tfacTemplate.getTFType()); |
541 |
203 |
tfactorann.setCalcId(getClass().getName()); |
542 |
|
|
543 |
203 |
tfactorann.setSequenceRef(sequence); |
544 |
203 |
sequence.addAlignmentAnnotation(tfactorann); |
545 |
|
} |
546 |
|
} |
547 |
|
|
548 |
|
|
549 |
|
|
550 |
|
|
551 |
|
|
552 |
|
|
553 |
|
|
554 |
|
|
555 |
|
|
556 |
|
|
|
|
| 62.5% |
Uncovered Elements: 3 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
557 |
1 |
public void setChargeColours()... |
558 |
|
{ |
559 |
1 |
for (Bond b : bonds) |
560 |
|
{ |
561 |
3 |
if (b.at1 != null && b.at2 != null) |
562 |
|
{ |
563 |
3 |
b.startCol = getChargeColour(b.at1.resName); |
564 |
3 |
b.endCol = getChargeColour(b.at2.resName); |
565 |
|
} |
566 |
|
else |
567 |
|
{ |
568 |
0 |
b.startCol = Color.gray; |
569 |
0 |
b.endCol = Color.gray; |
570 |
|
} |
571 |
|
} |
572 |
|
} |
573 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 6 |
Complexity Density: 0.75 |
|
574 |
13 |
public static Color getChargeColour(String resName)... |
575 |
|
{ |
576 |
13 |
Color result = Color.lightGray; |
577 |
13 |
if ("ASP".equals(resName) || "GLU".equals(resName)) |
578 |
|
{ |
579 |
3 |
result = Color.red; |
580 |
|
} |
581 |
10 |
else if ("LYS".equals(resName) || "ARG".equals(resName)) |
582 |
|
{ |
583 |
4 |
result = Color.blue; |
584 |
|
} |
585 |
6 |
else if ("CYS".equals(resName)) |
586 |
|
{ |
587 |
3 |
result = Color.yellow; |
588 |
|
} |
589 |
13 |
return result; |
590 |
|
} |
591 |
|
|
592 |
|
|
593 |
|
|
594 |
|
|
595 |
|
|
596 |
|
|
597 |
|
@param |
598 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.22 |
|
599 |
1 |
public void setChainColours(ColourSchemeI cs)... |
600 |
|
{ |
601 |
1 |
int index; |
602 |
1 |
for (Bond b : bonds) |
603 |
|
{ |
604 |
3 |
try |
605 |
|
{ |
606 |
3 |
index = ResidueProperties.aa3Hash.get(b.at1.resName).intValue(); |
607 |
3 |
b.startCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0, |
608 |
|
null, null, 0f); |
609 |
|
|
610 |
3 |
index = ResidueProperties.aa3Hash.get(b.at2.resName).intValue(); |
611 |
2 |
b.endCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0, |
612 |
|
null, null, 0f); |
613 |
|
|
614 |
|
} catch (Exception e) |
615 |
|
{ |
616 |
1 |
b.startCol = Color.gray; |
617 |
1 |
b.endCol = Color.gray; |
618 |
|
} |
619 |
|
} |
620 |
|
} |
621 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
622 |
1 |
public void setChainColours(Color col)... |
623 |
|
{ |
624 |
1 |
for (Bond b : bonds) |
625 |
|
{ |
626 |
2 |
b.startCol = col; |
627 |
2 |
b.endCol = col; |
628 |
|
} |
629 |
|
} |
630 |
|
|
631 |
|
|
632 |
|
|
633 |
|
|
634 |
|
|
635 |
|
@param |
636 |
|
|
637 |
|
@param |
638 |
|
|
639 |
|
|
|
|
| 42.9% |
Uncovered Elements: 40 (70) |
Complexity: 19 |
Complexity Density: 0.43 |
|
640 |
193 |
public void transferResidueAnnotation(StructureMapping mapping,... |
641 |
|
jalview.datamodel.Mapping sqmpping) |
642 |
|
{ |
643 |
193 |
SequenceI sq = mapping.getSequence(); |
644 |
193 |
SequenceI dsq = sq; |
645 |
193 |
if (sqmpping == null) |
646 |
|
{ |
647 |
|
|
648 |
|
|
649 |
0 |
sqmpping = mapping.getSeqToPdbMapping(); |
650 |
|
} |
651 |
193 |
if (sq != null) |
652 |
|
{ |
653 |
384 |
while (dsq.getDatasetSequence() != null) |
654 |
|
{ |
655 |
191 |
dsq = dsq.getDatasetSequence(); |
656 |
|
} |
657 |
|
|
658 |
|
|
659 |
193 |
if (shadow != null && shadow.getAnnotation() != null) |
660 |
|
{ |
661 |
|
|
662 |
0 |
for (AlignmentAnnotation ana : shadow.getAnnotation()) |
663 |
|
{ |
664 |
|
|
665 |
|
|
666 |
0 |
List<AlignmentAnnotation> transfer = sq.getAlignmentAnnotations( |
667 |
|
ana.getCalcId(), ana.label, ana.description); |
668 |
0 |
if (transfer == null || transfer.size() == 0) |
669 |
|
{ |
670 |
0 |
ContactMatrixI cm = shadow.getContactMatrixFor(ana); |
671 |
0 |
ana = new AlignmentAnnotation(ana); |
672 |
|
|
673 |
0 |
ana.liftOver(sequence, shadowMap); |
674 |
0 |
ana.liftOver(dsq, sqmpping); |
675 |
0 |
dsq.addAlignmentAnnotation(ana); |
676 |
0 |
if (cm != null) |
677 |
|
{ |
678 |
0 |
dsq.addContactListFor(ana, cm); |
679 |
|
} |
680 |
|
} |
681 |
|
else |
682 |
|
{ |
683 |
0 |
continue; |
684 |
|
} |
685 |
|
} |
686 |
|
} |
687 |
|
else |
688 |
|
{ |
689 |
193 |
if (sequence != null && sequence.getAnnotation() != null) |
690 |
|
{ |
691 |
154 |
for (AlignmentAnnotation ana : sequence.getAnnotation()) |
692 |
|
{ |
693 |
|
|
694 |
|
|
695 |
335 |
List<AlignmentAnnotation> transfer = dsq |
696 |
|
.getAlignmentAnnotations(ana.getCalcId(), ana.label, |
697 |
|
ana.description); |
698 |
335 |
if (transfer == null || transfer.size() == 0) |
699 |
|
{ |
700 |
177 |
ContactMatrixI cm = sequence.getContactMatrixFor(ana); |
701 |
177 |
ana = new AlignmentAnnotation(ana); |
702 |
177 |
ana.liftOver(dsq, sqmpping); |
703 |
177 |
dsq.addAlignmentAnnotation(ana); |
704 |
177 |
if (cm != null && cm instanceof MappableContactMatrixI) |
705 |
|
{ |
706 |
36 |
dsq.addContactListFor(ana, ((MappableContactMatrixI) cm) |
707 |
|
.liftOver(dsq, sqmpping)); |
708 |
|
} |
709 |
|
} |
710 |
|
else |
711 |
|
{ |
712 |
158 |
continue; |
713 |
|
} |
714 |
|
} |
715 |
|
} |
716 |
|
} |
717 |
193 |
if (false) |
718 |
|
{ |
719 |
|
|
720 |
0 |
float min = -1, max = 0; |
721 |
0 |
Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1]; |
722 |
0 |
for (int i = sq.getStart(), j = sq |
723 |
0 |
.getEnd(), k = 0; i <= j; i++, k++) |
724 |
|
{ |
725 |
0 |
int prn = mapping.getPDBResNum(k + 1); |
726 |
|
|
727 |
0 |
an[k] = new Annotation(prn); |
728 |
0 |
if (min == -1) |
729 |
|
{ |
730 |
0 |
min = k; |
731 |
0 |
max = k; |
732 |
|
} |
733 |
|
else |
734 |
|
{ |
735 |
0 |
if (min > k) |
736 |
|
{ |
737 |
0 |
min = k; |
738 |
|
} |
739 |
0 |
else if (max < k) |
740 |
|
{ |
741 |
0 |
max = k; |
742 |
|
} |
743 |
|
} |
744 |
|
} |
745 |
0 |
sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM", |
746 |
|
"PDB Residue Numbering for " + this.pdbid + ":" + this.id, |
747 |
|
an, min, max, AlignmentAnnotation.LINE_GRAPH)); |
748 |
|
} |
749 |
|
} |
750 |
|
} |
751 |
|
} |