JAL-4392 Merging consensus secondary structure
[jalview.git] / src / jalview / renderer / AnnotationRenderer.java
index b5dac0d..015db5c 100644 (file)
@@ -88,6 +88,8 @@ public class AnnotationRenderer
   private HiddenColumns hiddenColumns;
 
   private ProfilesI hconsensus;
+  
+  private ProfilesI hSSconsensus;
 
   private Hashtable<String, Object>[] complementConsensus;
 
@@ -164,6 +166,7 @@ public class AnnotationRenderer
   {
     hiddenColumns = null;
     hconsensus = null;
+    hSSconsensus = null;
     complementConsensus = null;
     hStrucConsensus = null;
     fadedImage = null;
@@ -377,6 +380,7 @@ public class AnnotationRenderer
     columnSelection = av.getColumnSelection();
     hiddenColumns = av.getAlignment().getHiddenColumns();
     hconsensus = av.getSequenceConsensusHash();
+    hSSconsensus = av.getSequenceSSConsensusHash();
     complementConsensus = av.getComplementConsensusHash();
     hStrucConsensus = av.getRnaStructureConsensusHash();
     av_ignoreGapsConsensus = av.isIgnoreGapsConsensus();
@@ -425,6 +429,15 @@ public class AnnotationRenderer
         }
       }
     }
+    
+    else if(aa.autoCalculated && aa.label.startsWith("SecondaryStructureConsensus")) 
+    {
+      return AAFrequency.extractProfile(
+              hSSconsensus.get(column),
+              av_ignoreGapsConsensus);
+      
+    }
+    
     else
     {
       if (aa.autoCalculated && aa.label.startsWith("StrucConsensus"))
@@ -514,6 +527,8 @@ public class AnnotationRenderer
             .getAlignmentStrucConsensusAnnotation();
     final AlignmentAnnotation complementConsensusAnnot = av
             .getComplementConsensusAnnotation();
+    final AlignmentAnnotation ssConsensusAnnot = av
+            .getAlignmentSecondaryStructureConsensusAnnotation();
 
     BitSet graphGroupDrawn = new BitSet();
     int charOffset = 0; // offset for a label
@@ -540,7 +555,7 @@ public class AnnotationRenderer
         normaliseProfile = row.groupRef.isNormaliseSequenceLogo();
       }
       else if (row == consensusAnnot || row == structConsensusAnnot
-              || row == complementConsensusAnnot)
+              || row == complementConsensusAnnot || row == ssConsensusAnnot)
       {
         renderHistogram = av_renderHistogram;
         renderProfile = av_renderProfile;
@@ -1519,6 +1534,8 @@ public class AnnotationRenderer
          * {profile type, #values, total count, char1, pct1, char2, pct2...}
          */
         int profl[] = getProfileFor(_aa, column);
+        
+        
 
         // just try to draw the logo if profl is not null
         if (profl != null && profl[2] != 0)
@@ -1602,7 +1619,9 @@ public class AnnotationRenderer
             }
             else
             {
+              
               colour = profcolour.findColour(dc[0], column, null);
+
             }
             g.setColor(colour == Color.white ? Color.lightGray : colour);