From Genome Analysis Wiki
Jump to navigationJump to search
17 bytes removed
, 15:13, 28 June 2016
Line 55: |
Line 55: |
| = 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> bcf_ip2g(int32_t genotype_index, uint32_t no_ploidy) |
− | { | + | { |
| std::vector<int32_t> genotype(no_ploidy, 0); | | std::vector<int32_t> genotype(no_ploidy, 0); |
− |
| |
| int32_t pth = no_ploidy; | | int32_t pth = no_ploidy; |
| int32_t max_allele_index = genotype_index; | | int32_t max_allele_index = genotype_index; |
| int32_t leftover_genotype_index = genotype_index; | | int32_t leftover_genotype_index = genotype_index; |
− |
| |
− | int d = 0;
| |
| while (pth>0) | | while (pth>0) |
| { | | { |
Line 69: |
Line 66: |
| { | | { |
| int32_t i = choose(pth+allele_index-1, pth); | | int32_t i = choose(pth+allele_index-1, pth); |
− |
| |
− |
| |
| if (i>=leftover_genotype_index) | | if (i>=leftover_genotype_index) |
| { | | { |
Line 85: |
Line 80: |
| | | |
| return genotype; | | return genotype; |
− | } | + | } |
| | | |
| = Simple cases = | | = Simple cases = |