+
+ /**
+ * set flag indicating if logo should be normalised when rendered
+ *
+ * @param norm
+ */
+ public void setNormaliseSequenceLogo(boolean norm)
+ {
+ normaliseSequenceLogo = norm;
+ }
+
+ public boolean isNormaliseSequenceLogo()
+ {
+ return normaliseSequenceLogo;
+ }
+
+ @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 : sequences)
+ {
+ AlignmentAnnotation[] aa = seq.getAnnotation();
+ if (aa != null)
+ {
+ for (AlignmentAnnotation al : aa)
+ {
+ 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]);
+ }
+
+ @Override
+ public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
+ {
+ ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation a : getAlignmentAnnotation())
+ {
+ if (a.getCalcId() == calcId)
+ {
+ aa.add(a);
+ }
+ }
+ return aa;
+ }
+
+ /**
+ * Returns a list of annotations that match the specified sequenceRef, calcId
+ * and label, ignoring null values.
+ *
+ * @return list of AlignmentAnnotation objects
+ */
+ @Override
+ public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
+ String calcId, String label)
+ {
+ ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation ann : getAlignmentAnnotation())
+ {
+ if (ann.getCalcId() != null && ann.getCalcId().equals(calcId)
+ && ann.sequenceRef != null && ann.sequenceRef == seq
+ && ann.label != null && ann.label.equals(label))
+ {
+ aa.add(ann);
+ }
+ }
+ return aa;
+ }
+
+ /**
+ * Answer true if any annotation matches the calcId passed in (if not null).
+ *
+ * @param calcId
+ * @return
+ */
+ public boolean hasAnnotation(String calcId)
+ {
+ if (calcId != null && !"".equals(calcId))
+ {
+ for (AlignmentAnnotation a : getAlignmentAnnotation())
+ {
+ if (a.getCalcId() == calcId)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void clear()
+ {
+ sequences.clear();
+ }
+
+ private AnnotatedCollectionI context;
+
+ /**
+ * set the alignment or group context for this group
+ *
+ * @param context
+ */
+ public void setContext(AnnotatedCollectionI context)
+ {
+ this.context = context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.datamodel.AnnotatedCollectionI#getContext()
+ */
+ @Override
+ public AnnotatedCollectionI getContext()
+ {
+ return context;
+ }