- AlignmentAnnotation newannot = new AlignmentAnnotation(seq.getAnnotation()[a]);
- newannot.restrict(startRes, endRes);
- newannot.setSequenceRef(seqs[i]);
- newannot.adjustForAlignment();
- seqs[i].addAlignmentAnnotation(newannot);
+ AlignmentAnnotation[] alann = align.getAlignmentAnnotation();
+ // Only copy annotation that is either a score or referenced by the alignment's annotation vector
+ for (int a = 0; a < seq.getAnnotation().length; a++)
+ {
+ AlignmentAnnotation tocopy = seq.getAnnotation()[a];
+ if (alann!=null)
+ {
+ boolean found=false;
+ for (int pos=0;pos<alann.length; pos++)
+ {
+ if (alann[pos]==tocopy)
+ {
+ found=true;
+ break;
+ }
+ }
+ if (!found)
+ continue;
+ }
+ AlignmentAnnotation newannot = new AlignmentAnnotation(seq
+ .getAnnotation()[a]);
+ newannot.restrict(startRes, endRes);
+ newannot.setSequenceRef(seqs[ipos]);
+ newannot.adjustForAlignment();
+ seqs[ipos].addAlignmentAnnotation(newannot);
+ }