ensure that only annotation referenced in given alignment is duplicated on returned...
authorjprocter <Jim Procter>
Thu, 10 May 2007 08:42:35 +0000 (08:42 +0000)
committerjprocter <Jim Procter>
Thu, 10 May 2007 08:42:35 +0000 (08:42 +0000)
src/jalview/datamodel/SequenceGroup.java

index 18fb53b..cdc6fed 100755 (executable)
@@ -111,8 +111,25 @@ public class SequenceGroup
 
         if (seq.getAnnotation() != null)
         {
+          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);