@Override public float gl(int sample, int allele1, int allele2) { if (allele1 < 0 || allele1 >= marker.nAlleles()) { throw new IndexOutOfBoundsException(String.valueOf(allele1)); } if (allele2 < 0 || allele2 >= marker.nAlleles()) { throw new IndexOutOfBoundsException(String.valueOf(allele2)); } boolean matches = (allele1 == allele1(sample) && allele2 == allele2(sample)); return matches ? 1.0f : 0.0f; }
private static int bitsPerAllele(Marker marker) { int nAllelesM1 = marker.nAlleles() - 1; int nStorageBits = Integer.SIZE - Integer.numberOfLeadingZeros(nAllelesM1); return nStorageBits; }