private int allele(BitSet bits, int bitsPerAllele, int sample) { if (sample >= samples.nSamples()) { throw new IndexOutOfBoundsException(String.valueOf(sample)); } int start = bitsPerAllele * sample; int end = start + bitsPerAllele; int allele = 0; int mask = 1; for (int j = start; j < end; ++j) { if (bits.get(j)) { allele += mask; } mask <<= 1; } return allele; }
@Override public int nHapPairs() { return samples.nSamples(); }
@Override public int nHaps() { return 2 * samples.nSamples(); }