JAL-891; sequence logos are available on structure conservation row
[jalview.git] / src / jalview / gui / AnnotationPanel.java
index 827540a..e42264d 100755 (executable)
@@ -29,6 +29,7 @@ import javax.swing.*;
 import com.stevesoft.pat.Regex;
 
 import jalview.analysis.AAFrequency;
+import jalview.analysis.StructureFrequency;
 import jalview.datamodel.*;
 import jalview.schemes.ColourSchemeI;
 
@@ -1234,7 +1235,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
             || !dc.equals(row.annotations[sCol - 1].displayCharacter);
     boolean diffdownstream=!validRes || !validEnd || row.annotations[column] == null
             || !dc.equals(row.annotations[column].displayCharacter);
-    System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
+    //System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
     // If a closing base pair half of the stem, display a backward arrow
     if (column > 0
             && closeparen
@@ -1536,6 +1537,12 @@ public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
       if (renderProfile && aa.annotations[column].value != 0)
       {
         int profl[] = getProfileFor(aa, column);
+        /*if(profl != null){
+               for(int i=0; i<profl.length;i++){
+                       System.out.print(profl[i]+",");
+               }
+               System.out.print("drawProfile\n");
+        }*/
         int ht = y1, htn = y2 - y1;// aa.graphHeight;
         float wdth;
         double ht2 = 0;
@@ -1569,6 +1576,7 @@ public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
                                                       // group(aa.groupRef.cs==null)
                                                       // ? av.textColour2 :
                                                       // cs.findColour(dc));
+            //System.out.println(dc[0]);
             g.drawChars(dc, 0, 1, x * av.charWidth,
                     (int) (ht + lm.getHeight()));
             // ht+=g.getFontMetrics().getAscent()-g.getFontMetrics().getDescent();
@@ -1611,6 +1619,25 @@ public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
         return AAFrequency.extractProfile(av.hconsensus[column],
                 av.getIgnoreGapsConsensus());
       }
+    }else{
+        if (aa.autoCalculated && aa.label.startsWith("StrucConsensus")){
+               if (aa.groupRef != null && aa.groupRef.consensusData != null
+                    && aa.groupRef.isShowSequenceLogo())
+            {
+              return StructureFrequency.extractProfile(
+                      aa.groupRef.consensusData[column],
+                      aa.groupRef.getIgnoreGapsConsensus());
+            }
+            // TODO extend annotation row to enable dynamic and static profile data to
+            // be stored
+            if (aa.groupRef == null && aa.sequenceRef == null
+                    && av.isShowSequenceLogo())
+            {
+              return StructureFrequency.extractProfile(av.hconsensus[column],
+                      av.getIgnoreGapsConsensus());
+            }
+        }
+
     }
     return null;
   }