final int ploidy = g.getPloidy();
final GenotypeLikelihoodCalculator calculator = GenotypeLikelihoodCalculators.getInstance(ploidy, numberOfAlleles);
final GenotypeAlleleCounts genotypeAlleleCounts = calculator.genotypeAlleleCountsAt(bestLikelihoodIndex);
final int[] AC = new int[numberOfAlleles - 1];
final double[] AF = new double[numberOfAlleles - 1];
final int allelesPresentCount = genotypeAlleleCounts.distinctAlleleCount();
for (int i = 0; i < allelesPresentCount; i++) {
final int alleleIndex = genotypeAlleleCounts.alleleIndexAt(i);
if (alleleIndex == 0) continue; // skip the reference allele.
final int alleleCount = genotypeAlleleCounts.alleleCountAt(i);
AC[alleleIndex - 1] = alleleCount;