From 717094c2f47a3679be4acaf2d0c0cd30c83c2a82 Mon Sep 17 00:00:00 2001 From: TZVanaalten Date: Wed, 2 Aug 2017 13:06:43 +0100 Subject: [PATCH] JAL-2599 fix for HMM logo not normalising correctly --- src/jalview/analysis/AAFrequency.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) 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()); } } -- 1.7.10.2