/**
* Adds annotations to the top of the alignment annotations, in the same order
- * as their related sequences.
+ * as their related sequences. If you already have an annotation and want to add it to a sequence in an alignment use {@code addReferenceAnnotationTo}
*
* @param annotations
* the annotations to add
{
for (AlignmentAnnotation ann : annotations.get(seq))
{
+ addReferenceAnnotationTo(alignment, seq,ann,selectionGroup);
+ }
+ }
+ }
+ /**
+ * Make a copy of a reference annotation {@code ann} and add it to an alignment sequence {@code seq} in {@code alignment}, optionally limited to the extent of {@code selectionGroup}
+ * @param alignment
+ * @param seq
+ * @param ann
+ * @param selectionGroup - may be null
+ * @return annotation added to {@code seq and {@code alignment}
+ */
+ public static AlignmentAnnotation addReferenceAnnotationTo(final AlignmentI alignment, final SequenceI seq,final AlignmentAnnotation ann,final SequenceGroup selectionGroup)
+ {
AlignmentAnnotation copyAnn = new AlignmentAnnotation(ann);
int startRes = 0;
int endRes = ann.annotations.length;
// add to the alignment and set visible
alignment.addAnnotation(copyAnn);
copyAnn.visible = true;
- }
- }
-
+
+ return copyAnn;
}
/**