diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/graphs/KBestHaplotypeFinder.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/graphs/KBestHaplotypeFinder.java index 9048046fe..16546b39c 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/graphs/KBestHaplotypeFinder.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/graphs/KBestHaplotypeFinder.java @@ -90,7 +90,7 @@ public class KBestHaplotypeFinder extends AbstractList implement /** * The top finder. * - *

If there is only a single source vertex, its finder is the top finder. However whent there + *

If there is only a single source vertex, its finder is the top finder. However when there * is more than one possible source, we create a composite finder that alternates between individual source vertices * for their best haplotypes.

*/ @@ -472,44 +472,18 @@ public class KBestHaplotypeFinder extends AbstractList implement * The resulting list is sorted by the score with more likely haplotype search results first. *

* - * @param maxSize maximum number of unique results to return. - * - * @throws IllegalArgumentException if {@code maxSize} is negative. - * - * @return never {@code null}, perhaps an empty list. - */ - public List unique(final int maxSize) { - if (maxSize < 0) throw new IllegalArgumentException("maxSize cannot be negative"); - final int requiredCapacity = Math.min(maxSize,size()); - final Set haplotypes = new HashSet<>(requiredCapacity); - int resultSize = 0; - final List result = new ArrayList<>(requiredCapacity); - for (final KBestHaplotype kbh : this) { - if (haplotypes.add(kbh.haplotype())) { - result.add(kbh); - if (resultSize == maxSize) break; - } - } - return result; - } - - /** - * Returns a unique list of haplotypes solutions. - * - *

- * The result will not contain more than one haplotype with the same base sequence. The solution of the best - * score is returned. - *

- *

- * This makes sense when there are more than one possible path through the graph to create the same haplotype. - *

- *

- * The resulting list is sorted by the score with more likely haplotype search results first. - *

* * @return never {@code null}, perhaps an empty list. */ public List unique() { - return unique(size()); + final int requiredCapacity = size(); + final Set haplotypes = new HashSet<>(requiredCapacity); + final List result = new ArrayList<>(requiredCapacity); + for (final KBestHaplotype kbh : this) { + if (haplotypes.add(kbh.haplotype())) { + result.add(kbh); + } + } + return result; } }