JAL-4411 store class of provider in PDBEntry
[jalview.git] / src / jalview / renderer / AnnotationRenderer.java
index cba36d2..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;
@@ -175,7 +178,6 @@ public class AnnotationRenderer
           int x, int y, int iconOffset, int startRes, int column,
           boolean validRes, boolean validEnd)
   {
-    g.setColor(STEM_COLOUR);
     int sCol = (lastSSX / charWidth)
             + hiddenColumns.visibleToAbsoluteColumn(startRes);
     int x1 = lastSSX;
@@ -185,11 +187,19 @@ public class AnnotationRenderer
             : row_annotations[column - 1].secondaryStructure;
 
     boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
-            || dc != row_annotations[sCol - 1].secondaryStructure || !validEnd;
+            || dc != row_annotations[sCol - 1].secondaryStructure
+            || !validEnd;
     boolean diffdownstream = !validRes || !validEnd
             || row_annotations[column] == null
             || dc != row_annotations[column].secondaryStructure;
 
+    if (diffupstream || diffdownstream)
+    {
+      // draw glyphline under arrow
+      drawGlyphLine(g, lastSSX, x, y, iconOffset);
+    }
+    g.setColor(STEM_COLOUR);
+
     if (column > 0 && Rna.isClosingParenthesis(dc))
     {
       if (diffupstream)
@@ -202,7 +212,8 @@ public class AnnotationRenderer
          */
         fillPolygon(g, new int[] { lastSSX + 5, lastSSX + 5, lastSSX },
                 new int[]
-                { y + iconOffset, y + 13 + iconOffset, y + 7 + iconOffset },
+                { y + iconOffset + 1, y + 13 + iconOffset,
+                    y + 7 + iconOffset },
                 3);
         x1 += 5;
       }
@@ -220,9 +231,10 @@ public class AnnotationRenderer
          * if annotation ending with an opeing base pair half of the stem, 
          * display a forward arrow
          */
-        fillPolygon(g, new int[] { x2 - 5, x2 - 5, x2 },
+        fillPolygon(g, new int[] { x2 - 6, x2 - 6, x2 - 1 },
                 new int[]
-                { y + iconOffset, y + 13 + iconOffset, y + 7 + iconOffset },
+                { y + iconOffset + 1, y + 13 + iconOffset,
+                    y + 7 + iconOffset },
                 3);
         x2 -= 5;
       }
@@ -232,6 +244,7 @@ public class AnnotationRenderer
       }
     }
     // draw arrow body
+    unsetAntialias(g);
     fillRect(g, x1, y + 4 + iconOffset, x2 - x1, 6);
   }
 
@@ -251,7 +264,8 @@ public class AnnotationRenderer
             : row_annotations[column - 1].displayCharacter;
 
     boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
-            || !dc.equals(row_annotations[sCol - 1].displayCharacter) || !validEnd;
+            || !dc.equals(row_annotations[sCol - 1].displayCharacter)
+            || !validEnd;
     boolean diffdownstream = !validRes || !validEnd
             || row_annotations[column] == null
             || !dc.equals(row_annotations[column].displayCharacter);
@@ -366,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();
@@ -414,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"))
@@ -503,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
@@ -529,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;
@@ -1267,7 +1293,6 @@ public class AnnotationRenderer
       }
       else
       {
-        // g.setColor(Color.orange);
         fillRoundRect(g, lastSSX, y + 3 + iconOffset, x2 - x1 - ofs, 8, 0,
                 0);
       }
@@ -1278,7 +1303,6 @@ public class AnnotationRenderer
       }
       else
       {
-        // g.setColor(Color.magenta);
         fillRoundRect(g, lastSSX + ofs, y + 3 + iconOffset, x2 - x1 - ofs,
                 8, 0, 0);
       }
@@ -1510,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)
@@ -1593,7 +1619,9 @@ public class AnnotationRenderer
             }
             else
             {
+              
               colour = profcolour.findColour(dc[0], column, null);
+
             }
             g.setColor(colour == Color.white ? Color.lightGray : colour);