JAL-4392 don't show SS consensus for DNA alignments
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 16 Sep 2024 14:39:34 +0000 (15:39 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 16 Sep 2024 14:39:34 +0000 (15:39 +0100)
src/jalview/viewmodel/AlignmentViewport.java

index ce4473b..f4201c1 100644 (file)
@@ -2036,6 +2036,7 @@ public abstract class AlignmentViewport
       {
         initConservation();
         initQuality();
+        initSSConsensus();
       }
       else
       {
@@ -2045,13 +2046,8 @@ public abstract class AlignmentViewport
               MessageManager.getString("label.consensus_descr"),
               new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
 
-      secondaryStructureConsensus = new AlignmentAnnotation(
-              MessageManager.getString("label.ssconsensus_label"),
-              MessageManager.getString("label.ssconsensus_descr"),
-              new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
 
       initConsensus(consensus);
-      initSSConsensus(secondaryStructureConsensus);
       initGapCounts();
       initComplementConsensus();
     }
@@ -2108,14 +2104,21 @@ public abstract class AlignmentViewport
     }
   }
 
-  private void initSSConsensus(AlignmentAnnotation aa)
+  private void initSSConsensus()
   {
-    aa.hasText = true;
-    aa.autoCalculated = true;
-
-    if (showSSConsensus)
+    if (!alignment.isNucleotide() && showSSConsensus)
     {
-      alignment.addAnnotation(aa);
+      if (secondaryStructureConsensus == null)
+      {
+        secondaryStructureConsensus = new AlignmentAnnotation(
+                MessageManager.getString("label.ssconsensus_label"),
+                MessageManager.getString("label.ssconsensus_descr"),
+                new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
+
+        secondaryStructureConsensus.hasText = true;
+        secondaryStructureConsensus.autoCalculated = true;
+      }
+      alignment.addAnnotation(secondaryStructureConsensus);
     }
   }