From 15d61556bb004b6f5707523942a1ef5d93ec416d Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 26 May 2016 10:52:38 +0100 Subject: [PATCH] JAL-1797 non-case-sensitive counting of residues / gaps --- src/jalview/analysis/Conservation.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index d4ae57d..7b3ce25 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -235,10 +235,7 @@ public class Conservation c = '-'; } - if (!canonicaliseAa && 'a' <= c && c <= 'z') - { - c -= (32); // 32 = 'a' - 'A' - } + c = toUpperCase(c); } values[c]++; } @@ -326,6 +323,7 @@ public class Conservation } else { + c = toUpperCase(c); nres++; if (nres == 1) @@ -347,6 +345,22 @@ public class Conservation } /** + * Returns the upper-cased character if between 'a' and 'z', else the + * unchanged value + * + * @param c + * @return + */ + char toUpperCase(char c) + { + if ('a' <= c && c <= 'z') + { + c -= (32); // 32 = 'a' - 'A' + } + return c; + } + + /** * Calculates the conservation sequence * * @param consflag -- 1.7.10.2