Merge branch 'test_paolo_JAL-1065' into Tcoffee_JAL-1065
[jalview.git] / src / jalview / datamodel / SequenceGroup.java
index 01bf677..b0eabff 100755 (executable)
@@ -30,7 +30,7 @@ import jalview.schemes.*;
  * @author $author$
  * @version $Revision$
  */
-public class SequenceGroup
+public class SequenceGroup implements AnnotatedCollectionI
 {
   String groupName;
 
@@ -477,7 +477,10 @@ public class SequenceGroup
     {
       return;
     }
-
+    if (cs!=null)
+    {
+      cs.alignmentChanged(this);
+    }
     try
     {
       Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes,
@@ -1167,4 +1170,33 @@ public class SequenceGroup
   {
     return showConsensusHistogram;
   }
+
+  @Override
+  /**
+   * returns a new array with all annotation involving this group
+   */
+  public AlignmentAnnotation[] getAlignmentAnnotation()
+  {
+    // TODO add in other methods like 'getAlignmentAnnotation(String label), etc'
+    ArrayList<AlignmentAnnotation> annot = new ArrayList<AlignmentAnnotation>();
+    for (SequenceI seq:(Vector<SequenceI>)sequences)
+    {
+      for (AlignmentAnnotation al: seq.getAnnotation())
+      {
+        if (al.groupRef==this)
+        {
+          annot.add(al);
+        }
+      }
+    }
+    if (consensus!=null)
+    {
+      annot.add(consensus);
+    }
+    if (conservation!=null)
+    {
+      annot.add(conservation);
+    }
+    return annot.toArray(new AlignmentAnnotation[0]);
+  }
 }