-
- void drawProfileDensity(Graphics g, AlignmentAnnotation _aa,
- Annotation[] aa_annotations, int sRes, int eRes, float min,
- float max, int y)
- {
- if (sRes > aa_annotations.length)
- {
- return;
- }
- Font ofont = g.getFont();
- eRes = Math.min(eRes, aa_annotations.length);
-
- int x = 0, y2 = y;
-
-
-
- g.setColor(Color.pink);
-
- g.drawLine(x, y2, (eRes - sRes) * charWidth, y2);
-
- int column;
- int aaMax = aa_annotations.length - 1;
- while (x < eRes - sRes)
- {
- column = sRes + x;
- if (hasHiddenColumns)
- {
- column = columnSelection.adjustForHiddenColumns(column);
- }
-
- if (column > aaMax)
- {
- break;
- }
-
- if (aa_annotations[column] == null)
- {
- x++;
- continue;
- }
- if (aa_annotations[column].colour == null)
- {
- g.setColor(Color.black);
- }
- else
- {
- g.setColor(aa_annotations[column].colour);
- }
-
-
- /*
- * {profile type, #values, total count, char1, pct1, char2, pct2...}
- */
- int profl[] = getProfileFor(_aa, column);
-
- // just try to draw the logo if profl is not null
- if (profl != null && profl[2] != 0)
- {
- boolean isStructureProfile = profl[0] == AlignmentAnnotation.STRUCTURE_PROFILE;
- boolean isCdnaProfile = profl[0] == AlignmentAnnotation.CDNA_PROFILE;
- float ht = y2; // - _aa.graphHeight;
- char[] dc;
-
- /**
- * Render a single base for a sequence profile, a base pair for
- * structure profile, and a triplet for a cdna profile
- */
- dc = new char[isStructureProfile ? 2 : (isCdnaProfile ? 3 : 1)];
-
- double scale = _aa.graphHeight / (profl[1]);
-
- /*
- * Traverse the character(s)/percentage data in the array
- */
- int c = 3;
- int valuesProcessed = 0;
- // profl[1] is the number of values in the profile
-
- while (valuesProcessed < profl[1])
- {
- if (isStructureProfile)
- {
- // todo can we encode a structure pair as an int, like codons?
- dc[0] = (char) profl[c++];
- dc[1] = (char) profl[c++];
- }
- else if (isCdnaProfile)
- {
- dc = CodingUtils.decodeCodon(profl[c++]);
- }
- else
- {
- dc[0] = (char) profl[c++];
- }
-
- ht -= scale;
- // next profl[] position is profile % for the character(s)
- // render boxes
- g.setColor(jalview.util.ColorUtils.getGraduatedColour(profl[c++],
- 0f, Color.gray, 100, Color.blue));
- // g.setColor(profcolour.findColour(dc[0]).darker());
-
- g.fillRect(x * charWidth, (int) ht, charWidth, (int) scale);
- valuesProcessed++;
- }
- g.setFont(ofont);
- }
- x++;
-
- }
-
- // if (_aa.threshold != null)
- // {
- // g.setColor(_aa.threshold.colour);
- // Graphics2D g2 = (Graphics2D) g;
- // g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
- // BasicStroke.JOIN_ROUND, 3f, new float[] { 5f, 3f }, 0f));
- //
- // y2 = (int) (y - ((_aa.threshold.value - min) / range)
- // * _aa.graphHeight);
- // g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
- // g2.setStroke(new BasicStroke());
- // }
- }
-