+ /*
+ * can't use Alignment.findOrCreateAnnotation here because we
+ * want to update, rather than match on, the sequence ref
+ */
+ AlignmentAnnotation info = null;
+
+ AlignmentI alignment = alignViewport.getAlignment();
+ AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation();
+ if (anns != null)
+ {
+ for (AlignmentAnnotation ann : anns)
+ {
+ if (HMM_CALC_ID.equals(ann.getCalcId()) && group == ann.groupRef)
+ {
+ info = ann;
+ info.setSequenceRef(seq);
+ info.label = seq.getName(); // in case group name changed!
+ break;
+ }
+ }
+ }
+
+ if (info == null)
+ {
+ int aWidth = alignment.getWidth();
+ String desc = MessageManager
+ .getString("label.information_description");
+ float graphMax = 6.52f; // todo where does this value derive from?
+ info = new AlignmentAnnotation(seq.getName(), desc,
+ new Annotation[aWidth], 0f, graphMax,
+ AlignmentAnnotation.BAR_GRAPH);
+ info.setCalcId(HMM_CALC_ID);
+ info.setSequenceRef(seq);
+ info.groupRef = group;
+ info.hasText = true;
+ alignment.addAnnotation(info);
+ }
+
+ return info;