JAL-2599 corrected case-insensitive symbol indexing
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 23 Feb 2018 16:12:16 +0000 (16:12 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 23 Feb 2018 16:12:16 +0000 (16:12 +0000)
src/jalview/datamodel/HiddenMarkovModel.java
test/jalview/datamodel/HiddenMarkovModelTest.java

index 36d32ed..c6545e2 100644 (file)
@@ -676,7 +676,7 @@ public class HiddenMarkovModel
     char c = Character.toUpperCase(symbol);
     if ('A' <= c && c <= 'Z')
     {
-      return symbolIndexLookup[symbol - 'A'];
+      return symbolIndexLookup[c - 'A'];
     }
     return -1;
   }
index d13b0bc..872aebf 100644 (file)
@@ -59,6 +59,8 @@ public class HiddenMarkovModelTest {
   {
     double iep = hmm.getInsertEmissionProbability(2, 'A');
     assertEquals(iep, Math.pow(Math.E, -2.68618), 0.0001d);
+    // symbol is not case-sensitive
+    assertEquals(iep, hmm.getInsertEmissionProbability(2, 'a'));
 
     iep = hmm.getInsertEmissionProbability(5, 'T');
     assertEquals(iep, Math.pow(Math.E, -2.77519), 0.0001d);