JAL-1551 spotlessApply
[jalview.git] / src / jalview / analysis / AlignmentUtils.java
index a1a7fef..201f88b 100644 (file)
@@ -1471,8 +1471,19 @@ public class AlignmentUtils
          */
         final Iterable<AlignmentAnnotation> matchedAlignmentAnnotations = al
                 .findAnnotations(seq, dsann.getCalcId(), dsann.label);
-        if (matchedAlignmentAnnotations == null
-                || !matchedAlignmentAnnotations.iterator().hasNext())
+        boolean found = false;
+        if (matchedAlignmentAnnotations != null)
+        {
+          for (AlignmentAnnotation matched : matchedAlignmentAnnotations)
+          {
+            if (dsann.description.equals(matched.description))
+            {
+              found = true;
+              break;
+            }
+          }
+        }
+        if (!found)
         {
           result.add(dsann);
           if (labelForCalcId != null)
@@ -1581,6 +1592,21 @@ public class AlignmentUtils
     }
   }
 
+  public static AlignmentAnnotation getFirstSequenceAnnotationOfType(
+          AlignmentI al, int graphType)
+  {
+    AlignmentAnnotation[] anns = al.getAlignmentAnnotation();
+    if (anns != null)
+    {
+      for (AlignmentAnnotation aa : anns)
+      {
+        if (aa.sequenceRef != null && aa.graph == graphType)
+          return aa;
+      }
+    }
+    return null;
+  }
+
   /**
    * Returns true if either sequence has a cross-reference to the other
    *