Commit 9267d062 authored by Dylan Aïssi's avatar Dylan Aïssi
Browse files

New upstream version 1.90~b6.2-180612

parent ece3ea42
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@
static const char ver_str[] =
#ifdef STABLE_BUILD
  "PLINK v1.90b6.1"
  "PLINK v1.90b6.2"
#else
  "PLINK v1.90p"
#endif
@@ -105,7 +105,7 @@ static const char ver_str[] =
#else
  " 32-bit"
#endif
  " (28 May 2018)";
  " (12 Jun 2018)";
static const char ver_str2[] =
  // include leading space if day < 10, so character length stays the same
  ""
+69 −46
Original line number Diff line number Diff line
@@ -2379,16 +2379,16 @@ THREAD_RET_TYPE assoc_adapt_thread(void* arg) {
      gpui = &(precomp_ui[4 * precomp_width * marker_bidx]);
      success_2start = perm_2success_ct[marker_idx];
      success_2incr = 0;
      if (model_fisher) {
	stat_high = orig_pvals[marker_idx] * (1.0 + EPSILON);
	stat_low = orig_pvals[marker_idx] * (1.0 - EPSILON);
      } else {
      if (orig_pvals[marker_idx] == -9) {
        perm_adapt_stop[marker_idx] = 1;
        perm_attempt_ct[marker_idx] = next_adapt_check;
        perm_2success_ct[marker_idx] = next_adapt_check;
        continue;
      }
      if (model_fisher) {
	stat_high = orig_pvals[marker_idx] * (1.0 + EPSILON);
	stat_low = orig_pvals[marker_idx] * (1.0 - EPSILON);
      } else {
	stat_high = orig_chisq[marker_idx] + EPSILON;
	stat_low = orig_chisq[marker_idx] - EPSILON;
      }
@@ -2582,11 +2582,7 @@ THREAD_RET_TYPE assoc_maxt_thread(void* arg) {
      msa_ptr = &(mperm_save_all[marker_idx * perm_vec_ct]);
    }
    for (; marker_bidx < marker_bceil; marker_bidx++) {
      if (model_fisher) {
	stat_high = orig_pvals[marker_idx] * (1.0 + EPSILON);
	stat_low = orig_pvals[marker_idx] * (1.0 - EPSILON);
      } else {
	if (g_orig_pvals[marker_idx] == -9) {
      if (orig_pvals[marker_idx] == -9) {
        if (msa_ptr) {
          for (pidx = 0; pidx < perm_vec_ct; pidx++) {
            *msa_ptr++ = -9;
@@ -2595,6 +2591,10 @@ THREAD_RET_TYPE assoc_maxt_thread(void* arg) {
        perm_2success_ct[marker_idx++] += perm_vec_ct;
        continue;
      }
      if (model_fisher) {
	stat_high = orig_pvals[marker_idx] * (1.0 + EPSILON);
	stat_low = orig_pvals[marker_idx] * (1.0 - EPSILON);
      } else {
	stat_high = orig_chisq[marker_idx] + EPSILON;
	stat_low = orig_chisq[marker_idx] - EPSILON;
      }
@@ -5001,6 +5001,11 @@ THREAD_RET_TYPE model_adapt_best_thread(void* arg) {
    for (; marker_bidx < marker_bceil; marker_bidx++) {
      marker_idx = g_adapt_m_table[marker_bidx];
      if (model_fisher) {
        if (orig_pvals[marker_idx] == -9) {
	  perm_adapt_stop[marker_idx] = 1;
	  perm_attempt_ct[marker_idx] = 0;
	  continue;
        }
	stat_high = orig_pvals[marker_idx] * (1.0 + EPSILON);
	stat_low = orig_pvals[marker_idx] * (1.0 - EPSILON);
      } else {
@@ -5263,6 +5268,10 @@ THREAD_RET_TYPE model_maxt_best_thread(void* arg) {
    }
    for (; marker_bidx < marker_bceil; marker_bidx++) {
      if (model_fisher) {
	if (orig_pvals[marker_idx] == -9) {
	  marker_idx++;
	  continue;
	}
	stat_high = orig_pvals[marker_idx] * (1.0 + EPSILON);
	stat_low = orig_pvals[marker_idx] * (1.0 - EPSILON);
	default_best_stat = 1;
@@ -6751,23 +6760,33 @@ int32_t model_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, cha
	  du1 = ujj;
	  du2 = uii;
	  if (model_fisher) {
            // bugfix (12 Jun 2018): If MAF is zero, test should not be
            // considered valid for --adjust or permutation testing purposes.
            // plink 1.07 got this right, but in a wrong way: it considered
            // *all* Fisher's-exact-test p-values of 1 to be invalid tests.  So
            // we don't generally want to match its output (even before
            // considering the problems with its fisher22 routine).
            if ((umm + ujj) && (ukk + uii)) {
              pval = fisher22(uii, ujj, ukk, umm, fisher_midp);
	    *orig_pvals_ptr = pval;
            } else {
	    if ((!umm) && (!ujj)) {
	      *orig_pvals_ptr = -9;
	      pval = -1;
	      dxx = 0;
	      if (fill_orig_chisq) {
		orig_chisq[marker_idx + marker_bidx] = -9;
              pval = -9;
            }
	    *orig_pvals_ptr = pval;
	  } else {
	    if ((umm + ujj) && (ukk + uii)) {
	      dxx = chi22_eval(ukk, ukk + umm, uii + ukk, uii + ujj + ukk + umm);
	      pval = chiprob_p(dxx, 1);
	      *orig_pvals_ptr = pval;
	      if (fill_orig_chisq) {
		orig_chisq[marker_idx + marker_bidx] = dxx;
	      }
	    } else {
	      *orig_pvals_ptr = -9;
	      pval = -1;
	      dxx = 0;
	      if (fill_orig_chisq) {
		orig_chisq[marker_idx + marker_bidx] = -9;
	      }
            }
	  }
	  *ooptr = (da1 * du2) / (du1 * da2);
@@ -6803,7 +6822,11 @@ int32_t model_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, cha
	    wptr = fw_strcpy(4, a2ptr, &(wptr[1]));
	    *wptr++ = ' ';
	    if (model_fisher) {
              if (pval == -9) {
                wptr = memcpya(wptr, "           1", 12);
              } else {
                wptr = dtoa_g_wxp4(MAXV(pval, output_min_p), 12, wptr);
              }
	    } else {
	      if (pval > -1) {
		wptr = dtoa_g_wxp4x(dxx, 12, ' ', wptr);