private static GenotypeLikelihoodsAllelePair[] calculatePLcache(int altAlleles) { int numLikelihoods = GenotypeLikelihoods.numLikelihoods(1 + altAlleles, 2); GenotypeLikelihoodsAllelePair[] cache = new GenotypeLikelihoodsAllelePair[numLikelihoods]; // for all possible combinations of 2 alleles for (int allele1 = 0; allele1 <= altAlleles; allele1++) { for (int allele2 = allele1; allele2 <= altAlleles; allele2++) { cache[calculatePLindex(allele1, allele2)] = new GenotypeLikelihoodsAllelePair(allele1, allele2); } } // a bit of sanity checking for (int i = 0; i < cache.Length; i++) { if (cache[i] == null) { throw new Exception("BUG: cache entry " + i + " is unexpected null"); } } return(cache); }
private static GenotypeLikelihoodsAllelePair[] calculatePLcache(int altAlleles) { int numLikelihoods = GenotypeLikelihoods.numLikelihoods(1 + altAlleles, 2); GenotypeLikelihoodsAllelePair[] cache = new GenotypeLikelihoodsAllelePair[numLikelihoods]; // for all possible combinations of 2 alleles for (int allele1 = 0; allele1 <= altAlleles; allele1++) { for (int allele2 = allele1; allele2 <= altAlleles; allele2++) { cache[calculatePLindex(allele1, allele2)] = new GenotypeLikelihoodsAllelePair(allele1, allele2); } } // a bit of sanity checking for (int i = 0; i < cache.Length; i++) { if (cache[i] == null) { throw new Exception("BUG: cache entry " + i + " is unexpected null"); } } return cache; }