2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, 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.appletgui;
23 import java.awt.event.*;
24 import java.awt.font.LineMetrics;
25 import java.awt.geom.AffineTransform;
27 import jalview.analysis.AAFrequency;
28 import jalview.datamodel.*;
29 import jalview.schemes.ColourSchemeI;
31 public class AnnotationPanel extends Panel implements AdjustmentListener,
32 ActionListener, MouseListener, MouseMotionListener
42 static String HELIX = "Helix";
44 static String SHEET = "Sheet";
46 static String LABEL = "Label";
48 static String REMOVE = "Remove Annotation";
50 static String COLOUR = "Colour";
52 static Color HELIX_COLOUR = Color.red.darker();
54 static Color SHEET_COLOUR = Color.green.darker().darker();
64 boolean fastPaint = false;
66 // Used For mouse Dragging and resizing graphs
67 int graphStretch = -1;
69 int graphStretchY = -1;
71 boolean mouseDragging = false;
73 public static int GRAPH_HEIGHT = 40;
77 public AnnotationPanel(AlignmentPanel ap)
79 MAC = new jalview.util.Platform().isAMac();
83 int height = adjustPanelHeight();
84 ap.apvscroll.setValues(0, getSize().height, 0, height);
86 addMouseMotionListener(this);
88 addMouseListener(this);
90 // ap.annotationScroller.getVAdjustable().addAdjustmentListener( this );
93 public AnnotationPanel(AlignViewport av)
98 public void adjustmentValueChanged(AdjustmentEvent evt)
108 public void actionPerformed(ActionEvent evt)
110 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
115 Annotation[] anot = aa[activeRow].annotations;
117 if (anot.length < av.getColumnSelection().getMax())
119 Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + 2];
120 System.arraycopy(anot, 0, temp, 0, anot.length);
122 aa[activeRow].annotations = anot;
126 if (av.colSel != null && av.colSel.size() > 0
127 && anot[av.colSel.getMin()] != null)
128 label = anot[av.getColumnSelection().getMin()].displayCharacter;
130 if (evt.getActionCommand().equals(REMOVE))
132 for (int i = 0; i < av.getColumnSelection().size(); i++)
134 anot[av.getColumnSelection().columnAt(i)] = null;
137 else if (evt.getActionCommand().equals(LABEL))
139 label = enterLabel(label, "Enter Label");
146 if ((label.length() > 0) && !aa[activeRow].hasText)
148 aa[activeRow].hasText = true;
151 for (int i = 0; i < av.getColumnSelection().size(); i++)
153 int index = av.getColumnSelection().columnAt(i);
155 if (!av.colSel.isVisible(index))
158 if (anot[index] == null)
160 anot[index] = new Annotation(label, "", ' ', 0);
163 anot[index].displayCharacter = label;
166 else if (evt.getActionCommand().equals(COLOUR))
168 UserDefinedColours udc = new UserDefinedColours(this, Color.black,
171 Color col = udc.getColor();
173 for (int i = 0; i < av.getColumnSelection().size(); i++)
175 int index = av.getColumnSelection().columnAt(i);
177 if (!av.colSel.isVisible(index))
180 if (anot[index] == null)
182 anot[index] = new Annotation("", "", ' ', 0);
185 anot[index].colour = col;
192 String symbol = "\u03B1";
194 if (evt.getActionCommand().equals(HELIX))
198 else if (evt.getActionCommand().equals(SHEET))
204 if (!aa[activeRow].hasIcons)
206 aa[activeRow].hasIcons = true;
209 label = enterLabel(symbol, "Enter Label");
216 if ((label.length() > 0) && !aa[activeRow].hasText)
218 aa[activeRow].hasText = true;
221 for (int i = 0; i < av.getColumnSelection().size(); i++)
223 int index = av.getColumnSelection().columnAt(i);
225 if (!av.colSel.isVisible(index))
228 if (anot[index] == null)
230 anot[index] = new Annotation(label, "", type, 0);
233 anot[index].secondaryStructure = type;
234 anot[index].displayCharacter = label;
244 String enterLabel(String text, String label)
246 EditNameDialog dialog = new EditNameDialog(text, null, label, null,
247 ap.alignFrame, "Enter Label", 400, 200, true);
250 return dialog.getName();
255 public void mousePressed(MouseEvent evt)
257 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
263 int height = -scrollOffset;
266 for (int i = 0; i < aa.length; i++)
270 height += aa[i].height;
273 if (evt.getY() < height)
279 else if (aa[i].graph > 0)
283 graphStretchY = evt.getY();
290 if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK
293 if (av.getColumnSelection() == null)
298 PopupMenu pop = new PopupMenu("Structure type");
299 MenuItem item = new MenuItem(HELIX);
300 item.addActionListener(this);
302 item = new MenuItem(SHEET);
303 item.addActionListener(this);
305 item = new MenuItem(LABEL);
306 item.addActionListener(this);
308 item = new MenuItem(COLOUR);
309 item.addActionListener(this);
311 item = new MenuItem(REMOVE);
312 item.addActionListener(this);
314 ap.alignFrame.add(pop);
315 pop.show(this, evt.getX(), evt.getY());
325 ap.scalePanel.mousePressed(evt);
328 public void mouseReleased(MouseEvent evt)
332 mouseDragging = false;
336 needValidating = false;
338 ap.scalePanel.mouseReleased(evt);
341 public void mouseClicked(MouseEvent evt)
345 boolean needValidating = false;
347 public void mouseDragged(MouseEvent evt)
349 if (graphStretch > -1)
351 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
353 if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
355 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
357 graphStretchY = evt.getY();
359 needValidating = true;
360 ap.paintAlignment(true);
364 ap.scalePanel.mouseDragged(evt);
368 public void mouseMoved(MouseEvent evt)
370 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
377 int height = -scrollOffset;
378 for (int i = 0; i < aa.length; i++)
383 height += aa[i].height;
386 if (evt.getY() < height)
393 int res = evt.getX() / av.getCharWidth() + av.getStartRes();
395 if (av.hasHiddenColumns)
397 res = av.getColumnSelection().adjustForHiddenColumns(res);
400 if (row > -1 && res < aa[row].annotations.length
401 && aa[row].annotations[res] != null)
403 StringBuffer text = new StringBuffer("Sequence position " + (res + 1));
404 if (aa[row].annotations[res].description != null)
406 text.append(" " + aa[row].annotations[res].description);
408 ap.alignFrame.statusBar.setText(text.toString());
412 public void mouseEntered(MouseEvent evt)
414 ap.scalePanel.mouseEntered(evt);
417 public void mouseExited(MouseEvent evt)
419 ap.scalePanel.mouseExited(evt);
422 public int adjustPanelHeight()
424 return adjustPanelHeight(true);
427 public int adjustPanelHeight(boolean repaint)
429 int height = calcPanelHeight();
430 this.setSize(new Dimension(getSize().width, height));
438 * calculate the height for visible annotation, revalidating bounds where necessary
439 * ABSTRACT GUI METHOD
440 * @return total height of annotation
442 public int calcPanelHeight()
444 // setHeight of panels
445 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
450 for (int i = 0; i < aa.length; i++)
461 aa[i].height += av.charHeight;
471 aa[i].height += aa[i].graphHeight;
474 if (aa[i].height == 0)
479 height += aa[i].height;
491 public void addEditableColumn(int i)
495 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
501 for (int j = 0; j < aa.length; j++)
511 if (activeRes == null)
513 activeRes = new Vector();
514 activeRes.addElement(String.valueOf(i));
518 activeRes.addElement(String.valueOf(i));
521 public void update(Graphics g)
526 public void paint(Graphics g)
528 Dimension d = getSize();
530 // (av.endRes - av.startRes + 1) * av.charWidth;
531 if (imgWidth<1 || d.height<1)
535 if (image == null || imgWidth != image.getWidth(this) || d.height != image.getHeight(this))
537 image = createImage(imgWidth, d.height);
538 gg = image.getGraphics();
539 gg.setFont(av.getFont());
540 fm = gg.getFontMetrics();
546 g.drawImage(image, 0, 0, this);
551 gg.setColor(Color.white);
552 gg.fillRect(0, 0, getSize().width, getSize().height);
553 drawComponent(gg, av.startRes, av.endRes + 1);
555 g.drawImage(image, 0, 0, this);
558 public void fastPaint(int horizontal)
560 if (horizontal == 0 || av.alignment.getAlignmentAnnotation() == null
561 || av.alignment.getAlignmentAnnotation().length < 1)
567 gg.copyArea(0, 0, imgWidth, getSize().height, -horizontal
569 int sr = av.startRes, er = av.endRes + 1, transX = 0;
571 if (horizontal > 0) // scrollbar pulled right, image to the left
573 transX = (er - sr - horizontal) * av.charWidth;
574 sr = er - horizontal;
576 else if (horizontal < 0)
578 er = sr - horizontal;
581 gg.translate(transX, 0);
583 drawComponent(gg, sr, er);
585 gg.translate(-transX, 0);
601 public void drawComponent(Graphics g, int startRes, int endRes)
603 Font ofont = av.getFont();
606 g.setColor(Color.white);
607 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getSize().height);
611 fm = g.getFontMetrics();
614 if ((av.alignment.getAlignmentAnnotation() == null)
615 || (av.alignment.getAlignmentAnnotation().length < 1))
617 g.setColor(Color.white);
618 g.fillRect(0, 0, getSize().width, getSize().height);
619 g.setColor(Color.black);
620 if (av.validCharWidth)
622 g.drawString("Alignment has no annotations", 20, 15);
628 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
629 g.translate(0, -scrollOffset);
635 int iconOffset = av.charHeight / 2;
636 boolean validRes = false;
637 boolean validEnd = false;
638 boolean labelAllCols = false;
639 boolean centreColLabels, centreColLabelsDef = av
640 .getCentreColumnLabels();
641 boolean scaleColLabel = false;
642 boolean[] graphGroupDrawn = new boolean[aa.length];
643 int charOffset = 0; // offset for a label
644 float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
647 for (int i = 0; i < aa.length; i++)
649 AlignmentAnnotation row = aa[i];
655 centreColLabels = row.centreColLabels || centreColLabelsDef;
656 labelAllCols = row.showAllColLabels;
657 scaleColLabel = row.scaleColLabel;
663 if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
668 // this is so that we draw the characters below the graph
673 iconOffset = av.charHeight - fm.getDescent();
677 // TODO: else is the logic used in application, applet had no 'else'
678 else if (row.hasText)
680 iconOffset = av.charHeight - fm.getDescent();
689 while (x < endRes - startRes)
691 if (av.hasHiddenColumns)
693 column = av.getColumnSelection().adjustForHiddenColumns(
695 if (column > row.annotations.length - 1)
702 column = startRes + x;
705 if ((row.annotations.length <= column)
706 || (row.annotations[column] == null))
717 g.setColor(Color.red);
719 if (av.getColumnSelection() != null)
721 for (int n = 0; n < av.getColumnSelection().size(); n++)
723 int v = av.getColumnSelection().columnAt(n);
727 g.fillRect(x * av.charWidth, y, av.charWidth, av.charHeight);
733 if (av.validCharWidth
735 && (row.annotations[column].displayCharacter != null && row.annotations[column].displayCharacter
739 if (centreColLabels || scaleColLabel)
741 fmWidth = (float) fm.charsWidth(
742 row.annotations[column].displayCharacter.toCharArray(),
743 0, row.annotations[column].displayCharacter.length());
747 // justify the label and scale to fit in column
748 if (fmWidth > av.charWidth)
750 // scale only if the current font isn't already small enough
751 fmScaling = av.charWidth;
752 fmScaling /= fmWidth;
753 // not 1.1 // g.setFont(new
754 // Font(ofont,AffineTransform.getScaleInstance(fmScaling,
756 // and update the label's width to reflect the scaling.
757 fmWidth = av.charWidth;
764 .charWidth(row.annotations[column].displayCharacter
767 charOffset = (int) ((av.charWidth - fmWidth) / 2f);
769 if (row.annotations[column].colour == null)
770 g.setColor(Color.black);
772 g.setColor(row.annotations[column].colour);
774 if (column == 0 || row.graph > 0)
776 g.drawString(row.annotations[column].displayCharacter,
777 (x * av.charWidth) + charOffset, y + iconOffset + 3); // +
780 else if (row.annotations[column - 1] == null
782 || !row.annotations[column].displayCharacter
783 .equals(row.annotations[column - 1].displayCharacter) || (row.annotations[column].displayCharacter
784 .length() < 2 && row.annotations[column].secondaryStructure == ' ')))
786 g.drawString(row.annotations[column].displayCharacter,
787 (x * av.charWidth) + charOffset, y + iconOffset + 3); // +3?
795 || (row.annotations[column].secondaryStructure != lastSS))
800 g.setColor(HELIX_COLOUR);
803 // Off by 1 offset when drawing rects and ovals
804 // to offscreen image on the MAC
805 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
806 (x * av.charWidth) - lastSSX, 7, 8, 8);
810 int sCol = (lastSSX / av.charWidth) + startRes;
812 int x2 = (x * av.charWidth);
815 || row.annotations[sCol - 1] == null
816 || row.annotations[sCol - 1].secondaryStructure != 'H')
818 g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90,
820 x1 += av.charWidth / 2;
823 if (!validRes || row.annotations[column] == null
824 || row.annotations[column].secondaryStructure != 'H')
826 g.fillArc((x * av.charWidth) - av.charWidth, y + 4
827 + iconOffset, av.charWidth, 8, 270, 180);
828 x2 -= av.charWidth / 2;
831 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
835 g.setColor(SHEET_COLOUR);
836 g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
838 g.fillPolygon(new int[]
839 { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
840 (x * av.charWidth) }, new int[]
841 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
847 g.setColor(Color.gray);
848 g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
856 lastSS = row.annotations[column].secondaryStructure;
863 lastSSX = (x * av.charWidth);
871 if (column >= row.annotations.length)
873 column = row.annotations.length - 1;
888 g.setColor(HELIX_COLOUR);
891 // Off by 1 offset when drawing rects and ovals
892 // to offscreen image on the MAC
893 g.fillRoundRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
898 int sCol = (lastSSX / av.charWidth) + startRes;
900 int x2 = (x * av.charWidth);
902 if (sCol == 0 || row.annotations[sCol - 1] == null
903 || row.annotations[sCol - 1].secondaryStructure != 'H')
905 g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);
906 x1 += av.charWidth / 2;
909 if (row.annotations[column] == null
910 || row.annotations[column].secondaryStructure != 'H')
912 g.fillArc((x * av.charWidth) - av.charWidth,
913 y + 4 + iconOffset, av.charWidth, 8, 270, 180);
914 x2 -= av.charWidth / 2;
917 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
922 g.setColor(SHEET_COLOUR);
924 if (!validEnd || row.annotations[endRes] == null
925 || row.annotations[endRes].secondaryStructure != 'E')
927 g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
929 g.fillPolygon(new int[]
930 { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
931 (x * av.charWidth) }, new int[]
932 { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset }, 3);
936 g.fillRect(lastSSX, y + 4 + iconOffset, x * av.charWidth
942 g.setColor(Color.gray);
943 if (!av.wrapAlignment || endRes == av.endRes)
945 g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
953 if (row.graph > 0 && row.graphHeight > 0)
955 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
957 if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
959 float groupmax = -999999, groupmin = 9999999;
960 for (int gg = 0; gg < aa.length; gg++)
962 if (aa[gg].graphGroup != row.graphGroup)
969 aa[gg].visible = false;
972 if (aa[gg].graphMax > groupmax)
974 groupmax = aa[gg].graphMax;
976 if (aa[gg].graphMin < groupmin)
978 groupmin = aa[gg].graphMin;
982 for (int gg = 0; gg < aa.length; gg++)
984 if (aa[gg].graphGroup == row.graphGroup)
986 drawLineGraph(g, aa[gg], startRes, endRes, y, groupmin,
987 groupmax, row.graphHeight);
991 graphGroupDrawn[row.graphGroup] = true;
995 drawLineGraph(g, row, startRes, endRes, y, row.graphMin,
996 row.graphMax, row.graphHeight);
999 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
1001 drawBarGraph(g, row, startRes, endRes, row.graphMin,
1006 if (row.graph > 0 && row.hasText)
1016 g.translate(0, +scrollOffset);
1019 public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
1020 int eRes, int y, float min, float max, int graphHeight)
1022 if (sRes > aa.annotations.length)
1029 // Adjustment for fastpaint to left
1030 if (eRes < av.endRes)
1035 eRes = Math.min(eRes, aa.annotations.length);
1038 float range = max - min;
1043 y2 = y - (int) ((0 - min / range) * graphHeight);
1046 g.setColor(Color.gray);
1047 g.drawLine(x - av.charWidth, y2, (eRes - sRes) * av.charWidth, y2);
1049 eRes = Math.min(eRes, aa.annotations.length);
1052 int aaMax = aa.annotations.length - 1;
1054 while (x < eRes - sRes)
1057 if (av.hasHiddenColumns)
1059 column = av.getColumnSelection().adjustForHiddenColumns(column);
1067 if (aa.annotations[column] == null) // || coaa.annotations[column - 1] ==
1074 if (aa.annotations[column].colour == null)
1075 g.setColor(Color.black);
1077 g.setColor(aa.annotations[column].colour);
1078 if (column == 0 || aa.annotations[column - 1] == null)
1081 - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
1086 - (int) (((aa.annotations[column - 1].value - min) / range) * graphHeight);
1089 - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
1091 g.drawLine(x * av.charWidth - av.charWidth / 2, y1, x * av.charWidth
1092 + av.charWidth / 2, y2);
1096 if (aa.threshold != null)
1098 g.setColor(aa.threshold.colour);
1100 y2 = (int) (y - ((aa.threshold.value - min) / range) * graphHeight);
1101 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1105 public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes,
1106 int eRes, float min, float max, int y)
1108 ColourSchemeI profcolour = av.getGlobalColourScheme();
1109 if (profcolour == null)
1111 profcolour = new jalview.schemes.ZappoColourScheme();
1113 if (sRes > aa.annotations.length)
1117 Font ofont = g.getFont();
1118 eRes = Math.min(eRes, aa.annotations.length);
1120 int x = 0, y1 = y, y2 = y;
1122 float range = max - min;
1126 y2 = y - (int) ((0 - min / (range)) * aa.graphHeight);
1129 g.setColor(Color.gray);
1131 g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
1134 int aaMax = aa.annotations.length - 1;
1135 boolean renderHistogram = true, renderProfile = false;
1136 if (aa.autoCalculated && aa.label.startsWith("Consensus"))
1137 { // TODO: generalise this to have render styles for consensus/profile data
1138 if (aa.groupRef != null)
1140 renderHistogram = aa.groupRef.isShowConsensusHistogram();
1141 renderProfile = aa.groupRef.isShowSequenceLogo();
1145 renderHistogram = av.isShowConsensusHistogram();
1146 renderProfile = av.isShowSequenceLogo();
1150 while (x < eRes - sRes)
1153 if (av.hasHiddenColumns)
1155 column = av.getColumnSelection().adjustForHiddenColumns(column);
1163 if (aa.annotations[column] == null)
1169 if (aa.annotations[column].colour == null)
1170 g.setColor(Color.black);
1172 g.setColor(aa.annotations[column].colour);
1175 - (int) (((aa.annotations[column].value - min) / (range)) * aa.graphHeight);
1177 if (renderHistogram)
1181 g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
1185 g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
1188 // draw profile if available
1189 if (aa.annotations[column].value != 0 && renderProfile)
1191 int profl[] = getProfileFor(aa, column);
1192 int ht = y1, htn = y2 - y1;// aa.graphHeight;
1195 char[] dc = new char[1];
1197 for (int c = 1; profl != null && c < profl[0];)
1199 dc[0] = (char) profl[c++];
1200 wdth = av.charWidth;
1201 wdth /= (float) fm.charsWidth(dc, 0, 1);
1207 { // not java 1.1 compatible: Bug # 0060064
1208 g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
1209 wdth, (ht2 = (htn * ((double) profl[c++]) / 100.0))
1211 lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
1212 g.setColor(profcolour.findColour(dc[0]));
1213 g.drawChars(dc, 0, 1, x * av.charWidth,
1214 (int) (ht + lm.getHeight()));
1223 if (aa.threshold != null)
1225 g.setColor(aa.threshold.colour);
1226 y2 = (int) (y - ((aa.threshold.value - min) / range) * aa.graphHeight);
1227 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1231 private int[] getProfileFor(AlignmentAnnotation aa, int column)
1233 // if (aa.autoCalculated && aa.label.startsWith("Consensus")) {
1234 if (aa.groupRef != null && aa.groupRef.consensusData != null)
1236 // && aa.groupRef.isShowSequenceLogo()) {
1237 return AAFrequency.extractProfile(aa.groupRef.consensusData[column],
1238 aa.groupRef.getIgnoreGapsConsensus());
1240 // TODO extend annotation row to enable dynamic and static profile data to
1242 if (aa.groupRef == null && aa.sequenceRef == null)
1243 // && av.isShowSequenceLogo())
1245 return AAFrequency.extractProfile(av.hconsensus[column],
1246 av.getIgnoreGapsConsensus());
1252 // used by overview window
1253 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width,
1254 int y, int sRes, int eRes)
1256 eRes = Math.min(eRes, aa.annotations.length);
1257 g.setColor(Color.white);
1258 g.fillRect(0, 0, width, y);
1259 g.setColor(new Color(0, 0, 180));
1263 for (int j = sRes; j < eRes; j++)
1265 if (aa.annotations[j].colour == null)
1266 g.setColor(Color.black);
1268 g.setColor(aa.annotations[j].colour);
1270 height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);
1275 g.fillRect(x, y - height, av.charWidth, height);
1280 int scrollOffset = 0;
1282 public void setScrollOffset(int value)
1284 scrollOffset = value;