1 Clazz.declarePackage ("jalview.renderer");
2 Clazz.load (["jalview.util.Platform", "java.awt.Color"], "jalview.renderer.AnnotationRenderer", ["jalview.analysis.AAFrequency", "$.CodingUtils", "$.StructureFrequency", "jalview.jsdev.RegExp", "jalview.schemes.NucleotideColourScheme", "$.ResidueProperties", "$.ZappoColourScheme", "java.awt.BasicStroke", "java.awt.geom.AffineTransform", "java.util.BitSet"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.debugRedraw = false;
8 this.validCharWidth = false;
9 this.hasHiddenColumns = false;
12 this.av_renderHistogram = true;
13 this.av_renderProfile = true;
14 this.av_normaliseProfile = false;
15 this.profcolour = null;
16 this.columnSelection = null;
17 this.hconsensus = null;
18 this.complementConsensus = null;
19 this.hStrucConsensus = null;
20 this.av_ignoreGapsConsensus = false;
21 this.fadedImage = null;
22 this.annotationPanel = null;
29 this.sdNOTCANONICAL_COLOUR = null;
30 Clazz.instantialize (this, arguments);
31 }, jalview.renderer, "AnnotationRenderer");
32 Clazz.prepareFields (c$, function () {
33 this.MAC = jalview.util.Platform.isAMac ();
35 Clazz.makeConstructor (c$,
37 this.construct (false);
39 Clazz.makeConstructor (c$,
40 function (debugRedraw) {
41 this.debugRedraw = debugRedraw;
43 Clazz.defineMethod (c$, "drawStemAnnot",
44 function (g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd) {
45 g.setColor (jalview.renderer.AnnotationRenderer.STEM_COLOUR);
46 var sCol = (Clazz.doubleToInt (lastSSX / this.charWidth)) + startRes;
48 var x2 = (x * this.charWidth);
49 var closeparen = jalview.jsdev.RegExp.newRegex (["(\\))"]);
50 var dc = (column == 0 || row_annotations[column - 1] == null) ? ' ' : row_annotations[column - 1].secondaryStructure;
51 var diffupstream = sCol == 0 || row_annotations[sCol - 1] == null || dc != row_annotations[sCol - 1].secondaryStructure;
52 var diffdownstream = !validRes || !validEnd || row_annotations[column] == null || dc != row_annotations[column].secondaryStructure;
53 if (column > 0 && jalview.schemes.ResidueProperties.isCloseParenRNA (dc)) {
55 g.fillPolygon ( Clazz.newIntArray (-1, [lastSSX + 5, lastSSX + 5, lastSSX]), Clazz.newIntArray (-1, [y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset]), 3);
57 }if (diffdownstream) {
61 g.fillPolygon ( Clazz.newIntArray (-1, [x2 - 5, x2 - 5, x2]), Clazz.newIntArray (-1, [y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset]), 3);
65 }}g.fillRect (x1, y + 4 + iconOffset, x2 - x1, 7);
66 }, "java.awt.Graphics,~A,~N,~N,~N,~N,~N,~N,~B,~B");
67 Clazz.defineMethod (c$, "drawNotCanonicalAnnot",
68 function (g, nonCanColor, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd) {
69 g.setColor (nonCanColor);
70 var sCol = (Clazz.doubleToInt (lastSSX / this.charWidth)) + startRes;
72 var x2 = (x * this.charWidth);
73 var closeparen = jalview.jsdev.RegExp.newRegex (["}|]|<|[a-z]"]);
74 var dc = (column == 0 || row_annotations[column - 1] == null) ? "" : row_annotations[column - 1].displayCharacter;
75 var diffupstream = sCol == 0 || row_annotations[sCol - 1] == null || !dc.equals (row_annotations[sCol - 1].displayCharacter);
76 var diffdownstream = !validRes || !validEnd || row_annotations[column] == null || !dc.equals (row_annotations[column].displayCharacter);
77 if (column > 0 && closeparen.search (dc)) {
79 g.fillPolygon ( Clazz.newIntArray (-1, [lastSSX + 5, lastSSX + 5, lastSSX]), Clazz.newIntArray (-1, [y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset]), 3);
81 }if (diffdownstream) {
85 g.fillPolygon ( Clazz.newIntArray (-1, [x2 - 5, x2 - 5, x2]), Clazz.newIntArray (-1, [y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset]), 3);
89 }}g.fillRect (x1, y + 4 + iconOffset, x2 - x1, 7);
90 }, "java.awt.Graphics,java.awt.Color,~A,~N,~N,~N,~N,~N,~N,~B,~B");
91 Clazz.defineMethod (c$, "updateFromAwtRenderPanel",
92 function (annotPanel, av) {
93 this.fm = annotPanel.getFontMetrics ();
94 this.annotationPanel = annotPanel;
95 this.fadedImage = annotPanel.getFadedImage ();
96 this.imgWidth = annotPanel.getFadedImageWidth ();
97 var bounds = annotPanel.getVisibleVRange ();
99 this.sOffset = bounds[0];
100 this.visHeight = bounds[1];
101 if (this.visHeight == 0) {
102 this.useClip = false;
104 this.useClip = this.canClip;
106 this.useClip = false;
107 }this.updateFromAlignViewport (av);
108 }, "jalview.renderer.AwtRenderPanelI,jalview.api.AlignViewportI");
109 Clazz.defineMethod (c$, "updateFromAlignViewport",
111 this.charWidth = av.getCharWidth ();
112 this.endRes = av.getEndRes ();
113 this.charHeight = av.getCharHeight ();
114 this.hasHiddenColumns = av.hasHiddenColumns ();
115 this.validCharWidth = av.isValidCharWidth ();
116 this.av_renderHistogram = av.isShowConsensusHistogram ();
117 this.av_renderProfile = av.isShowSequenceLogo ();
118 this.av_normaliseProfile = av.isNormaliseSequenceLogo ();
119 this.profcolour = av.getGlobalColourScheme ();
120 if (this.profcolour == null) {
121 this.profcolour = av.getAlignment ().isNucleotide () ? new jalview.schemes.NucleotideColourScheme () : new jalview.schemes.ZappoColourScheme ();
122 }this.columnSelection = av.getColumnSelection ();
123 this.hconsensus = av.getSequenceConsensusHash ();
124 this.complementConsensus = av.getComplementConsensusHash ();
125 this.hStrucConsensus = av.getRnaStructureConsensusHash ();
126 this.av_ignoreGapsConsensus = av.isIgnoreGapsConsensus ();
127 }, "jalview.api.AlignViewportI");
128 Clazz.defineMethod (c$, "getProfileFor",
129 function (aa, column) {
130 if (aa.autoCalculated && (aa.label.startsWith ("Consensus") || aa.label.startsWith ("cDNA Consensus"))) {
131 var forComplement = aa.label.startsWith ("cDNA Consensus");
132 if (aa.groupRef != null && aa.groupRef.consensusData != null && aa.groupRef.isShowSequenceLogo ()) {
133 return jalview.analysis.AAFrequency.extractProfile (aa.groupRef.consensusData[column], aa.groupRef.getIgnoreGapsConsensus ());
134 }if (aa.groupRef == null && aa.sequenceRef == null) {
136 return jalview.analysis.AAFrequency.extractCdnaProfile (this.complementConsensus[column], this.av_ignoreGapsConsensus);
138 return jalview.analysis.AAFrequency.extractProfile (this.hconsensus[column], this.av_ignoreGapsConsensus);
140 if (aa.autoCalculated && aa.label.startsWith ("StrucConsensus")) {
141 if (aa.groupRef == null && aa.sequenceRef == null && this.hStrucConsensus != null && this.hStrucConsensus.length > column) {
142 return jalview.analysis.StructureFrequency.extractProfile (this.hStrucConsensus[column], this.av_ignoreGapsConsensus);
144 }, "jalview.datamodel.AlignmentAnnotation,~N");
145 Clazz.defineMethod (c$, "drawComponent",
146 function (annotPanel, av, g, activeRow, startRes, endRes) {
147 var stime = System.currentTimeMillis ();
148 var usedFaded = false;
149 this.updateFromAwtRenderPanel (annotPanel, av);
150 this.fm = g.getFontMetrics ();
151 var aa = av.getAlignment ().getAlignmentAnnotation ();
161 var validRes = false;
162 var validEnd = false;
163 var labelAllCols = false;
165 var centreColLabelsDef = av.isCentreColumnLabels ();
166 var scaleColLabel = false;
167 var consensusAnnot = av.getAlignmentConsensusAnnotation ();
168 var structConsensusAnnot = av.getAlignmentStrucConsensusAnnotation ();
169 var complementConsensusAnnot = av.getComplementConsensusAnnotation ();
170 var renderHistogram = true;
171 var renderProfile = true;
172 var normaliseProfile = false;
173 var isRNA = this.rna;
174 var graphGroupDrawn = new java.util.BitSet ();
178 var ofont = g.getFont ();
185 for (var i = 0; i < aa.length; i++) {
187 isRNA = row.isRNA ();
189 if (row.groupRef != null && row === row.groupRef.getConsensus ()) {
190 renderHistogram = row.groupRef.isShowConsensusHistogram ();
191 renderProfile = row.groupRef.isShowSequenceLogo ();
192 normaliseProfile = row.groupRef.isNormaliseSequenceLogo ();
193 } else if (row === consensusAnnot || row === structConsensusAnnot || row === complementConsensusAnnot) {
194 renderHistogram = this.av_renderHistogram;
195 renderProfile = this.av_renderProfile;
196 normaliseProfile = this.av_normaliseProfile;
198 renderHistogram = true;
199 }}var row_annotations = row.annotations;
202 }centreColLabels = row.centreColLabels || centreColLabelsDef;
203 labelAllCols = row.showAllColLabels;
204 scaleColLabel = row.scaleColLabel;
207 if (!this.useClip || ((y - this.charHeight) < this.visHeight && (y + row.height + this.charHeight * 2) >= this.sOffset)) {
215 if (row.graphGroup > -1 && graphGroupDrawn.get (row.graphGroup)) {
219 iconOffset = this.charHeight - this.fm.getDescent ();
220 y -= this.charHeight;
221 }} else if (row.hasText) {
222 iconOffset = this.charHeight - this.fm.getDescent ();
225 }if (row.autoCalculated && av.isCalculationInProgress (row)) {
226 y += this.charHeight;
228 g.drawImage (this.fadedImage, 0, y - row.height, this.imgWidth, y, 0, y - row.height, this.imgWidth, y, this.annotationPanel);
229 g.setColor (java.awt.Color.black);
231 }x = (startRes == 0) ? 0 : -1;
232 while (x < endRes - startRes) {
233 if (this.hasHiddenColumns) {
234 column = this.columnSelection.adjustForHiddenColumns (startRes + x);
235 if (column > row_annotations.length - 1) {
238 column = startRes + x;
239 }if ((row_annotations == null) || (row_annotations.length <= column) || (row_annotations[column] == null)) {
243 }var displayChar = validRes ? row_annotations[column].displayCharacter : null;
245 if (activeRow == i) {
246 g.setColor (java.awt.Color.red);
247 if (this.columnSelection != null) {
248 for (var n = 0; n < this.columnSelection.size (); n++) {
249 var v = this.columnSelection.columnAt (n);
251 g.fillRect (x * this.charWidth, y, this.charWidth, this.charHeight);
253 }}if (row.getInvalidStrucPos () > x) {
254 g.setColor (java.awt.Color.orange);
255 g.fillRect (x * this.charWidth, y, this.charWidth, this.charHeight);
256 } else if (row.getInvalidStrucPos () == x) {
257 g.setColor (java.awt.Color.orange.darker ());
258 g.fillRect (x * this.charWidth, y, this.charWidth, this.charHeight);
259 }if (this.validCharWidth && validRes && displayChar != null && (displayChar.length > 0)) {
260 fmWidth = this.fm.charsWidth (displayChar.toCharArray (), 0, displayChar.length);
262 if (fmWidth > this.charWidth) {
263 fmScaling = this.charWidth;
264 fmScaling /= fmWidth;
265 g.setFont (ofont.deriveFont (java.awt.geom.AffineTransform.getScaleInstance (fmScaling, 1.0)));
266 fmWidth = this.charWidth;
267 }}charOffset = Clazz.floatToInt ((this.charWidth - fmWidth) / 2);
268 if (row_annotations[column].colour == null) {
269 g.setColor (java.awt.Color.black);
271 g.setColor (row_annotations[column].colour);
272 }if (column == 0 || row.graph > 0) {
273 g.drawString (displayChar, (x * this.charWidth) + charOffset, y + iconOffset);
274 } else if (row_annotations[column - 1] == null || (labelAllCols || !displayChar.equals (row_annotations[column - 1].displayCharacter) || (displayChar.length < 2 && row_annotations[column].secondaryStructure == ' '))) {
275 g.drawString (displayChar, x * this.charWidth + charOffset, y + iconOffset);
277 }}if (row.hasIcons) {
278 var ss = validRes ? row_annotations[column].secondaryStructure : '-';
280 if (displayChar.indexOf (')') > -1) {
283 if ((displayChar.indexOf (']') > -1)) {
286 if (displayChar.indexOf ('}') > -1) {
289 if (displayChar.indexOf ('<') > -1) {
291 }}if (ss.charCodeAt (0) >= 65) {
292 if (displayChar.indexOf (ss.charCodeAt (0) + 32) > -1) {
293 ss = String.fromCharCode (ss.charCodeAt (0) + 32);
294 }}if (!validRes || (ss != lastSS)) {
296 var nb_annot = x - temp;
300 this.drawStemAnnot (g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd);
305 this.drawHelixAnnot (g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd);
309 this.drawSheetAnnot (g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd);
367 var nonCanColor = this.getNotCanonicalColor (lastSS);
368 this.drawNotCanonicalAnnot (g, nonCanColor, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd);
372 g.setColor (java.awt.Color.gray);
373 g.fillRect (lastSSX, y + 6 + iconOffset, (x * this.charWidth) - lastSSX, 2);
382 lastSSX = (x * this.charWidth);
386 if (column >= row_annotations.length) {
387 column = row_annotations.length - 1;
391 }if ((row_annotations == null) || (row_annotations.length <= column) || (row_annotations[column] == null)) {
399 this.drawHelixAnnot (g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd);
403 this.drawSheetAnnot (g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd);
407 this.drawStemAnnot (g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd);
463 var nonCanColor = this.getNotCanonicalColor (lastSS);
464 this.drawNotCanonicalAnnot (g, nonCanColor, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd);
467 this.drawGlyphLine (g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd);
470 }if (row.graph > 0 && row.graphHeight > 0) {
471 if (row.graph == 2) {
472 if (row.graphGroup > -1 && !graphGroupDrawn.get (row.graphGroup)) {
473 var groupmax = -999999;
474 var groupmin = 9999999;
475 for (var gg = 0; gg < aa.length; gg++) {
476 if (aa[gg].graphGroup != row.graphGroup) {
478 }if (aa[gg] !== row) {
479 aa[gg].visible = false;
480 }if (aa[gg].graphMax > groupmax) {
481 groupmax = aa[gg].graphMax;
482 }if (aa[gg].graphMin < groupmin) {
483 groupmin = aa[gg].graphMin;
485 for (var gg = 0; gg < aa.length; gg++) {
486 if (aa[gg].graphGroup == row.graphGroup) {
487 this.drawLineGraph (g, aa[gg], aa[gg].annotations, startRes, endRes, y, groupmin, groupmax, row.graphHeight);
489 graphGroupDrawn.set (row.graphGroup);
491 this.drawLineGraph (g, row, row_annotations, startRes, endRes, y, row.graphMin, row.graphMax, row.graphHeight);
492 }} else if (row.graph == 1) {
493 this.drawBarGraph (g, row, row_annotations, startRes, endRes, row.graphMin, row.graphMax, y, renderHistogram, renderProfile, normaliseProfile);
495 if (clipst && !clipend) {
497 }}if (row.graph > 0 && row.hasText) {
498 y += this.charHeight;
499 }if (row.graph == 0) {
502 if (this.debugRedraw) {
505 System.err.println ("Start clip at : " + yfrom + " (index " + f_i + ")");
507 System.err.println ("End clip at : " + yto + " (index " + f_to + ")");
508 }};System.err.println ("Annotation Rendering time:" + (System.currentTimeMillis () - stime));
510 }, "jalview.renderer.AwtRenderPanelI,jalview.api.AlignViewportI,java.awt.Graphics,~N,~N,~N");
511 Clazz.defineMethod (c$, "drawGlyphLine",
512 function (g, row, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd) {
513 g.setColor (jalview.renderer.AnnotationRenderer.GLYPHLINE_COLOR);
514 g.fillRect (lastSSX, y + 6 + iconOffset, (x * this.charWidth) - lastSSX, 2);
515 }, "java.awt.Graphics,~A,~N,~N,~N,~N,~N,~N,~B,~B");
516 Clazz.defineMethod (c$, "drawSheetAnnot",
517 function (g, row, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd) {
518 g.setColor (jalview.renderer.AnnotationRenderer.SHEET_COLOUR);
519 if (!validEnd || !validRes || row == null || row[column] == null || row[column].secondaryStructure != 'E') {
520 g.fillRect (lastSSX, y + 4 + iconOffset, (x * this.charWidth) - lastSSX - 4, 7);
521 g.fillPolygon ( Clazz.newIntArray (-1, [(x * this.charWidth) - 4, (x * this.charWidth) - 4, (x * this.charWidth)]), Clazz.newIntArray (-1, [y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset]), 3);
523 g.fillRect (lastSSX, y + 4 + iconOffset, (x + 1) * this.charWidth - lastSSX, 7);
524 }}, "java.awt.Graphics,~A,~N,~N,~N,~N,~N,~N,~B,~B");
525 Clazz.defineMethod (c$, "drawHelixAnnot",
526 function (g, row, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd) {
527 g.setColor (jalview.renderer.AnnotationRenderer.HELIX_COLOUR);
528 var sCol = (Clazz.doubleToInt (lastSSX / this.charWidth)) + startRes;
530 var x2 = (x * this.charWidth);
532 var ofs = Clazz.doubleToInt (this.charWidth / 2);
533 g.fillRoundRect (lastSSX, y + 4 + iconOffset, x2 - x1, 8, 8, 8);
534 if (sCol == 0 || row[sCol - 1] == null || row[sCol - 1].secondaryStructure != 'H') {
536 g.fillRoundRect (lastSSX, y + 4 + iconOffset, x2 - x1 - ofs + 1, 8, 0, 0);
537 }if (!validRes || row[column] == null || row[column].secondaryStructure != 'H') {
539 g.fillRoundRect (lastSSX + ofs, y + 4 + iconOffset, x2 - x1 - ofs + 1, 8, 0, 0);
541 }if (sCol == 0 || row[sCol - 1] == null || row[sCol - 1].secondaryStructure != 'H') {
542 g.fillArc (lastSSX, y + 4 + iconOffset, this.charWidth, 8, 90, 180);
543 x1 += Clazz.doubleToInt (this.charWidth / 2);
544 }if (!validRes || row[column] == null || row[column].secondaryStructure != 'H') {
545 g.fillArc ((x * this.charWidth) - this.charWidth, y + 4 + iconOffset, this.charWidth, 8, 270, 180);
546 x2 -= Clazz.doubleToInt (this.charWidth / 2);
547 }g.fillRect (x1, y + 4 + iconOffset, x2 - x1, 8);
548 }, "java.awt.Graphics,~A,~N,~N,~N,~N,~N,~N,~B,~B");
549 Clazz.defineMethod (c$, "drawLineGraph",
550 function (g, _aa, aa_annotations, sRes, eRes, y, min, max, graphHeight) {
551 if (sRes > aa_annotations.length) {
554 if (eRes < this.endRes) {
556 }eRes = Math.min (eRes, aa_annotations.length);
561 var range = max - min;
563 y2 = y - Clazz.floatToInt ((0 - min / range) * graphHeight);
564 }g.setColor (java.awt.Color.gray);
565 g.drawLine (x - this.charWidth, y2, (eRes - sRes + 1) * this.charWidth, y2);
566 eRes = Math.min (eRes, aa_annotations.length);
568 var aaMax = aa_annotations.length - 1;
569 while (x < eRes - sRes) {
571 if (this.hasHiddenColumns) {
572 column = this.columnSelection.adjustForHiddenColumns (column);
573 }if (column > aaMax) {
575 }if (aa_annotations[column] == null || aa_annotations[column - 1] == null) {
578 }if (aa_annotations[column].colour == null) {
579 g.setColor (java.awt.Color.black);
581 g.setColor (aa_annotations[column].colour);
582 }y1 = y - Clazz.floatToInt (((aa_annotations[column - 1].value - min) / range) * graphHeight);
583 y2 = y - Clazz.floatToInt (((aa_annotations[column].value - min) / range) * graphHeight);
584 g.drawLine (x * this.charWidth - Clazz.doubleToInt (this.charWidth / 2), y1, x * this.charWidth + Clazz.doubleToInt (this.charWidth / 2), y2);
587 if (_aa.threshold != null) {
588 g.setColor (_aa.threshold.colour);
590 g2.setStroke ( new java.awt.BasicStroke (1, 2, 1, 3, Clazz.newFloatArray (-1, [5, 3]), 0));
591 y2 = Clazz.floatToInt (y - ((_aa.threshold.value - min) / range) * graphHeight);
592 g.drawLine (0, y2, (eRes - sRes) * this.charWidth, y2);
593 g2.setStroke ( new java.awt.BasicStroke ());
594 }}, "java.awt.Graphics,jalview.datamodel.AlignmentAnnotation,~A,~N,~N,~N,~N,~N,~N");
595 Clazz.defineMethod (c$, "drawBarGraph",
596 function (g, _aa, aa_annotations, sRes, eRes, min, max, y, renderHistogram, renderProfile, normaliseProfile) {
597 if (sRes > aa_annotations.length) {
599 }var ofont = g.getFont ();
600 eRes = Math.min (eRes, aa_annotations.length);
604 var range = max - min;
606 y2 = y - Clazz.floatToInt ((0 - min / (range)) * _aa.graphHeight);
607 }g.setColor (java.awt.Color.gray);
608 g.drawLine (x, y2, (eRes - sRes) * this.charWidth, y2);
610 var aaMax = aa_annotations.length - 1;
611 while (x < eRes - sRes) {
613 if (this.hasHiddenColumns) {
614 column = this.columnSelection.adjustForHiddenColumns (column);
615 }if (column > aaMax) {
617 }if (aa_annotations[column] == null) {
620 }if (aa_annotations[column].colour == null) {
621 g.setColor (java.awt.Color.black);
623 g.setColor (aa_annotations[column].colour);
624 }y1 = y - Clazz.floatToInt (((aa_annotations[column].value - min) / (range)) * _aa.graphHeight);
625 if (renderHistogram) {
627 g.fillRect (x * this.charWidth, y2, this.charWidth, y1 - y2);
629 g.fillRect (x * this.charWidth, y1, this.charWidth, y2 - y1);
630 }}if (renderProfile) {
631 var profl = this.getProfileFor (_aa, column);
632 if (profl != null && profl[2] != 0) {
633 var isStructureProfile = profl[0] == 1;
634 var isCdnaProfile = profl[0] == 2;
635 var ht = normaliseProfile ? y - _aa.graphHeight : y1;
636 var htn = normaliseProfile ? _aa.graphHeight : (y2 - y1);
641 dc = Clazz.newCharArray (isStructureProfile ? 2 : (isCdnaProfile ? 3 : 1), '\0');
642 var lm = g.getFontMetrics (ofont).getLineMetrics ("Q", g);
643 var scale = 1 / (normaliseProfile ? profl[2] : 100);
644 var ofontHeight = 1 / lm.getAscent ();
647 var valuesProcessed = 0;
648 while (valuesProcessed < profl[1]) {
649 if (isStructureProfile) {
650 dc[0] = String.fromCharCode (profl[c++]);
651 dc[1] = String.fromCharCode (profl[c++]);
652 } else if (isCdnaProfile) {
653 dc = jalview.analysis.CodingUtils.decodeCodon (profl[c++]);
655 dc[0] = String.fromCharCode (profl[c++]);
656 }wdth = this.charWidth;
657 wdth /= this.fm.charsWidth (dc, 0, dc.length);
659 scl = htn * scale * profl[c++];
660 lm = ofont.getLineMetrics (dc, 0, 1, g.getFontMetrics ().getFontRenderContext ());
661 g.setFont (ofont.deriveFont (java.awt.geom.AffineTransform.getScaleInstance (wdth, scl / lm.getAscent ())));
662 lm = g.getFontMetrics ().getLineMetrics (dc, 0, 1, g);
665 var codonTranslation = jalview.schemes.ResidueProperties.codonTranslate ( String.instantialize (dc));
666 colour = this.profcolour.findColour (codonTranslation.charAt (0), column, null);
668 colour = this.profcolour.findColour (dc[0], column, null);
669 }g.setColor (colour === java.awt.Color.white ? java.awt.Color.lightGray : colour);
670 hght = (ht + (scl - lm.getDescent () - lm.getBaselineOffsets ()[lm.getBaselineIndex ()]));
671 g.drawChars (dc, 0, dc.length, x * this.charWidth, Clazz.doubleToInt (hght));
677 if (_aa.threshold != null) {
678 g.setColor (_aa.threshold.colour);
680 g2.setStroke ( new java.awt.BasicStroke (1, 2, 1, 3, Clazz.newFloatArray (-1, [5, 3]), 0));
681 y2 = Clazz.floatToInt (y - ((_aa.threshold.value - min) / range) * _aa.graphHeight);
682 g.drawLine (0, y2, (eRes - sRes) * this.charWidth, y2);
683 g2.setStroke ( new java.awt.BasicStroke ());
684 }}, "java.awt.Graphics,jalview.datamodel.AlignmentAnnotation,~A,~N,~N,~N,~N,~N,~B,~B,~B");
685 Clazz.defineMethod (c$, "drawGraph",
686 function (g, _aa, aa_annotations, width, y, sRes, eRes) {
687 eRes = Math.min (eRes, aa_annotations.length);
688 g.setColor (java.awt.Color.white);
689 g.fillRect (0, 0, width, y);
690 g.setColor ( new java.awt.Color (0, 0, 180));
693 for (var j = sRes; j < eRes; j++) {
694 if (aa_annotations[j] != null) {
695 if (aa_annotations[j].colour == null) {
696 g.setColor (java.awt.Color.black);
698 g.setColor (aa_annotations[j].colour);
699 }height = Clazz.floatToInt ((aa_annotations[j].value / _aa.graphMax) * y);
702 }g.fillRect (x, y - height, this.charWidth, height);
703 }x += this.charWidth;
705 }, "java.awt.Graphics,jalview.datamodel.AlignmentAnnotation,~A,~N,~N,~N,~N");
706 Clazz.defineMethod (c$, "getNotCanonicalColor",
711 return new java.awt.Color (255, 125, 5);
714 return new java.awt.Color (245, 115, 10);
717 return new java.awt.Color (235, 135, 15);
720 return new java.awt.Color (225, 105, 20);
723 return new java.awt.Color (215, 145, 30);
726 return new java.awt.Color (205, 95, 35);
729 return new java.awt.Color (195, 155, 45);
732 return new java.awt.Color (185, 85, 55);
735 return new java.awt.Color (175, 165, 65);
738 return new java.awt.Color (170, 75, 75);
741 return new java.awt.Color (160, 175, 85);
744 return new java.awt.Color (150, 65, 95);
747 return new java.awt.Color (140, 185, 105);
750 return new java.awt.Color (130, 55, 110);
753 return new java.awt.Color (120, 195, 120);
756 return new java.awt.Color (110, 45, 130);
759 return new java.awt.Color (100, 205, 140);
762 return new java.awt.Color (90, 35, 150);
765 return new java.awt.Color (85, 215, 160);
768 return new java.awt.Color (75, 25, 170);
771 return new java.awt.Color (65, 225, 180);
774 return new java.awt.Color (55, 15, 185);
777 return new java.awt.Color (45, 235, 195);
780 return new java.awt.Color (35, 5, 205);
783 return new java.awt.Color (25, 245, 215);
786 return new java.awt.Color (15, 0, 225);
789 return new java.awt.Color (10, 255, 235);
792 return new java.awt.Color (5, 150, 245);
795 return new java.awt.Color (0, 80, 255);
797 System.out.println ("This is not a interaction : " + lastss);
801 c$.GLYPHLINE_COLOR = c$.prototype.GLYPHLINE_COLOR = java.awt.Color.gray;
802 c$.SHEET_COLOUR = c$.prototype.SHEET_COLOUR = java.awt.Color.green;
803 c$.HELIX_COLOUR = c$.prototype.HELIX_COLOUR = java.awt.Color.red;
804 c$.STEM_COLOUR = c$.prototype.STEM_COLOUR = java.awt.Color.blue;