Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atks committed Mar 22, 2017
1 parent e3678c2 commit f737bbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions hts_utils.cpp
Expand Up @@ -856,7 +856,11 @@ int32_t bcf_get_format_string_ro(const bcf_hdr_t *hdr, bcf1_t *line, const char
*/
uint32_t bcf_ap2g(uint32_t no_allele, uint32_t no_ploidy)
{
if (no_ploidy==1)
if (!no_ploidy || !no_allele)
{
return 0;
}
else if (no_ploidy==1)
{
return no_allele;
}
Expand Down Expand Up @@ -941,8 +945,6 @@ std::vector<int32_t> bcf_ip2g(int32_t genotype_index, uint32_t no_ploidy)

while (pth>0)
{
int32_t old_pth = pth;

for (int32_t allele_index=0; allele_index <= max_allele_index; ++allele_index)
{
int32_t i = choose(pth+allele_index-1, pth);
Expand Down
2 changes: 1 addition & 1 deletion test.cpp
Expand Up @@ -607,7 +607,7 @@ class Igor : Program
{
for (int32_t no_ploidy=2; no_ploidy<=6; ++no_ploidy)
{
int32_t max_index = bcf_ap2g(no_allele, no_ploidy);
int32_t max_index = bcf_ap2g(no_allele, no_ploidy)-1;

for (int32_t index=0; index<=max_index; ++index)
{
Expand Down

0 comments on commit f737bbc

Please sign in to comment.