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.BitSet;
39 import java.util.Hashtable;
41 import com.stevesoft.pat.Regex;
43 public class AnnotationRenderer
46 public AnnotationRenderer()
48 // TODO Auto-generated constructor stub
51 public void drawStemAnnot(Graphics g, Annotation[] row_annotations,
52 int lastSSX, int x, int y, int iconOffset, int startRes,
53 int column, boolean validRes, boolean validEnd)
55 g.setColor(STEM_COLOUR);
56 int sCol = (lastSSX / charWidth) + startRes;
58 int x2 = (x * charWidth);
59 Regex closeparen = new Regex("(\\))");
61 String dc = (column == 0 || row_annotations[column - 1] == null) ? ""
62 : row_annotations[column - 1].displayCharacter;
64 boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
65 || !dc.equals(row_annotations[sCol - 1].displayCharacter);
66 boolean diffdownstream = !validRes || !validEnd
67 || row_annotations[column] == null
68 || !dc.equals(row_annotations[column].displayCharacter);
69 // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
70 // If a closing base pair half of the stem, display a backward arrow
71 if (column > 0 && closeparen.search(dc))
74 // if (validRes && column>1 && row_annotations[column-2]!=null &&
75 // dc.equals(row_annotations[column-2].displayCharacter))
77 g.fillPolygon(new int[]
78 { lastSSX + 5, lastSSX + 5, lastSSX }, new int[]
79 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
89 // display a forward arrow
92 g.fillPolygon(new int[]
93 { x2 - 5, x2 - 5, x2 }, new int[]
94 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
103 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
106 private int charWidth, endRes, charHeight;
108 private boolean validCharWidth, hasHiddenColumns;
110 private FontMetrics fm;
112 private final boolean MAC = new jalview.util.Platform().isAMac();
114 boolean av_renderHistogram = true, av_renderProfile = true,
115 av_normaliseProfile = false;
117 ColourSchemeI profcolour = null;
119 private ColumnSelection columnSelection;
121 private Hashtable[] hconsensus;
123 private Hashtable[] hStrucConsensus;
125 private boolean av_ignoreGapsConsensus;
128 * attributes set from AwtRenderPanelI
131 * old image used when data is currently being calculated and cannot be
134 private Image fadedImage;
137 * panel being rendered into
139 private ImageObserver annotationPanel;
142 * width of image to render in panel
144 private int imgWidth;
146 * offset to beginning of visible area
150 * offset to end of visible area
152 private int visHeight;
154 * indicate if the renderer should only render the visible portion of the annotation given the current view settings
156 private boolean useClip=false;
158 * master flag indicating if renderer should ever try to clip. not enabled for jalview 2.8.1
160 private boolean canClip=false;
161 // public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI
163 public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,
166 fm = annotPanel.getFontMetrics();
167 annotationPanel = annotPanel;
168 fadedImage = annotPanel.getFadedImage();
169 imgWidth = annotPanel.getFadedImageWidth();
170 // visible area for rendering
171 int[] bounds=annotPanel.getVisibleVRange();
175 visHeight = bounds[1];
186 updateFromAlignViewport(av);
189 public void updateFromAlignViewport(AlignViewportI av)
191 charWidth = av.getCharWidth();
192 endRes = av.getEndRes();
193 charHeight = av.getCharHeight();
194 hasHiddenColumns = av.hasHiddenColumns();
195 validCharWidth = av.isValidCharWidth();
196 av_renderHistogram = av.isShowConsensusHistogram();
197 av_renderProfile = av.isShowSequenceLogo();
198 av_normaliseProfile = av.isNormaliseSequenceLogo();
199 profcolour = av.getGlobalColourScheme();
200 if (profcolour == null)
202 // Set the default colour for sequence logo if the alignnent has no
204 profcolour = av.getAlignment().isNucleotide() ? new jalview.schemes.NucleotideColourScheme()
205 : new jalview.schemes.ZappoColourScheme();
207 columnSelection = av.getColumnSelection();
208 hconsensus = av.getSequenceConsensusHash();// hconsensus;
209 hStrucConsensus = av.getRnaStructureConsensusHash(); // hStrucConsensus;
210 av_ignoreGapsConsensus = av.getIgnoreGapsConsensus();
213 public int[] getProfileFor(AlignmentAnnotation aa, int column)
215 // TODO : consider refactoring the global alignment calculation
216 // properties/rendering attributes as a global 'alignment group' which holds
217 // all vis settings for the alignment as a whole rather than a subset
219 if (aa.autoCalculated && aa.label.startsWith("Consensus"))
221 if (aa.groupRef != null && aa.groupRef.consensusData != null
222 && aa.groupRef.isShowSequenceLogo())
224 return AAFrequency.extractProfile(
225 aa.groupRef.consensusData[column],
226 aa.groupRef.getIgnoreGapsConsensus());
228 // TODO extend annotation row to enable dynamic and static profile data to
230 if (aa.groupRef == null && aa.sequenceRef == null && av_renderProfile)
232 return AAFrequency.extractProfile(hconsensus[column],
233 av_ignoreGapsConsensus);
238 if (aa.autoCalculated && aa.label.startsWith("StrucConsensus"))
240 // TODO implement group structure consensus
242 * if (aa.groupRef != null && aa.groupRef.consensusData != null &&
243 * aa.groupRef.isShowSequenceLogo()) { //TODO check what happens for
244 * group selections return StructureFrequency.extractProfile(
245 * aa.groupRef.consensusData[column], aa.groupRef
246 * .getIgnoreGapsConsensus()); }
248 // TODO extend annotation row to enable dynamic and static profile data
251 if (aa.groupRef == null && aa.sequenceRef == null
252 && av_renderProfile && hStrucConsensus != null
253 && hStrucConsensus.length > column)
255 return StructureFrequency.extractProfile(hStrucConsensus[column],
256 av_ignoreGapsConsensus);
264 * Render the annotation rows associated with an alignment.
269 * data and view settings to render
271 * destination for graphics
273 * row where a mouse event occured (or -1)
275 * first column that will be drawn
277 * last column that will be drawn
278 * @return true if the fadedImage was used for any alignment annotation rows
279 * currently being calculated
281 public boolean drawComponent(AwtRenderPanelI annotPanel,
282 AlignViewportI av, Graphics g, int activeRow, int startRes,
285 boolean usedFaded = false;
287 // AnnotationPanel needs to implement: ImageObserver, access to
289 updateFromAwtRenderPanel(annotPanel, av);
290 fm = g.getFontMetrics();
291 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
301 boolean validRes = false;
302 boolean validEnd = false;
303 boolean labelAllCols = false;
304 boolean centreColLabels, centreColLabelsDef = av
305 .getCentreColumnLabels();
306 boolean scaleColLabel = false;
308 BitSet graphGroupDrawn = new BitSet();
309 int charOffset = 0; // offset for a label
310 float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
312 Font ofont = g.getFont();
315 int yfrom=0,f_i=0,yto=0,f_to=0;
316 boolean clipst=false,clipend=false;
317 for (int i = 0; i < aa.length; i++)
319 AlignmentAnnotation row = aa[i];
320 Annotation[] row_annotations = row.annotations;
325 centreColLabels = row.centreColLabels || centreColLabelsDef;
326 labelAllCols = row.showAllColLabels;
327 scaleColLabel = row.scaleColLabel;
331 if (!useClip || ((y-charHeight)<visHeight && (y+row.height+charHeight*2)>=sOffset))
332 {// if_in_visible_region
343 if (row.graphGroup > -1 && graphGroupDrawn.get(row.graphGroup)) {
347 // this is so that we draw the characters below the graph
352 iconOffset = charHeight - fm.getDescent();
356 else if (row.hasText)
358 iconOffset = charHeight - fm.getDescent();
366 if (row.autoCalculated && av.isCalculationInProgress(row))
370 g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
371 - row.height, imgWidth, y, annotationPanel);
372 g.setColor(Color.black);
373 // g.drawString("Calculating "+aa[i].label+"....",20, y-row.height/2);
379 * else if (annotationPanel.av.updatingConservation &&
380 * aa[i].label.equals("Conservation")) {
382 * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
383 * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
384 * annotationPanel.imgWidth, y, annotationPanel);
386 * g.setColor(Color.black); //
387 * g.drawString("Calculating Conservation.....",20, y-row.height/2);
389 * continue; } else if (annotationPanel.av.updatingConservation &&
390 * aa[i].label.equals("Quality")) {
392 * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
393 * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
394 * annotationPanel.imgWidth, y, annotationPanel); g.setColor(Color.black);
395 * // / g.drawString("Calculating Quality....",20, y-row.height/2);
399 // first pass sets up state for drawing continuation from left-hand column
401 x = (startRes == 0) ? 0 : -1;
402 while (x < endRes - startRes)
404 if (hasHiddenColumns)
406 column = columnSelection.adjustForHiddenColumns(startRes + x);
407 if (column > row_annotations.length - 1)
414 column = startRes + x;
417 if ((row_annotations == null) || (row_annotations.length <= column)
418 || (row_annotations[column] == null))
430 g.setColor(Color.red);
432 if (columnSelection != null)
434 for (int n = 0; n < columnSelection.size(); n++)
436 int v = columnSelection.columnAt(n);
440 g.fillRect(x * charWidth, y, charWidth, charHeight);
445 if (!row.isValidStruc())
447 g.setColor(Color.orange);
448 g.fillRect((int) row.getInvalidStrucPos() * charWidth, y,
449 charWidth, charHeight);
453 && row_annotations[column].displayCharacter != null
454 && (row_annotations[column].displayCharacter.length() > 0))
457 if (centreColLabels || scaleColLabel)
459 fmWidth = fm.charsWidth(
460 row_annotations[column].displayCharacter
462 row_annotations[column].displayCharacter.length());
466 // justify the label and scale to fit in column
467 if (fmWidth > charWidth)
469 // scale only if the current font isn't already small enough
470 fmScaling = charWidth;
471 fmScaling /= fmWidth;
472 g.setFont(ofont.deriveFont(AffineTransform
473 .getScaleInstance(fmScaling, 1.0)));
474 // and update the label's width to reflect the scaling.
482 .charWidth(row_annotations[column].displayCharacter
485 charOffset = (int) ((charWidth - fmWidth) / 2f);
487 if (row_annotations[column].colour == null)
488 g.setColor(Color.black);
490 g.setColor(row_annotations[column].colour);
492 if (column == 0 || row.graph > 0)
494 g.drawString(row_annotations[column].displayCharacter,
495 (x * charWidth) + charOffset, y + iconOffset);
497 else if (row_annotations[column - 1] == null
499 || !row_annotations[column].displayCharacter
500 .equals(row_annotations[column - 1].displayCharacter) || (row_annotations[column].displayCharacter
501 .length() < 2 && row_annotations[column].secondaryStructure == ' ')))
503 g.drawString(row_annotations[column].displayCharacter, x
504 * charWidth + charOffset, y + iconOffset);
511 char ss = validRes ? row_annotations[column].secondaryStructure
515 // distinguish between forward/backward base-pairing
516 if (row_annotations[column].displayCharacter.indexOf(')') > -1)
521 if (!validRes || (ss != lastSS))
528 drawHelixAnnot(g, row_annotations, lastSSX, x, y,
529 iconOffset, startRes, column, validRes, validEnd);
533 drawSheetAnnot(g, row_annotations, lastSSX, x, y,
534 iconOffset, startRes, column, validRes, validEnd);
537 case 'S': // Stem case for RNA secondary structure
538 case 's': // and opposite direction
539 drawStemAnnot(g, row_annotations, lastSSX, x, y,
540 iconOffset, startRes, column, validRes, validEnd);
544 g.setColor(Color.gray);
545 g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth)
561 lastSSX = (x * charWidth);
568 if (column >= row_annotations.length)
570 column = row_annotations.length - 1;
577 if ((row_annotations == null) || (row_annotations.length <= column)
578 || (row_annotations[column] == null))
594 drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
595 startRes, column, validRes, validEnd);
599 drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
600 startRes, column, validRes, validEnd);
603 case 'S': // Stem case for RNA secondary structure
604 drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
605 startRes, column, validRes, validEnd);
608 drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset,
609 startRes, column, validRes, validEnd);
614 if (row.graph > 0 && row.graphHeight > 0)
616 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
618 if (row.graphGroup > -1 && !graphGroupDrawn.get(row.graphGroup))
620 float groupmax = -999999, groupmin = 9999999;
621 for (int gg = 0; gg < aa.length; gg++)
623 if (aa[gg].graphGroup != row.graphGroup)
630 aa[gg].visible = false;
632 if (aa[gg].graphMax > groupmax)
634 groupmax = aa[gg].graphMax;
636 if (aa[gg].graphMin < groupmin)
638 groupmin = aa[gg].graphMin;
642 for (int gg = 0; gg < aa.length; gg++)
644 if (aa[gg].graphGroup == row.graphGroup)
646 drawLineGraph(g, aa[gg], aa[gg].annotations, startRes,
647 endRes, y, groupmin, groupmax, row.graphHeight);
651 graphGroupDrawn.set(row.graphGroup);
655 drawLineGraph(g, row, row_annotations, startRes, endRes, y,
656 row.graphMin, row.graphMax, row.graphHeight);
659 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
661 drawBarGraph(g, row, row_annotations, startRes, endRes,
662 row.graphMin, row.graphMax, y);
666 if (clipst && !clipend)
670 }// end if_in_visible_region
671 if (row.graph > 0 && row.hasText)
685 System.err.println("Start clip at : " + yfrom + " (index " + f_i
691 .println("End clip at : " + yto + " (index " + f_to + ")");
698 private final Color GLYPHLINE_COLOR = Color.gray;
700 private final Color SHEET_COLOUR = Color.green;
702 private final Color HELIX_COLOUR = Color.red;
704 private final Color STEM_COLOUR = Color.blue;
706 public void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX,
707 int x, int y, int iconOffset, int startRes, int column,
708 boolean validRes, boolean validEnd)
710 g.setColor(GLYPHLINE_COLOR);
711 g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2);
714 public void drawSheetAnnot(Graphics g, Annotation[] row, int lastSSX,
715 int x, int y, int iconOffset, int startRes, int column,
716 boolean validRes, boolean validEnd)
718 g.setColor(SHEET_COLOUR);
720 if (!validEnd || !validRes || row == null || row[column] == null
721 || row[column].secondaryStructure != 'E')
723 g.fillRect(lastSSX, y + 4 + iconOffset,
724 (x * charWidth) - lastSSX - 4, 7);
725 g.fillPolygon(new int[]
726 { (x * charWidth) - 4, (x * charWidth) - 4, (x * charWidth) },
728 { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset },
733 g.fillRect(lastSSX, y + 4 + iconOffset,
734 (x + 1) * charWidth - lastSSX, 7);
739 public void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX,
740 int x, int y, int iconOffset, int startRes, int column,
741 boolean validRes, boolean validEnd)
743 g.setColor(HELIX_COLOUR);
745 int sCol = (lastSSX / charWidth) + startRes;
747 int x2 = (x * charWidth);
751 int ofs = charWidth / 2;
752 // Off by 1 offset when drawing rects and ovals
753 // to offscreen image on the MAC
754 g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1, 8, 8, 8);
755 if (sCol == 0 || row[sCol - 1] == null
756 || row[sCol - 1].secondaryStructure != 'H')
761 // g.setColor(Color.orange);
762 g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1 - ofs + 1, 8,
765 if (!validRes || row[column] == null
766 || row[column].secondaryStructure != 'H')
772 // g.setColor(Color.magenta);
773 g.fillRoundRect(lastSSX + ofs, y + 4 + iconOffset, x2 - x1 - ofs
781 if (sCol == 0 || row[sCol - 1] == null
782 || row[sCol - 1].secondaryStructure != 'H')
784 g.fillArc(lastSSX, y + 4 + iconOffset, charWidth, 8, 90, 180);
788 if (!validRes || row[column] == null
789 || row[column].secondaryStructure != 'H')
791 g.fillArc((x * charWidth) - charWidth, y + 4 + iconOffset, charWidth,
796 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
799 public void drawLineGraph(Graphics g, AlignmentAnnotation _aa,
800 Annotation[] aa_annotations, int sRes, int eRes, int y,
801 float min, float max, int graphHeight)
803 if (sRes > aa_annotations.length)
810 // Adjustment for fastpaint to left
816 eRes = Math.min(eRes, aa_annotations.length);
824 float range = max - min;
829 y2 = y - (int) ((0 - min / range) * graphHeight);
832 g.setColor(Color.gray);
833 g.drawLine(x - charWidth, y2, (eRes - sRes + 1) * charWidth, y2);
835 eRes = Math.min(eRes, aa_annotations.length);
838 int aaMax = aa_annotations.length - 1;
840 while (x < eRes - sRes)
843 if (hasHiddenColumns)
845 column = columnSelection.adjustForHiddenColumns(column);
853 if (aa_annotations[column] == null
854 || aa_annotations[column - 1] == null)
860 if (aa_annotations[column].colour == null)
861 g.setColor(Color.black);
863 g.setColor(aa_annotations[column].colour);
866 - (int) (((aa_annotations[column - 1].value - min) / range) * graphHeight);
868 - (int) (((aa_annotations[column].value - min) / range) * graphHeight);
870 g.drawLine(x * charWidth - charWidth / 2, y1, x * charWidth
871 + charWidth / 2, y2);
875 if (_aa.threshold != null)
877 g.setColor(_aa.threshold.colour);
878 Graphics2D g2 = (Graphics2D) g;
879 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
880 BasicStroke.JOIN_ROUND, 3f, new float[]
883 y2 = (int) (y - ((_aa.threshold.value - min) / range) * graphHeight);
884 g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
885 g2.setStroke(new BasicStroke());
889 public void drawBarGraph(Graphics g, AlignmentAnnotation _aa,
890 Annotation[] aa_annotations, int sRes, int eRes, float min,
893 if (sRes > aa_annotations.length)
897 Font ofont = g.getFont();
898 eRes = Math.min(eRes, aa_annotations.length);
900 int x = 0, y1 = y, y2 = y;
902 float range = max - min;
906 y2 = y - (int) ((0 - min / (range)) * _aa.graphHeight);
909 g.setColor(Color.gray);
911 g.drawLine(x, y2, (eRes - sRes) * charWidth, y2);
914 int aaMax = aa_annotations.length - 1;
915 boolean renderHistogram = true, renderProfile = true, normaliseProfile = false;
916 // if (aa.autoCalculated && aa.label.startsWith("Consensus"))
918 // TODO: generalise this to have render styles for consensus/profile data
919 if (_aa.groupRef != null)
921 renderHistogram = _aa.groupRef.isShowConsensusHistogram();
922 renderProfile = _aa.groupRef.isShowSequenceLogo();
923 normaliseProfile = _aa.groupRef.isNormaliseSequenceLogo();
927 renderHistogram = av_renderHistogram;
928 renderProfile = av_renderProfile;
929 normaliseProfile = av_normaliseProfile;
932 while (x < eRes - sRes)
935 if (hasHiddenColumns)
937 column = columnSelection.adjustForHiddenColumns(column);
945 if (aa_annotations[column] == null)
950 if (aa_annotations[column].colour == null)
951 g.setColor(Color.black);
953 g.setColor(aa_annotations[column].colour);
956 - (int) (((aa_annotations[column].value - min) / (range)) * _aa.graphHeight);
962 g.fillRect(x * charWidth, y2, charWidth, y1 - y2);
966 g.fillRect(x * charWidth, y1, charWidth, y2 - y1);
969 // draw profile if available
973 int profl[] = getProfileFor(_aa, column);
974 // just try to draw the logo if profl is not null
975 if (profl != null && profl[1] != 0)
977 float ht = normaliseProfile ? y - _aa.graphHeight : y1;
978 double htn = normaliseProfile ? _aa.graphHeight : (y2 - y1);// aa.graphHeight;
985 * profl.length == 74 indicates that the profile of a secondary
986 * structure conservation row was accesed. Therefore dc gets length 2,
987 * to have space for a basepair instead of just a single nucleotide
989 if (profl.length == 74)
997 LineMetrics lm = g.getFontMetrics(ofont).getLineMetrics("Q", g);
998 double scale = 1f / (normaliseProfile ? profl[1] : 100f);
999 float ofontHeight = 1f / lm.getAscent();// magnify to fill box
1001 for (int c = 2; c < profl[0];)
1003 dc[0] = (char) profl[c++];
1005 if (_aa.label.startsWith("StrucConsensus"))
1007 dc[1] = (char) profl[c++];
1011 wdth /= fm.charsWidth(dc, 0, dc.length);
1015 scl = htn * scale * profl[c++];
1016 lm = ofont.getLineMetrics(dc, 0, 1, g.getFontMetrics()
1017 .getFontRenderContext());
1018 g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
1019 wdth, scl / lm.getAscent())));
1020 lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
1022 // Debug - render boxes around characters
1023 // g.setColor(Color.red);
1024 // g.drawRect(x*av.charWidth, (int)ht, av.charWidth,
1026 // g.setColor(profcolour.findColour(dc[0]).darker());
1027 g.setColor(profcolour.findColour(dc[0], column, null));
1029 hght = (ht + (scl - lm.getDescent() - lm.getBaselineOffsets()[lm
1030 .getBaselineIndex()]));
1032 g.drawChars(dc, 0, dc.length, x * charWidth, (int) hght);
1040 if (_aa.threshold != null)
1042 g.setColor(_aa.threshold.colour);
1043 Graphics2D g2 = (Graphics2D) g;
1044 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
1045 BasicStroke.JOIN_ROUND, 3f, new float[]
1048 y2 = (int) (y - ((_aa.threshold.value - min) / range)
1050 g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
1051 g2.setStroke(new BasicStroke());
1055 // used by overview window
1056 public void drawGraph(Graphics g, AlignmentAnnotation _aa,
1057 Annotation[] aa_annotations, int width, int y, int sRes, int eRes)
1059 eRes = Math.min(eRes, aa_annotations.length);
1060 g.setColor(Color.white);
1061 g.fillRect(0, 0, width, y);
1062 g.setColor(new Color(0, 0, 180));
1066 for (int j = sRes; j < eRes; j++)
1068 if (aa_annotations[j] != null)
1070 if (aa_annotations[j].colour == null)
1071 g.setColor(Color.black);
1073 g.setColor(aa_annotations[j].colour);
1075 height = (int) ((aa_annotations[j].value / _aa.graphMax) * y);
1081 g.fillRect(x, y - height, charWidth, height);