From: gmungoc Date: Thu, 26 May 2016 09:52:38 +0000 (+0100) Subject: JAL-1797 non-case-sensitive counting of residues / gaps X-Git-Tag: Release_2_10_0~212^2~4^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=15d61556bb004b6f5707523942a1ef5d93ec416d;p=jalview.git JAL-1797 non-case-sensitive counting of residues / gaps --- 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