JAL-3202 discard zero percentages in extracted profile
[jalview.git] / src / jalview / renderer / AnnotationRenderer.java
index ed266ae..17bc6df 100644 (file)
@@ -470,8 +470,10 @@ public class AnnotationRenderer
             .getAlignmentStrucConsensusAnnotation();
     final AlignmentAnnotation complementConsensusAnnot = av
             .getComplementConsensusAnnotation();
-    boolean renderHistogram = true, renderProfile = true,
-            normaliseProfile = false, isRNA = rna;
+    boolean renderHistogram = true;
+    boolean renderProfile = false;
+    boolean normaliseProfile = false;
+    boolean isRNA = rna;
 
     BitSet graphGroupDrawn = new BitSet();
     int charOffset = 0; // offset for a label
@@ -1448,7 +1450,13 @@ public class AnnotationRenderer
             }
             // next profl[] position is profile % for the character(s)
             
-            double newHeight = normaliseFactor * scale * profl[c++];
+            int percent = profl[c++];
+            if (percent == 0)
+            {
+              // failsafe in case a count rounds down to 0%
+              continue;
+            }
+            double newHeight = normaliseFactor * scale * percent;
 
             /*
              * Set character colour as per alignment colour scheme; use the