X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAAFrequency.java;h=fb495419d2573bbf56ade3e0c21ca46c42ad933e;hb=37de9310bec3501cbc6381e0c3dcb282fcaad812;hp=3a7995913b3110ae210806a277d9a3250c3fe82a;hpb=17e77c3f2949a0729322b4a8d907f3f34b6a9914;p=jalview.git diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index 3a79959..fb49541 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9) - * Copyright (C) 2015 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -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 mappings = alignment.getCodonFrames(); + List 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 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; @@ -621,8 +624,11 @@ public class AAFrequency String modalCodon = String.valueOf(CodingUtils .decodeCodon(modalCodonEncoded)); if (sortedCodonCounts.length > 1 - && sortedCodonCounts[codons.length - 2] == modalCodonEncoded) + && sortedCodonCounts[codons.length - 2] == sortedCodonCounts[codons.length - 1]) { + /* + * two or more codons share the modal count + */ modalCodon = "+"; } float pid = sortedCodonCounts[sortedCodonCounts.length - 1] * 100