- int sequenceCount = profile[1][0];
- int nonGappedCount = profile[1][1];
- int normalisedBy = ignoreGapsInConsensusCalculation ? nonGappedCount
- : sequenceCount;
- mouseOver.setLength(0);
- if (alphabet != null)
- {
- for (int c = 0; c < alphabet.length; c++)
- {
- float tval = profile[0][alphabet[c]] * 100f / normalisedBy;
- mouseOver
- .append(((c == 0) ? "" : "; "))
- .append(alphabet[c])
- .append(" ")
- .append(((fmt != null) ? fmt.form(tval) : ((int) tval)))
- .append("%");
- }
- }
- else
- {
- // TODO do this sort once only in calculate()?
- // char[][] ca = new char[profile[0].length][];
- char[] ca = new char[profile[0].length];
- float[] vl = new float[profile[0].length];
- for (int c = 0; c < ca.length; c++)
- {
- ca[c] = (char) c;
- // ca[c] = new char[]
- // { (char) c };
- vl[c] = profile[0][c];
- }
- QuickSort.sort(vl, ca);
- for (int p = 0, c = ca.length - 1; profile[0][ca[c]] > 0; c--)
- {
- final char residue = ca[c];
- if (residue != '-')
- {
- float tval = profile[0][residue] * 100f / normalisedBy;
- mouseOver
- .append((((p == 0) ? "" : "; ")))
- .append(residue)
- .append(" ")
- .append(((fmt != null) ? fmt.form(tval)
- : ((int) tval))).append("%");
- p++;
- }
- }
- }