mungo merge
[jalview.git] / src / jalview / analysis / AAFrequency.java
index 5227795..3d61b11 100755 (executable)
@@ -32,7 +32,6 @@ import jalview.util.QuickSort;
 import java.util.Arrays;
 import java.util.Hashtable;
 import java.util.List;
-import java.util.Set;
 
 /**
  * Takes in a vector or array of sequences and column start and column end and
@@ -520,7 +519,7 @@ public class AAFrequency
           Hashtable[] hconsensus)
   {
     final char gapCharacter = alignment.getGapCharacter();
-    Set<AlignedCodonFrame> mappings = alignment.getCodonFrames();
+    List<AlignedCodonFrame> mappings = alignment.getCodonFrames();
     if (mappings == null || mappings.isEmpty())
     {
       return;
@@ -541,12 +540,16 @@ public class AAFrequency
         {
           continue;
         }
-        char[] codon = MappingUtils.findCodonFor(seq, col, mappings);
-        int codonEncoded = CodingUtils.encodeCodon(codon);
-        if (codonEncoded >= 0)
+        List<char[]> codons = MappingUtils
+                .findCodonsFor(seq, col, mappings);
+        for (char[] codon : codons)
         {
-          codonCounts[codonEncoded + 2]++;
-          ungappedCount++;
+          int codonEncoded = CodingUtils.encodeCodon(codon);
+          if (codonEncoded >= 0)
+          {
+            codonCounts[codonEncoded + 2]++;
+            ungappedCount++;
+          }
         }
       }
       codonCounts[1] = ungappedCount;