From 3ec6835661c795cda9f118616321852fe0e47c6e Mon Sep 17 00:00:00 2001 From: Matthew Mah Date: Fri, 24 Jul 2020 09:19:33 -0400 Subject: [PATCH] old qpfstats could behave badly when some samples had very low coverage --- src/qpfstats.c | 29 ++++++------ src/qpsubs.c | 124 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 116 insertions(+), 37 deletions(-) diff --git a/src/qpfstats.c b/src/qpfstats.c index b0109dc..18ed9b1 100644 --- a/src/qpfstats.c +++ b/src/qpfstats.c @@ -26,11 +26,12 @@ // (YRI, CEU, Papua, .... ) -#define WVERSION "180" +#define WVERSION "200" // useweight added // allsnps added // doscale NO added +// small bug (error check in dofstats fixed #define MAXFL 50 #define MAXSTR 512 @@ -524,6 +525,12 @@ rintf ("seed: %d\n", seed); printf("*** warning ***\n") ; printf("fstat with no data. Unable to compute heterozygosity?: ") ; printimat(findex[bad], 1, 4) ; + printf("bad quadruple: ") ; + for (k=-0; k<4; ++k) { + a = findex[bad][k] ; + printf(" %s ", eglist[a]) ; + } + printnl() ; } y = cputimes(1, 2) ; @@ -545,9 +552,11 @@ rintf ("seed: %d\n", seed); if (hires) dumpfstatshr(fstatsoutname, ff3, ff3var, eglist, numeg, ind2f, basenum) ; else dumpfstats(fstatsoutname, ff3, ff3var, eglist, numeg, ind2f, basenum) ; -/** + if (details) printf("raw fstat table (before fit): scale: %9.3f\n", lambdascale) ; for (k=0; kignore) + continue; + wt = cupt->weight; + if (wt <= 0.0) + continue; + + bnum = cupt->tagnumber; + if (bnum < 0) continue; + if (bnum>=nblocks) fatalx("logic bug\n") ; + + loadaa (cupt, xindex, xtypes, nrows, numeg); + + + + j = tmin ; + yy = fstatx(fsindex[j]) ; + if (isnan(yy)) fatalx("fstatx bug\n") ; + if (yy < -99) continue ; + yy *= scale ; + ++tt ; + } + verbose = NO ; + +// printf("zzcount: %9.0f %d\n", ymin, tt) ; +// printmat(gbot, 1, nfstats) ; + + } vsp (w2, gbot, 1.0e-10, nfstats); @@ -4560,6 +4606,14 @@ dofstats (double *fbmean, double *fbcovar, double **fbcoeffs, int nbasis, vvd (gtop, gtop, gbot, nfstats); for (j=0; j