From: TZVanaalten Date: Wed, 2 Aug 2017 12:06:43 +0000 (+0100) Subject: JAL-2599 fix for HMM logo not normalising correctly X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=717094c2f47a3679be4acaf2d0c0cd30c83c2a82;p=jalview.git JAL-2599 fix for HMM logo not normalising correctly --- diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index d83f138..5ea892b 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -915,19 +915,27 @@ public class AAFrequency profile[0] = AlignmentAnnotation.SEQUENCE_PROFILE; profile[1] = size; - profile[2] = totalCount / 100; + profile[2] = 100; if (totalCount != 0) { int arrayPos = 3; for (int k = size - 1; k >= 0; k--) { - Double percentage; + Float percentage; Integer value = values[k]; - percentage = (value.doubleValue() / totalCount.doubleValue()) - * 100d; + if (removeBelowBackground) + { + percentage = (value.floatValue() / totalCount.floatValue()) + * 100; + } + else + { + percentage = value.floatValue() / 100f; + } + int intPercent = Math.round(percentage); profile[arrayPos] = symbols[k]; - profile[arrayPos + 1] = percentage.intValue(); + profile[arrayPos + 1] = intPercent; arrayPos += 2; } } @@ -969,6 +977,6 @@ public class AAFrequency } } value = value * 10000; - return value.intValue(); + return Math.round(value.floatValue()); } }