JAL-1551 spotlessApply
[jalview.git] / src / jalview / analysis / AlignmentUtils.java
index 42c4b76..201f88b 100644 (file)
@@ -184,10 +184,10 @@ public class AlignmentUtils
       // TODO use Character.toLowerCase to avoid creating String objects?
       char[] upstream = new String(ds
               .getSequence(s.getStart() - 1 - ustream_ds, s.getStart() - 1))
-              .toLowerCase(Locale.ROOT).toCharArray();
+                      .toLowerCase(Locale.ROOT).toCharArray();
       char[] downstream = new String(
               ds.getSequence(s_end - 1, s_end + dstream_ds))
-              .toLowerCase(Locale.ROOT).toCharArray();
+                      .toLowerCase(Locale.ROOT).toCharArray();
       char[] coreseq = s.getSequence();
       char[] nseq = new char[offset + upstream.length + downstream.length
               + coreseq.length];
@@ -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)