Merge branch 'develop' into features/mchmmer
[jalview.git] / src / jalview / renderer / AnnotationRenderer.java
index 8a80d41..ed67aa6 100644 (file)
@@ -29,6 +29,7 @@ import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.HiddenMarkovModel;
 import jalview.datamodel.ProfilesI;
 import jalview.schemes.ColourSchemeI;
 import jalview.schemes.NucleotideColourScheme;
@@ -73,6 +74,9 @@ public class AnnotationRenderer
   boolean av_renderHistogram = true, av_renderProfile = true,
           av_normaliseProfile = false;
 
+  boolean av_renderInformationHistogram = true, av_renderHMMProfile = true,
+          av_normaliseHMMProfile = false, av_infoHeight = false;
+
   ResidueShaderI profcolour = null;
 
   private ColumnSelection columnSelection;
@@ -87,6 +91,8 @@ public class AnnotationRenderer
 
   private boolean av_ignoreGapsConsensus;
 
+  private boolean av_ignoreBelowBackground;
+
   /**
    * attributes set from AwtRenderPanelI
    */
@@ -326,6 +332,9 @@ public class AnnotationRenderer
     av_renderHistogram = av.isShowConsensusHistogram();
     av_renderProfile = av.isShowSequenceLogo();
     av_normaliseProfile = av.isNormaliseSequenceLogo();
+    av_renderInformationHistogram = av.isShowInformationHistogram();
+    av_renderHMMProfile = av.isShowHMMSequenceLogo();
+    av_normaliseHMMProfile = av.isNormaliseHMMSequenceLogo();
     profcolour = av.getResidueShading();
     if (profcolour == null || profcolour.getColourScheme() == null)
     {
@@ -345,8 +354,12 @@ public class AnnotationRenderer
     complementConsensus = av.getComplementConsensusHash();
     hStrucConsensus = av.getRnaStructureConsensusHash();
     av_ignoreGapsConsensus = av.isIgnoreGapsConsensus();
+    av_ignoreBelowBackground = av.isIgnoreBelowBackground();
+    av_infoHeight = av.isInfoLetterHeight();
   }
 
+
+
   /**
    * Returns profile data; the first element is the profile type, the second is
    * the number of distinct values, the third the total count, and the remainder
@@ -362,8 +375,16 @@ public class AnnotationRenderer
     // properties/rendering attributes as a global 'alignment group' which holds
     // all vis settings for the alignment as a whole rather than a subset
     //
-    if (aa.autoCalculated && (aa.label.startsWith("Consensus")
-            || aa.label.startsWith("cDNA Consensus")))
+    if ("HMM".equals(aa.getCalcId()))
+    {
+      HiddenMarkovModel hmm = aa.sequenceRef.getHMM();
+      return AAFrequency.extractHMMProfile(hmm, column,
+              av_ignoreBelowBackground, av_infoHeight); // TODO check if this follows standard
+                                         // pipeline
+    }
+    if (aa.autoCalculated
+            && (aa.label.startsWith("Consensus") || aa.label
+                    .startsWith("cDNA Consensus")))
     {
       boolean forComplement = aa.label.startsWith("cDNA Consensus");
       if (aa.groupRef != null && aa.groupRef.consensusData != null
@@ -505,6 +526,12 @@ public class AnnotationRenderer
           renderProfile = av_renderProfile;
           normaliseProfile = av_normaliseProfile;
         }
+        else if ("HMM".equals(row.getCalcId()))
+        {
+          renderHistogram = av_renderInformationHistogram;
+          renderProfile = av_renderHMMProfile;
+          normaliseProfile = av_normaliseHMMProfile;
+        }
         else
         {
           renderHistogram = true;