1,102
edits
Changes
From Genome Analysis Wiki
→Getting the genotypes from a genotype index and a given ploidy
= Getting the genotypes from a genotype index and a given ploidy =
std::vector<int32_t> bcf_ip2g(int32_t genotype_index, uint32_t no_ploidy) {
std::vector<int32_t> genotype(no_ploidy, 0);
int32_t pth = no_ploidy;
int32_t max_allele_index = genotype_index;
int32_t leftover_genotype_index = genotype_index;
while (pth>0)
{
{
int32_t i = choose(pth+allele_index-1, pth);
if (i>=leftover_genotype_index)
{
return genotype;
}
= Simple cases =