return;
}
}
-
+ sg.setContext(this);
groups.add(sg);
}
}
{
removeAnnotationForGroup(null);
}
+ for (SequenceGroup sg:groups) {
+ sg.setContext(null);
+ }
groups.clear();
}
}
{
removeAnnotationForGroup(g);
groups.remove(g);
+ g.setContext(null);
}
}
}
{
return 0;
}
+
+/* In the case of AlignmentI - returns the dataset for the alignment, if set
+ * (non-Javadoc)
+ * @see jalview.datamodel.AnnotatedCollectionI#getContext()
+ */
+@Override
+public AnnotatedCollectionI getContext()
+{
+ return dataset;
+}
}
Iterable<AlignmentAnnotation> findAnnotation(String calcId);
+ /**
+ * context for this annotated collection
+ * @return null or the collection upon which this collection is defined (e.g. alignment, parent group).
+ */
+ AnnotatedCollectionI getContext();
}
{
return;
}
- if (cs != null)
- {
- cs.alignmentChanged(this, null);
- }
try
{
Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes,
if (cs != null)
{
cs.setConsensus(cnsns);
- cs.alignmentChanged(this, null);
}
if ((conservation != null)
if (cs.conservationApplied())
{
cs.setConservation(c);
- cs.alignmentChanged(this, null);
}
}
}
+ if (cs != null)
+ {
+ cs.alignmentChanged(context!=null ? context : this, null);
+ }
} catch (java.lang.OutOfMemoryError err)
{
// TODO: catch OOM
{
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;
+ }
}
package jalview.schemes;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.GraphLine;
import jalview.datamodel.SequenceCollectionI;
{
seqannot = new IdentityHashMap<SequenceI, AlignmentAnnotation>();
}
- for (AlignmentAnnotation alan : alignment.findAnnotation(annotation
+ // resolve the context containing all the annotation for the sequence
+ AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment : alignment.getContext();
+ for (AlignmentAnnotation alan : alcontext.findAnnotation(annotation
.getCalcId()))
{
if (alan.sequenceRef != null
// Search alignment to get all tcoffee annotation and pick one set of
// annotation to use to colour seqs.
seqMap = new IdentityHashMap<SequenceI, Color[]>();
+ AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment : alignment.getContext();
int w = 0;
- for (AlignmentAnnotation al : alignment
+ for (AlignmentAnnotation al : alcontext
.findAnnotation(TCoffeeScoreFile.TCOFFEE_SCORE))
{
if (al.sequenceRef != null && !al.belowAlignment)