complete Information Content annotation
[jalview.git] / src / jalview / datamodel / HiddenMarkovModel.java
index 7c8d075..bcfa1c9 100644 (file)
@@ -36,6 +36,8 @@ public class HiddenMarkovModel
 
   Map<Character, Double> backgroundFrequencies = new HashMap();
 
+  ProfilesI profiles;
+
 
   final static String YES = "yes";
 
@@ -385,7 +387,7 @@ public class HiddenMarkovModel
    return value;
   }
   
-  public char getConsensus(int columnIndex)
+  public char getConsensusAtAlignColumn(int columnIndex)
   {
     char value;
     Integer index = findNodeIndex(columnIndex + 1);
@@ -771,16 +773,23 @@ public class HiddenMarkovModel
   {
     Annotation[] annotations = new Annotation[length];
     float max = 0f;
-    for (int i = 0; i < length; i++)
+    for (int alignPos = 0; alignPos < length; alignPos++)
     {
-      Float content = getInformationContent(i);
+      Float content = getInformationContent(alignPos);
       if (content > max)
       {
         max = content;
       }
+
+      Character cons;
+      cons = getConsensusAtAlignColumn(alignPos);
+      cons = Character.toUpperCase(cons);
+
       String description = String.format("%.3f", content);
       description += " bits";
-      annotations[i] = new Annotation(null, description, ' ', content);
+      annotations[alignPos] = new Annotation(cons.toString(), description,
+              ' ',
+              content);
 
     }
     AlignmentAnnotation annotation = new AlignmentAnnotation(
@@ -815,5 +824,6 @@ public class HiddenMarkovModel
 
     return informationContent;
   }
+
 }