X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bcftools%2Fprob1.c;fp=bcftools%2Fprob1.c;h=83bd8e2881f2f84688ce287b9a2ebe5e785cdace;hb=eb4c2ebca7bd29d3b850baf9b57c342742d06788;hp=15735af32cad689dccc41ea186caaa7bf2db3d72;hpb=183e4cb41c6136b9bff3dc83fcfa9f023e1d7629;p=samtools.git diff --git a/bcftools/prob1.c b/bcftools/prob1.c index 15735af..83bd8e2 100644 --- a/bcftools/prob1.c +++ b/bcftools/prob1.c @@ -193,21 +193,50 @@ void bcf_p1_destroy(bcf_p1aux_t *ma) static int cal_pdg(const bcf1_t *b, bcf_p1aux_t *ma) { - int i, j, imax=0; + int i, j; + int n = (b->n_alleles+1)*b->n_alleles/2; + double *lk = alloca(n * sizeof(long)); + memset(lk, 0, sizeof(double) * n); for (j = 0; j < ma->n; ++j) { const uint8_t *pi = ma->PL + j * ma->PL_len; double *pdg = ma->pdg + j * 3; pdg[0] = ma->q2p[pi[2]]; pdg[1] = ma->q2p[pi[1]]; pdg[2] = ma->q2p[pi[0]]; - int ib,ia=0,n=(b->n_alleles+1)*b->n_alleles/2; - for (i=0; iimax ) imax=ia; - i++; - } - ia++; - } - } - return imax; + for (i=0; in_alleles; i++) + { + int k; for (k=0; k<=i; k++) printf("%.0f\t", lk[j++]); + printf("\n"); + } + #endif + for (i=0; iis_indel ? b->n_alleles : b->n_alleles-1; + for (i=0; in_alleles; j++) { k=j*(j+1)/2+i; pr+=lk[k]; } + #if DBG + printf("%d\t%e\n", i,pr); + #endif + if (pmax