X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=samtools.git;a=blobdiff_plain;f=bcftools%2Fbcf2qcall.c;h=a86bac26354a7b6da298b46477579c3d59d4d246;hp=8634c9e36e86fef665676afee9df11a46cc2cd80;hb=c34624801b980425af68c3c431423c72b18c14fe;hpb=f2f3968e11eead9ce5601b01890bc2339ff951e9 diff --git a/bcftools/bcf2qcall.c b/bcftools/bcf2qcall.c index 8634c9e..a86bac2 100644 --- a/bcftools/bcf2qcall.c +++ b/bcftools/bcf2qcall.c @@ -77,8 +77,8 @@ int bcf_2qcall(bcf_hdr_t *h, bcf1_t *b) for (k = j = 0; k < 4; ++k) { for (l = k; l < 4; ++l) { int t, x = map[k], y = map[l]; - if (x > y) t = x, x = y, y = t; - g[j++] = p[x * b->n_alleles - x * (x-1) / 2 + (y - x)]; + if (x > y) t = x, x = y, y = t; // swap + g[j++] = p[y * (y+1) / 2 + x]; } } printf("%s\t%d\t%c", h->ns[b->tid], b->pos+1, *b->ref);