get consensus sequence and set ignore gaps flag for group consensus row
authorjprocter <Jim Procter>
Fri, 24 Jul 2009 15:25:40 +0000 (15:25 +0000)
committerjprocter <Jim Procter>
Fri, 24 Jul 2009 15:25:40 +0000 (15:25 +0000)
src/jalview/gui/AnnotationLabels.java

index bed71d3..0e766c4 100755 (executable)
@@ -214,7 +214,13 @@ public class AnnotationLabels extends JPanel implements MouseListener,
     }
     else if (evt.getActionCommand().equals(COPYCONS_SEQ))
     {
-      SequenceI cons = av.getConsensusSeq();
+      SequenceI cons = null;
+      if (aa[selectedRow].groupRef!=null)
+      {
+        cons = aa[selectedRow].groupRef.getConsensusSeq();
+      } else {
+        cons = av.getConsensusSeq();
+      }
       if (cons != null)
       {
         copy_annotseqtoclipboard(cons);
@@ -449,16 +455,22 @@ public class AnnotationLabels extends JPanel implements MouseListener,
     item = new JMenuItem(OUTPUT_TEXT);
     item.addActionListener(this);
     pop.add(item);
-    // annotation object should be typed
-    if (selectedRow < aa.length && aa[selectedRow] == ap.av.consensus)
+    // TODO: annotation object should be typed for autocalculated/derived property methods
+    if (selectedRow < aa.length && aa[selectedRow].autoCalculated && aa[selectedRow].label.indexOf("Consensus")>-1)
     {
       pop.addSeparator();
+      // av and sequencegroup need to implement same interface for 
       final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
               "Ignore Gaps In Consensus", ap.av.getIgnoreGapsConsensus());
+      final AlignmentAnnotation aaa = aa[selectedRow];
       cbmi.addActionListener(new ActionListener()
       {
         public void actionPerformed(ActionEvent e)
         {
+          if (aaa.groupRef!=null)
+          {
+            aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
+          }
           ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
         }
       });