From f5448ec3a478b5567cd2844e47a01398af63daee Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 18 Mar 2015 20:32:18 +0000 Subject: [PATCH] JAL-1680 small tidy --- src/jalview/analysis/StructureFrequency.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index 5cf4e30..3c8274e 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -420,7 +420,7 @@ public class StructureFrequency * ((c == 0) ? "" : "; ") + alphabet[c] + " " + ((int) tval) + "%"; } } * else { */ - Object[] ca = new Object[625]; + int[][] ca = new int[625][]; float[] vl = new float[625]; int x = 0; for (int c = 65; c < 90; c++) @@ -436,14 +436,18 @@ public class StructureFrequency jalview.util.QuickSort.sort(vl, ca); int p = 0; + /* + * profile[1] is {total, ungappedTotal} + */ + final int divisor = profile[1][ignoreGapsInConsensusCalculation ? 1 + : 0]; for (int c = 624; c > 0; c--) { if (vl[c] > 0) { - tval = (vl[c] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1 - : 0]); - mouseOver += ((p == 0) ? "" : "; ") + (char) ((int[]) ca[c])[0] - + (char) ((int[]) ca[c])[1] + " " + fmt.form(tval) + tval = (vl[c] * 100f / divisor); + mouseOver += ((p == 0) ? "" : "; ") + (char) ca[c][0] + + (char) ca[c][1] + " " + fmt.form(tval) + "%"; p++; @@ -500,14 +504,14 @@ public class StructureFrequency int valuesCount = 0; rtnval[1] = 0; int offset = 2; + final int divisor = profile[1][ignoreGapsInConsensusCalculation ? 1 : 0]; for (int c = 624; c > 0; c--) { if (vl[c] > 0) { rtnval[offset++] = ca[c][0]; rtnval[offset++] = ca[c][1]; - rtnval[offset] = (int) (vl[c] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1 - : 0]); + rtnval[offset] = (int) (vl[c] * 100f / divisor); rtnval[1] += rtnval[offset++]; valuesCount++; } -- 1.7.10.2