/**
* Data structure to hold and manipulate a multiple sequence alignment
*/
-public interface AlignmentI
+public interface AlignmentI extends AnnotatedCollectionI
{
/**
* Calculates the number of sequences in an alignment
--- /dev/null
+package jalview.datamodel;
+
+import java.util.List;
+
+public interface AnnotatedCollectionI
+{
+
+ /**
+ * TODO: decide if null is a valid response if there is no annotation on the object
+ * @return null
+ */
+ AlignmentAnnotation[] getAlignmentAnnotation();
+
+}
* @author $author$
* @version $Revision$
*/
-public class SequenceGroup
+public class SequenceGroup implements AnnotatedCollectionI
{
String groupName;
{
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]);
+ }
}