2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.renderer;
20 import jalview.analysis.AAFrequency;
21 import jalview.analysis.StructureFrequency;
22 import jalview.api.AlignViewportI;
23 import jalview.datamodel.AlignmentAnnotation;
24 import jalview.datamodel.Annotation;
25 import jalview.datamodel.ColumnSelection;
26 import jalview.schemes.ColourSchemeI;
28 import java.awt.BasicStroke;
29 import java.awt.Color;
31 import java.awt.FontMetrics;
32 import java.awt.Graphics;
33 import java.awt.Graphics2D;
34 import java.awt.Image;
35 import java.awt.font.LineMetrics;
36 import java.awt.geom.AffineTransform;
37 import java.awt.image.ImageObserver;
38 import java.util.Hashtable;
40 import com.stevesoft.pat.Regex;
42 public class AnnotationRenderer
45 public AnnotationRenderer()
47 // TODO Auto-generated constructor stub
50 public void drawStemAnnot(Graphics g, Annotation[] row_annotations,
51 int lastSSX, int x, int y, int iconOffset, int startRes,
52 int column, boolean validRes, boolean validEnd)
54 g.setColor(STEM_COLOUR);
55 int sCol = (lastSSX / charWidth) + startRes;
57 int x2 = (x * charWidth);
58 Regex closeparen = new Regex("(\\))");
60 String dc = (column == 0 || row_annotations[column - 1] == null) ? ""
61 : row_annotations[column - 1].displayCharacter;
63 boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
64 || !dc.equals(row_annotations[sCol - 1].displayCharacter);
65 boolean diffdownstream = !validRes || !validEnd
66 || row_annotations[column] == null
67 || !dc.equals(row_annotations[column].displayCharacter);
68 // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
69 // If a closing base pair half of the stem, display a backward arrow
70 if (column > 0 && closeparen.search(dc))
73 // if (validRes && column>1 && row_annotations[column-2]!=null &&
74 // dc.equals(row_annotations[column-2].displayCharacter))
76 g.fillPolygon(new int[]
77 { lastSSX + 5, lastSSX + 5, lastSSX }, new int[]
78 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
88 // display a forward arrow
91 g.fillPolygon(new int[]
92 { x2 - 5, x2 - 5, x2 }, new int[]
93 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
102 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
105 private int charWidth, endRes, charHeight;
107 private boolean validCharWidth, hasHiddenColumns;
109 private FontMetrics fm;
111 private final boolean MAC = new jalview.util.Platform().isAMac();
113 boolean av_renderHistogram = true, av_renderProfile = true,
114 av_normaliseProfile = false;
116 ColourSchemeI profcolour = null;
118 private ColumnSelection columnSelection;
120 private Hashtable[] hconsensus;
122 private Hashtable[] hStrucConsensus;
124 private boolean av_ignoreGapsConsensus;
127 * attributes set from AwtRenderPanelI
130 * old image used when data is currently being calculated and cannot be
133 private Image fadedImage;
136 * panel being rendered into
138 private ImageObserver annotationPanel;
141 * width of image to render in panel
143 private int imgWidth;
145 // public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI
147 public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,
150 fm = annotPanel.getFontMetrics();
151 annotationPanel = annotPanel;
152 fadedImage = annotPanel.getFadedImage();
153 imgWidth = annotPanel.getFadedImageWidth();
154 updateFromAlignViewport(av);
157 public void updateFromAlignViewport(AlignViewportI av)
159 charWidth = av.getCharWidth();
160 endRes = av.getEndRes();
161 charHeight = av.getCharHeight();
162 hasHiddenColumns = av.hasHiddenColumns();
163 validCharWidth = av.isValidCharWidth();
164 av_renderHistogram = av.isShowConsensusHistogram();
165 av_renderProfile = av.isShowSequenceLogo();
166 av_normaliseProfile = av.isNormaliseSequenceLogo();
167 profcolour = av.getGlobalColourScheme();
168 if (profcolour == null)
170 // Set the default colour for sequence logo if the alignnent has no
172 profcolour = av.getAlignment().isNucleotide() ? new jalview.schemes.NucleotideColourScheme()
173 : new jalview.schemes.ZappoColourScheme();
175 columnSelection = av.getColumnSelection();
176 hconsensus = av.getSequenceConsensusHash();// hconsensus;
177 hStrucConsensus = av.getRnaStructureConsensusHash(); // hStrucConsensus;
178 av_ignoreGapsConsensus = av.getIgnoreGapsConsensus();
181 public int[] getProfileFor(AlignmentAnnotation aa, int column)
183 // TODO : consider refactoring the global alignment calculation
184 // properties/rendering attributes as a global 'alignment group' which holds
185 // all vis settings for the alignment as a whole rather than a subset
187 if (aa.autoCalculated && aa.label.startsWith("Consensus"))
189 if (aa.groupRef != null && aa.groupRef.consensusData != null
190 && aa.groupRef.isShowSequenceLogo())
192 return AAFrequency.extractProfile(
193 aa.groupRef.consensusData[column],
194 aa.groupRef.getIgnoreGapsConsensus());
196 // TODO extend annotation row to enable dynamic and static profile data to
198 if (aa.groupRef == null && aa.sequenceRef == null && av_renderProfile)
200 return AAFrequency.extractProfile(hconsensus[column],
201 av_ignoreGapsConsensus);
206 if (aa.autoCalculated && aa.label.startsWith("StrucConsensus"))
208 // TODO implement group structure consensus
210 * if (aa.groupRef != null && aa.groupRef.consensusData != null &&
211 * aa.groupRef.isShowSequenceLogo()) { //TODO check what happens for
212 * group selections return StructureFrequency.extractProfile(
213 * aa.groupRef.consensusData[column], aa.groupRef
214 * .getIgnoreGapsConsensus()); }
216 // TODO extend annotation row to enable dynamic and static profile data
219 if (aa.groupRef == null && aa.sequenceRef == null
220 && av_renderProfile && hStrucConsensus != null
221 && hStrucConsensus.length > column)
223 return StructureFrequency.extractProfile(hStrucConsensus[column],
224 av_ignoreGapsConsensus);
232 * Render the annotation rows associated with an alignment.
237 * data and view settings to render
239 * destination for graphics
241 * row where a mouse event occured (or -1)
243 * first column that will be drawn
245 * last column that will be drawn
246 * @return true if the fadedImage was used for any alignment annotation rows
247 * currently being calculated
249 public boolean drawComponent(AwtRenderPanelI annotPanel,
250 AlignViewportI av, Graphics g, int activeRow, int startRes,
253 boolean usedFaded = false;
255 // AnnotationPanel needs to implement: ImageObserver, access to
257 updateFromAwtRenderPanel(annotPanel, av);
258 fm = g.getFontMetrics();
259 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
266 boolean validRes = false;
267 boolean validEnd = false;
268 boolean labelAllCols = false;
269 boolean centreColLabels, centreColLabelsDef = av
270 .getCentreColumnLabels();
271 boolean scaleColLabel = false;
272 boolean[] graphGroupDrawn = new boolean[aa.length];
273 int charOffset = 0; // offset for a label
274 float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
276 Font ofont = g.getFont();
278 for (int i = 0; i < aa.length; i++)
280 AlignmentAnnotation row = aa[i];
281 Annotation[] row_annotations = row.annotations;
286 centreColLabels = row.centreColLabels || centreColLabelsDef;
287 labelAllCols = row.showAllColLabels;
288 scaleColLabel = row.scaleColLabel;
293 if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
298 // this is so that we draw the characters below the graph
303 iconOffset = charHeight - fm.getDescent();
307 else if (row.hasText)
309 iconOffset = charHeight - fm.getDescent();
317 if (row.autoCalculated && av.isCalculationInProgress(row))
321 g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
322 - row.height, imgWidth, y, annotationPanel);
323 g.setColor(Color.black);
324 // g.drawString("Calculating "+aa[i].label+"....",20, y-row.height/2);
330 * else if (annotationPanel.av.updatingConservation &&
331 * aa[i].label.equals("Conservation")) {
333 * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
334 * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
335 * annotationPanel.imgWidth, y, annotationPanel);
337 * g.setColor(Color.black); //
338 * g.drawString("Calculating Conservation.....",20, y-row.height/2);
340 * continue; } else if (annotationPanel.av.updatingConservation &&
341 * aa[i].label.equals("Quality")) {
343 * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
344 * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
345 * annotationPanel.imgWidth, y, annotationPanel); g.setColor(Color.black);
346 * // / g.drawString("Calculating Quality....",20, y-row.height/2);
350 // first pass sets up state for drawing continuation from left-hand column
352 x = (startRes == 0) ? 0 : -1;
353 while (x < endRes - startRes)
355 if (hasHiddenColumns)
357 column = columnSelection.adjustForHiddenColumns(startRes + x);
358 if (column > row_annotations.length - 1)
365 column = startRes + x;
368 if ((row_annotations == null) || (row_annotations.length <= column)
369 || (row_annotations[column] == null))
381 g.setColor(Color.red);
383 if (columnSelection != null)
385 for (int n = 0; n < columnSelection.size(); n++)
387 int v = columnSelection.columnAt(n);
391 g.fillRect(x * charWidth, y, charWidth, charHeight);
396 if (!row.isValidStruc())
398 g.setColor(Color.orange);
399 g.fillRect((int) row.getInvalidStrucPos() * charWidth, y,
400 charWidth, charHeight);
404 && row_annotations[column].displayCharacter != null
405 && (row_annotations[column].displayCharacter.length() > 0))
408 if (centreColLabels || scaleColLabel)
410 fmWidth = fm.charsWidth(
411 row_annotations[column].displayCharacter
413 row_annotations[column].displayCharacter.length());
417 // justify the label and scale to fit in column
418 if (fmWidth > charWidth)
420 // scale only if the current font isn't already small enough
421 fmScaling = charWidth;
422 fmScaling /= fmWidth;
423 g.setFont(ofont.deriveFont(AffineTransform
424 .getScaleInstance(fmScaling, 1.0)));
425 // and update the label's width to reflect the scaling.
433 .charWidth(row_annotations[column].displayCharacter
436 charOffset = (int) ((charWidth - fmWidth) / 2f);
438 if (row_annotations[column].colour == null)
439 g.setColor(Color.black);
441 g.setColor(row_annotations[column].colour);
443 if (column == 0 || row.graph > 0)
445 g.drawString(row_annotations[column].displayCharacter,
446 (x * charWidth) + charOffset, y + iconOffset);
448 else if (row_annotations[column - 1] == null
450 || !row_annotations[column].displayCharacter
451 .equals(row_annotations[column - 1].displayCharacter) || (row_annotations[column].displayCharacter
452 .length() < 2 && row_annotations[column].secondaryStructure == ' ')))
454 g.drawString(row_annotations[column].displayCharacter, x
455 * charWidth + charOffset, y + iconOffset);
462 char ss = validRes ? row_annotations[column].secondaryStructure
466 // distinguish between forward/backward base-pairing
467 if (row_annotations[column].displayCharacter.indexOf(')') > -1)
472 if (!validRes || (ss != lastSS))
479 drawHelixAnnot(g, row_annotations, lastSSX, x, y,
480 iconOffset, startRes, column, validRes, validEnd);
484 drawSheetAnnot(g, row_annotations, lastSSX, x, y,
485 iconOffset, startRes, column, validRes, validEnd);
488 case 'S': // Stem case for RNA secondary structure
489 case 's': // and opposite direction
490 drawStemAnnot(g, row_annotations, lastSSX, x, y,
491 iconOffset, startRes, column, validRes, validEnd);
495 g.setColor(Color.gray);
496 g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth)
512 lastSSX = (x * charWidth);
519 if (column >= row_annotations.length)
521 column = row_annotations.length - 1;
528 if ((row_annotations == null) || (row_annotations.length <= column)
529 || (row_annotations[column] == null))
545 drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
546 startRes, column, validRes, validEnd);
550 drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
551 startRes, column, validRes, validEnd);
554 case 'S': // Stem case for RNA secondary structure
555 drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
556 startRes, column, validRes, validEnd);
559 drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset,
560 startRes, column, validRes, validEnd);
565 if (row.graph > 0 && row.graphHeight > 0)
567 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
569 if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
571 float groupmax = -999999, groupmin = 9999999;
572 for (int gg = 0; gg < aa.length; gg++)
574 if (aa[gg].graphGroup != row.graphGroup)
581 aa[gg].visible = false;
583 if (aa[gg].graphMax > groupmax)
585 groupmax = aa[gg].graphMax;
587 if (aa[gg].graphMin < groupmin)
589 groupmin = aa[gg].graphMin;
593 for (int gg = 0; gg < aa.length; gg++)
595 if (aa[gg].graphGroup == row.graphGroup)
597 drawLineGraph(g, aa[gg], aa[gg].annotations, startRes,
598 endRes, y, groupmin, groupmax, row.graphHeight);
602 graphGroupDrawn[row.graphGroup] = true;
606 drawLineGraph(g, row, row_annotations, startRes, endRes, y,
607 row.graphMin, row.graphMax, row.graphHeight);
610 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
612 drawBarGraph(g, row, row_annotations, startRes, endRes,
613 row.graphMin, row.graphMax, y);
617 if (row.graph > 0 && row.hasText)
630 private final Color GLYPHLINE_COLOR = Color.gray;
632 private final Color SHEET_COLOUR = Color.green;
634 private final Color HELIX_COLOUR = Color.red;
636 private final Color STEM_COLOUR = Color.blue;
638 public void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX,
639 int x, int y, int iconOffset, int startRes, int column,
640 boolean validRes, boolean validEnd)
642 g.setColor(GLYPHLINE_COLOR);
643 g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2);
646 public void drawSheetAnnot(Graphics g, Annotation[] row, int lastSSX,
647 int x, int y, int iconOffset, int startRes, int column,
648 boolean validRes, boolean validEnd)
650 g.setColor(SHEET_COLOUR);
652 if (!validEnd || !validRes || row == null || row[column] == null
653 || row[column].secondaryStructure != 'E')
655 g.fillRect(lastSSX, y + 4 + iconOffset,
656 (x * charWidth) - lastSSX - 4, 7);
657 g.fillPolygon(new int[]
658 { (x * charWidth) - 4, (x * charWidth) - 4, (x * charWidth) },
660 { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset },
665 g.fillRect(lastSSX, y + 4 + iconOffset,
666 (x + 1) * charWidth - lastSSX, 7);
671 public void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX,
672 int x, int y, int iconOffset, int startRes, int column,
673 boolean validRes, boolean validEnd)
675 g.setColor(HELIX_COLOUR);
677 int sCol = (lastSSX / charWidth) + startRes;
679 int x2 = (x * charWidth);
683 int ofs = charWidth / 2;
684 // Off by 1 offset when drawing rects and ovals
685 // to offscreen image on the MAC
686 g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1, 8, 8, 8);
687 if (sCol == 0 || row[sCol - 1] == null
688 || row[sCol - 1].secondaryStructure != 'H')
693 // g.setColor(Color.orange);
694 g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1 - ofs + 1, 8,
697 if (!validRes || row[column] == null
698 || row[column].secondaryStructure != 'H')
704 // g.setColor(Color.magenta);
705 g.fillRoundRect(lastSSX + ofs, y + 4 + iconOffset, x2 - x1 - ofs
713 if (sCol == 0 || row[sCol - 1] == null
714 || row[sCol - 1].secondaryStructure != 'H')
716 g.fillArc(lastSSX, y + 4 + iconOffset, charWidth, 8, 90, 180);
720 if (!validRes || row[column] == null
721 || row[column].secondaryStructure != 'H')
723 g.fillArc((x * charWidth) - charWidth, y + 4 + iconOffset, charWidth,
728 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
731 public void drawLineGraph(Graphics g, AlignmentAnnotation _aa,
732 Annotation[] aa_annotations, int sRes, int eRes, int y,
733 float min, float max, int graphHeight)
735 if (sRes > aa_annotations.length)
742 // Adjustment for fastpaint to left
748 eRes = Math.min(eRes, aa_annotations.length);
756 float range = max - min;
761 y2 = y - (int) ((0 - min / range) * graphHeight);
764 g.setColor(Color.gray);
765 g.drawLine(x - charWidth, y2, (eRes - sRes + 1) * charWidth, y2);
767 eRes = Math.min(eRes, aa_annotations.length);
770 int aaMax = aa_annotations.length - 1;
772 while (x < eRes - sRes)
775 if (hasHiddenColumns)
777 column = columnSelection.adjustForHiddenColumns(column);
785 if (aa_annotations[column] == null
786 || aa_annotations[column - 1] == null)
792 if (aa_annotations[column].colour == null)
793 g.setColor(Color.black);
795 g.setColor(aa_annotations[column].colour);
798 - (int) (((aa_annotations[column - 1].value - min) / range) * graphHeight);
800 - (int) (((aa_annotations[column].value - min) / range) * graphHeight);
802 g.drawLine(x * charWidth - charWidth / 2, y1, x * charWidth
803 + charWidth / 2, y2);
807 if (_aa.threshold != null)
809 g.setColor(_aa.threshold.colour);
810 Graphics2D g2 = (Graphics2D) g;
811 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
812 BasicStroke.JOIN_ROUND, 3f, new float[]
815 y2 = (int) (y - ((_aa.threshold.value - min) / range) * graphHeight);
816 g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
817 g2.setStroke(new BasicStroke());
821 public void drawBarGraph(Graphics g, AlignmentAnnotation _aa,
822 Annotation[] aa_annotations, int sRes, int eRes, float min,
825 if (sRes > aa_annotations.length)
829 Font ofont = g.getFont();
830 eRes = Math.min(eRes, aa_annotations.length);
832 int x = 0, y1 = y, y2 = y;
834 float range = max - min;
838 y2 = y - (int) ((0 - min / (range)) * _aa.graphHeight);
841 g.setColor(Color.gray);
843 g.drawLine(x, y2, (eRes - sRes) * charWidth, y2);
846 int aaMax = aa_annotations.length - 1;
847 boolean renderHistogram = true, renderProfile = true, normaliseProfile = false;
848 // if (aa.autoCalculated && aa.label.startsWith("Consensus"))
850 // TODO: generalise this to have render styles for consensus/profile data
851 if (_aa.groupRef != null)
853 renderHistogram = _aa.groupRef.isShowConsensusHistogram();
854 renderProfile = _aa.groupRef.isShowSequenceLogo();
855 normaliseProfile = _aa.groupRef.isNormaliseSequenceLogo();
859 renderHistogram = av_renderHistogram;
860 renderProfile = av_renderProfile;
861 normaliseProfile = av_normaliseProfile;
864 while (x < eRes - sRes)
867 if (hasHiddenColumns)
869 column = columnSelection.adjustForHiddenColumns(column);
877 if (aa_annotations[column] == null)
882 if (aa_annotations[column].colour == null)
883 g.setColor(Color.black);
885 g.setColor(aa_annotations[column].colour);
888 - (int) (((aa_annotations[column].value - min) / (range)) * _aa.graphHeight);
894 g.fillRect(x * charWidth, y2, charWidth, y1 - y2);
898 g.fillRect(x * charWidth, y1, charWidth, y2 - y1);
901 // draw profile if available
905 int profl[] = getProfileFor(_aa, column);
906 // just try to draw the logo if profl is not null
907 if (profl != null && profl[1] != 0)
909 float ht = normaliseProfile ? y - _aa.graphHeight : y1;
910 double htn = normaliseProfile ? _aa.graphHeight : (y2 - y1);// aa.graphHeight;
917 * profl.length == 74 indicates that the profile of a secondary
918 * structure conservation row was accesed. Therefore dc gets length 2,
919 * to have space for a basepair instead of just a single nucleotide
921 if (profl.length == 74)
929 LineMetrics lm = g.getFontMetrics(ofont).getLineMetrics("Q", g);
930 double scale = 1f / (normaliseProfile ? profl[1] : 100f);
931 float ofontHeight = 1f / lm.getAscent();// magnify to fill box
933 for (int c = 2; c < profl[0];)
935 dc[0] = (char) profl[c++];
937 if (_aa.label.startsWith("StrucConsensus"))
939 dc[1] = (char) profl[c++];
943 wdth /= fm.charsWidth(dc, 0, dc.length);
947 scl = htn * scale * profl[c++];
948 lm = ofont.getLineMetrics(dc, 0, 1, g.getFontMetrics()
949 .getFontRenderContext());
950 g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
951 wdth, scl / lm.getAscent())));
952 lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
954 // Debug - render boxes around characters
955 // g.setColor(Color.red);
956 // g.drawRect(x*av.charWidth, (int)ht, av.charWidth,
958 // g.setColor(profcolour.findColour(dc[0]).darker());
959 g.setColor(profcolour.findColour(dc[0], column, null));
961 hght = (ht + (scl - lm.getDescent() - lm.getBaselineOffsets()[lm
962 .getBaselineIndex()]));
964 g.drawChars(dc, 0, dc.length, x * charWidth, (int) hght);
972 if (_aa.threshold != null)
974 g.setColor(_aa.threshold.colour);
975 Graphics2D g2 = (Graphics2D) g;
976 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
977 BasicStroke.JOIN_ROUND, 3f, new float[]
980 y2 = (int) (y - ((_aa.threshold.value - min) / range)
982 g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
983 g2.setStroke(new BasicStroke());
987 // used by overview window
988 public void drawGraph(Graphics g, AlignmentAnnotation _aa,
989 Annotation[] aa_annotations, int width, int y, int sRes, int eRes)
991 eRes = Math.min(eRes, aa_annotations.length);
992 g.setColor(Color.white);
993 g.fillRect(0, 0, width, y);
994 g.setColor(new Color(0, 0, 180));
998 for (int j = sRes; j < eRes; j++)
1000 if (aa_annotations[j] != null)
1002 if (aa_annotations[j].colour == null)
1003 g.setColor(Color.black);
1005 g.setColor(aa_annotations[j].colour);
1007 height = (int) ((aa_annotations[j].value / _aa.graphMax) * y);
1013 g.fillRect(x, y - height, charWidth, height);