[med-svn] [Git][med-team/plink1-9][upstream] New upstream version 1.90~b6.17-200428

Dylan Aïssi gitlab at salsa.debian.org
Fri May 29 10:34:13 BST 2020



Dylan Aïssi pushed to branch upstream at Debian Med / plink1.9


Commits:
22fe3e35 by Dylan Aïssi at 2020-05-29T11:32:46+02:00
New upstream version 1.90~b6.17-200428
- - - - -


10 changed files:

- plink.c
- plink_assoc.c
- plink_common.c
- plink_data.c
- plink_filter.c
- plink_glm.c
- plink_homozyg.c
- plink_lasso.c
- plink_ld.c
- plink_misc.c


Changes:

=====================================
plink.c
=====================================
@@ -93,7 +93,7 @@
 
 static const char ver_str[] =
 #ifdef STABLE_BUILD
-  "PLINK v1.90b6.16"
+  "PLINK v1.90b6.17"
 #else
   "PLINK v1.90p"
 #endif
@@ -105,7 +105,7 @@ static const char ver_str[] =
 #else
   " 32-bit"
 #endif
-  " (19 Feb 2020)";
+  " (28 Apr 2020)";
 static const char ver_str2[] =
   // include leading space if day < 10, so character length stays the same
   ""
@@ -2937,9 +2937,17 @@ int32_t init_delim_and_species(uint32_t flag_ct, char* flag_buf, uint32_t* flag_
       goto init_delim_and_species_ret_INVALID_CMDLINE_WWA;
     }
     chrom_info_ptr->xymt_codes[X_OFFSET] = ii + 1;
-    chrom_info_ptr->xymt_codes[Y_OFFSET] = -1;
-    chrom_info_ptr->xymt_codes[XY_OFFSET] = -1;
-    chrom_info_ptr->xymt_codes[MT_OFFSET] = -1;
+    // bugfix (28 Apr 2020): We were segfaulting instead of printing an
+    // appropriate error message when e.g. --autosome-num was specified yet
+    // chrY was encountered.
+    // plink 2.0 fixed this issue by using -2 instead of -1 to indicate a null
+    // xymt_code (-1 signals that there's nothing to worry about when
+    // --allow-extra-chr is specified).  It touches more code than I'd like,
+    // but I haven't gotten any related plink 2.0 bug reports for a long time,
+    // so we backport that fix.
+    chrom_info_ptr->xymt_codes[Y_OFFSET] = -2;
+    chrom_info_ptr->xymt_codes[XY_OFFSET] = -2;
+    chrom_info_ptr->xymt_codes[MT_OFFSET] = -2;
     chrom_info_ptr->max_code = ii + 1;
     chrom_info_ptr->autosome_ct = ii;
     set_bit(ii + 1, chrom_info_ptr->haploid_mask);
@@ -2964,10 +2972,10 @@ int32_t init_delim_and_species(uint32_t flag_ct, char* flag_buf, uint32_t* flag_
       }
       ii = -ii;
       chrom_info_ptr->autosome_ct = ii;
-      chrom_info_ptr->xymt_codes[X_OFFSET] = -1;
-      chrom_info_ptr->xymt_codes[Y_OFFSET] = -1;
-      chrom_info_ptr->xymt_codes[XY_OFFSET] = -1;
-      chrom_info_ptr->xymt_codes[MT_OFFSET] = -1;
+      chrom_info_ptr->xymt_codes[X_OFFSET] = -2;
+      chrom_info_ptr->xymt_codes[Y_OFFSET] = -2;
+      chrom_info_ptr->xymt_codes[XY_OFFSET] = -2;
+      chrom_info_ptr->xymt_codes[MT_OFFSET] = -2;
       chrom_info_ptr->max_code = ii;
       fill_all_bits(((uint32_t)ii) + 1, chrom_info_ptr->haploid_mask);
     } else {
@@ -2980,27 +2988,27 @@ int32_t init_delim_and_species(uint32_t flag_ct, char* flag_buf, uint32_t* flag_
       set_bit(ii + 2, chrom_info_ptr->haploid_mask);
       for (param_idx = 2; param_idx <= param_ct; param_idx++) {
 	if (!strcmp(argv[cur_arg + param_idx], "no-x")) {
-	  chrom_info_ptr->xymt_codes[X_OFFSET] = -1;
+	  chrom_info_ptr->xymt_codes[X_OFFSET] = -2;
 	  clear_bit(ii + 1, chrom_info_ptr->haploid_mask);
 	} else if (!strcmp(argv[cur_arg + param_idx], "no-y")) {
-	  chrom_info_ptr->xymt_codes[Y_OFFSET] = -1;
+	  chrom_info_ptr->xymt_codes[Y_OFFSET] = -2;
 	  clear_bit(ii + 2, chrom_info_ptr->haploid_mask);
 	} else if (!strcmp(argv[cur_arg + param_idx], "no-xy")) {
-	  chrom_info_ptr->xymt_codes[XY_OFFSET] = -1;
+	  chrom_info_ptr->xymt_codes[XY_OFFSET] = -2;
 	} else if (!strcmp(argv[cur_arg + param_idx], "no-mt")) {
-	  chrom_info_ptr->xymt_codes[MT_OFFSET] = -1;
+	  chrom_info_ptr->xymt_codes[MT_OFFSET] = -2;
 	} else {
 	  sprintf(g_logbuf, "Error: Invalid --chr-set parameter '%s'.\n", argv[cur_arg + param_idx]);
 	  goto init_delim_and_species_ret_INVALID_CMDLINE_WWA;
 	}
       }
-      if (chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) {
+      if (chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) {
 	chrom_info_ptr->max_code = ii + 4;
-      } else if (chrom_info_ptr->xymt_codes[XY_OFFSET] != -1) {
+      } else if (chrom_info_ptr->xymt_codes[XY_OFFSET] != -2) {
 	chrom_info_ptr->max_code = ii + 3;
-      } else if (chrom_info_ptr->xymt_codes[Y_OFFSET] != -1) {
+      } else if (chrom_info_ptr->xymt_codes[Y_OFFSET] != -2) {
 	chrom_info_ptr->max_code = ii + 2;
-      } else if (chrom_info_ptr->xymt_codes[X_OFFSET] != -1) {
+      } else if (chrom_info_ptr->xymt_codes[X_OFFSET] != -2) {
 	chrom_info_ptr->max_code = ii + 1;
       } else {
 	chrom_info_ptr->max_code = ii;
@@ -4238,7 +4246,7 @@ int32_t main(int32_t argc, char** argv) {
           logerrprint("Error: --autosome-xy cannot be used with --autosome.\n");
 	  goto main_ret_INVALID_CMDLINE;
 	}
-	if (chrom_info.xymt_codes[XY_OFFSET] == -1) {
+	if (chrom_info.xymt_codes[XY_OFFSET] == -2) {
 	  logerrprint("Error: --autosome-xy used with a species lacking an XY region.\n");
 	  goto main_ret_INVALID_CMDLINE_A;
 	}
@@ -9269,7 +9277,7 @@ int32_t main(int32_t argc, char** argv) {
         set_info.modifier |= SET_COMPLEMENTS | SET_C_PREFIX | SET_MAKE_COLLAPSE_GROUP;
 	goto main_param_zero;
       } else if (!memcmp(argptr2, "erge-x", 7)) {
-	if ((chrom_info.xymt_codes[X_OFFSET] == -1) || (chrom_info.xymt_codes[XY_OFFSET] == -1)) {
+	if ((chrom_info.xymt_codes[X_OFFSET] == -2) || (chrom_info.xymt_codes[XY_OFFSET] == -2)) {
 	  logerrprint("Error: --merge-x must be used with a chromosome set containing X and XY codes.\n");
 	  goto main_ret_INVALID_CMDLINE_A;
 	}
@@ -10801,9 +10809,6 @@ int32_t main(int32_t argc, char** argv) {
 	}
 	if (*argptr2 == '2') {
           ld_info.modifier |= LD_R2;
-	} else if (ld_info.window_r2 != 0.2) {
-	  logerrprint("Error: --ld-window-r2 flag cannot be used with --r.\n");
-          goto main_ret_INVALID_CMDLINE_A;
 	}
 	if (matrix_flag_state) {
 	  matrix_flag_state = 2;
@@ -11402,7 +11407,7 @@ int32_t main(int32_t argc, char** argv) {
 	if (misc_flags & MISC_MERGEX) {
           logerrprint("Error: --split-x cannot be used with --merge-x.\n");
           goto main_ret_INVALID_CMDLINE_A;
-	} else if ((chrom_info.xymt_codes[X_OFFSET] == -1) || (chrom_info.xymt_codes[XY_OFFSET] == -1)) {
+	} else if ((chrom_info.xymt_codes[X_OFFSET] == -2) || (chrom_info.xymt_codes[XY_OFFSET] == -2)) {
 	  logerrprint("Error: --split-x must be used with a chromosome set containing X and XY codes.\n");
 	  goto main_ret_INVALID_CMDLINE_A;
 	}


=====================================
plink_assoc.c
=====================================
@@ -6318,7 +6318,7 @@ int32_t model_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, cha
     g_het_cts = het_cts;
     g_homcom_cts = homcom_cts;
   }
-  gender_req = ((x_code != -1) && is_set(chrom_info_ptr->chrom_mask, x_code)) || (model_assoc && (((y_code != -1) && is_set(chrom_info_ptr->chrom_mask, y_code))));
+  gender_req = ((x_code != -2) && is_set(chrom_info_ptr->chrom_mask, x_code)) || (model_assoc && (((y_code != -2) && is_set(chrom_info_ptr->chrom_mask, y_code))));
   if (gender_req) {
     if (bigstack_alloc_ul(pheno_nm_ctv2, &g_sample_nonmale_include2) ||
 	bigstack_alloc_ul(pheno_nm_ctv2, &sample_male_include2)) {
@@ -8109,7 +8109,7 @@ int32_t qassoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, char* ou
   uint32_t pct = 0;
   uint32_t max_thread_ct = g_thread_ct;
   uint32_t perm_pass_idx = 0;
-  uint32_t mt_exists = (chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET]);
+  uint32_t mt_exists = (chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET]);
   uint32_t hh_or_mt_exists = hh_exists | (mt_exists * NXMHH_EXISTS);
   int32_t retval = 0;
   double x11 = 0;
@@ -9150,8 +9150,8 @@ int32_t gxe_assoc(FILE* bedfile, uintptr_t bed_offset, char* outname, char* outn
   uintptr_t cur_sample_ctv2 = 0;
   uintptr_t cur_group1_size = 0;
   uintptr_t cur_group2_size = 0;
-  uint32_t y_exists = (chrom_info_ptr->xymt_codes[Y_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[Y_OFFSET]);
-  uint32_t mt_exists = (chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET]);
+  uint32_t y_exists = (chrom_info_ptr->xymt_codes[Y_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[Y_OFFSET]);
+  uint32_t mt_exists = (chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET]);
   uint32_t skip_y = 0;
   double pheno_sum_g1 = 0;
   double pheno_ssq_g1 = 0;
@@ -10054,7 +10054,7 @@ int32_t testmiss(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, char*
   cur_ctrl_ct_recip = 1.0 / ((double)((int32_t)ctrl_ct));
   // Y chromosome requires special handling--only male genotypes should be
   // considered.
-  if ((y_code == -1) || (!is_set(chrom_info_ptr->chrom_mask, y_code))) {
+  if ((y_code == -2) || (!is_set(chrom_info_ptr->chrom_mask, y_code))) {
     skip_y = 1;
   } else if ((!case_ct_y) || (!ctrl_ct_y)) {
     logerrprint("Warning: --test-missing is skipping Y chromosome since at least one male case\nand one male control are necessary.\n");
@@ -11121,7 +11121,7 @@ int32_t cmh_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, char*
   if (putc_checked('\n', outfile)) {
     goto cmh_assoc_ret_WRITE_FAIL;
   }
-  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
+  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
     hh_or_mt_exists |= NXMHH_EXISTS;
   }
   if (alloc_raw_haploid_filters(unfiltered_sample_ct, hh_or_mt_exists, 1, pheno_nm, sex_male, &sample_hh_include2, &sample_hh_male_include2)) {
@@ -11464,7 +11464,7 @@ int32_t cmh2_assoc(FILE* bedfile, uintptr_t bed_offset, char* outname, char* out
   if (!mi_buf) {
     goto cmh2_assoc_ret_NOMEM;
   }
-  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
+  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
     hh_or_mt_exists |= NXMHH_EXISTS;
   }
   if (alloc_raw_haploid_filters(unfiltered_sample_ct, hh_or_mt_exists, 1, pheno_nm, sex_male, &sample_hh_include2, &sample_hh_male_include2)) {
@@ -11726,7 +11726,7 @@ int32_t homog_assoc(FILE* bedfile, uintptr_t bed_offset, char* outname, char* ou
   // misaligned for backward compatibility
   sprintf(g_textbuf, " CHR %%%us   A1   A2      F_A      F_U      N_A      N_U     TEST      CHISQ   DF          P         OR\n", plink_maxsnp);
   fprintf(outfile, g_textbuf, "SNP");
-  if (chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) {
+  if (chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) {
     hh_or_mt_exists |= NXMHH_EXISTS;
   }
   if (alloc_raw_haploid_filters(unfiltered_sample_ct, hh_or_mt_exists, 1, pheno_nm, sex_male, &sample_hh_include2, &sample_hh_male_include2)) {


=====================================
plink_common.c
=====================================
@@ -4397,12 +4397,12 @@ void init_species(uint32_t species_code, Chrom_info* chrom_info_ptr) {
   // sheep: 26, X, Y
   const int32_t species_xymt_codes[] = {
     23, 24, 25, 26,
-    30, 31, -1, 33,
+    30, 31, -2, 33,
     39, 40, 41, 42,
-    32, 33, -1, -1,
-    20, 21, -1, -1,
-    -1, -1, -1, -1,
-    27, 28, -1, -1};
+    32, 33, -2, -2,
+    20, 21, -2, -2,
+    -2, -2, -2, -2,
+    27, 28, -2, -2};
   const uint32_t species_autosome_ct[] = {22, 29, 38, 31, 19, 12, 26};
   const uint32_t species_max_code[] = {26, 33, 42, 33, 21, 12, 28};
   fill_ulong_zero(CHROM_MASK_WORDS, chrom_info_ptr->chrom_mask);
@@ -4463,7 +4463,7 @@ void init_default_chrom_mask(Chrom_info* chrom_info_ptr) {
     // --chr-set support
     for (uint32_t xymt_idx = 0; xymt_idx < XYMT_OFFSET_CT; ++xymt_idx) {
       int32_t cur_code = chrom_info_ptr->xymt_codes[xymt_idx];
-      if (cur_code != -1) {
+      if (cur_code != -2) {
 	set_bit(chrom_info_ptr->xymt_codes[xymt_idx], chrom_info_ptr->chrom_mask);
       }
     }
@@ -8263,13 +8263,13 @@ uint32_t count_non_autosomal_markers(const Chrom_info* chrom_info_ptr, const uin
   const int32_t y_code = chrom_info_ptr->xymt_codes[Y_OFFSET];
   const int32_t mt_code = chrom_info_ptr->xymt_codes[MT_OFFSET];
   uint32_t ct = 0;
-  if (count_x && (x_code != -1)) {
+  if (count_x && (x_code != -2)) {
     ct += count_chrom_markers(chrom_info_ptr, marker_exclude, x_code);
   }
-  if (y_code != -1) {
+  if (y_code != -2) {
     ct += count_chrom_markers(chrom_info_ptr, marker_exclude, y_code);
   }
-  if (count_mt && (mt_code != -1)) {
+  if (count_mt && (mt_code != -2)) {
     ct += count_chrom_markers(chrom_info_ptr, marker_exclude, mt_code);
   }
   return ct;
@@ -8286,13 +8286,13 @@ int32_t conditional_allocate_non_autosomal_markers(const Chrom_info* chrom_info_
   if (is_set(chrom_info_ptr->haploid_mask, 0)) {
     *newly_excluded_ct_ptr = marker_ct;
   } else {
-    if (count_x && (xymt_codes[X_OFFSET] != -1)) {
+    if (count_x && (xymt_codes[X_OFFSET] != -2)) {
       xymt_cts[X_OFFSET] = count_chrom_markers(chrom_info_ptr, marker_exclude_orig, xymt_codes[X_OFFSET]);
     }
-    if (xymt_codes[Y_OFFSET] != -1) {
+    if (xymt_codes[Y_OFFSET] != -2) {
       xymt_cts[Y_OFFSET] = count_chrom_markers(chrom_info_ptr, marker_exclude_orig, xymt_codes[Y_OFFSET]);
     }
-    if (count_mt && (xymt_codes[MT_OFFSET] != -1)) {
+    if (count_mt && (xymt_codes[MT_OFFSET] != -2)) {
       xymt_cts[MT_OFFSET] = count_chrom_markers(chrom_info_ptr, marker_exclude_orig, xymt_codes[MT_OFFSET]);
     }
     *newly_excluded_ct_ptr = xymt_cts[X_OFFSET] + xymt_cts[Y_OFFSET] + xymt_cts[MT_OFFSET];


=====================================
plink_data.c
=====================================
@@ -13193,7 +13193,7 @@ int32_t recode(uint32_t recode_modifier, FILE* bedfile, uintptr_t bed_offset, ch
     // for backward compatibility, also exclude XY.  don't exclude custom name
     // chromosomes, though, since chromosome 0 was actually processed
     autosomal_marker_ct = marker_ct - count_non_autosomal_markers(chrom_info_ptr, marker_exclude, 1, 1);
-    if (chrom_info_ptr->xymt_codes[XY_OFFSET] != -1) {
+    if (chrom_info_ptr->xymt_codes[XY_OFFSET] != -2) {
       autosomal_marker_ct -= count_chrom_markers(chrom_info_ptr, marker_exclude, chrom_info_ptr->xymt_codes[XY_OFFSET]);
     }
     if (!autosomal_marker_ct) {


=====================================
plink_filter.c
=====================================
@@ -1178,7 +1178,7 @@ int32_t load_oblig_missing(FILE* bedfile, uintptr_t bed_offset, uintptr_t unfilt
   uintptr_t y_end = 0;
   uintptr_t line_idx = 0;
   int32_t y_code = chrom_info_ptr->xymt_codes[Y_OFFSET];
-  uint32_t y_present = ((y_code != -1) && is_set(chrom_info_ptr->chrom_mask, y_code));
+  uint32_t y_present = ((y_code != -2) && is_set(chrom_info_ptr->chrom_mask, y_code));
   int32_t retval = 0;
   Ll_str* ll_ptr;
   uintptr_t* loadbuf;
@@ -1606,7 +1606,7 @@ int32_t mind_filter(FILE* bedfile, uintptr_t bed_offset, char* outname, char* ou
   uint32_t sample_idx = 0;
   uint32_t removed_ct = 0;
   int32_t y_code = chrom_info_ptr->xymt_codes[Y_OFFSET];
-  uint32_t y_present = (y_code != -1) && is_set(chrom_info_ptr->chrom_mask, y_code);
+  uint32_t y_present = (y_code != -2) && is_set(chrom_info_ptr->chrom_mask, y_code);
   uint32_t nony_marker_ct = marker_ct;
   int32_t retval = 0;
   uint32_t mind_int_thresh[2];
@@ -2091,9 +2091,9 @@ int32_t calc_freqs_and_hwe(FILE* bedfile, char* outname, char* outname_end, uint
   loadbuf[unfiltered_sample_ctv2 - 1] = 0;
   init_quaterarr_from_inverted_bitarr(sample_exclude, unfiltered_sample_ct, sample_include2);
   ii = chrom_info_ptr->xymt_codes[X_OFFSET];
-  nonmales_needed = (!is_split_chrom) && (ii != -1) && is_set(chrom_info_ptr->chrom_mask, ii);
+  nonmales_needed = (!is_split_chrom) && (ii != -2) && is_set(chrom_info_ptr->chrom_mask, ii);
   ii = chrom_info_ptr->xymt_codes[Y_OFFSET];
-  males_needed = nonmales_needed || ((!is_split_chrom) && (ii != -1) && is_set(chrom_info_ptr->chrom_mask, ii));
+  males_needed = nonmales_needed || ((!is_split_chrom) && (ii != -2) && is_set(chrom_info_ptr->chrom_mask, ii));
   if (bigstack_alloc_ul(unfiltered_sample_ctv2, &sample_male_include2)) {
     goto calc_freqs_and_hwe_ret_NOMEM;
   }
@@ -2507,7 +2507,7 @@ int32_t write_missingness_reports(FILE* bedfile, uintptr_t bed_offset, char* out
   uint32_t* om_cluster_ref_cts = nullptr;
   uint64_t cur_om_entry = 0;
   int32_t y_code = chrom_info_ptr->xymt_codes[Y_OFFSET];
-  uint32_t y_present = (y_code != -1) && is_set(chrom_info_ptr->chrom_mask, y_code);
+  uint32_t y_present = (y_code != -2) && is_set(chrom_info_ptr->chrom_mask, y_code);
   uint32_t sample_uidx = 0;
   uint32_t sample_idx = 0;
   uint32_t oblig_ct = 0;


=====================================
plink_glm.c
=====================================
@@ -3576,7 +3576,7 @@ int32_t glm_common_init(FILE* bedfile, uintptr_t bed_offset, uint32_t glm_modifi
   uint32_t slen_add = 0;
   uint32_t sex_covar_everywhere = glm_modifier & GLM_SEX;
   uint32_t x_sex_interaction = (glm_xchr_model == 3);
-  uint32_t x_present = (chrom_info_ptr->xymt_codes[X_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[X_OFFSET]);
+  uint32_t x_present = (chrom_info_ptr->xymt_codes[X_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[X_OFFSET]);
   uint32_t hide_covar = glm_modifier & GLM_HIDE_COVAR;
   uint32_t variation_in_sex = 0; // zero if no-x-sex specified
   int32_t retval = 0;
@@ -4501,7 +4501,7 @@ int32_t glm_linear_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset
   uint32_t ujj;
   uint32_t ukk;
   numbuf[0] = ' ';
-  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
+  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
     hh_or_mt_exists |= NXMHH_EXISTS;
   }
   if (is_set_test) {
@@ -6028,7 +6028,7 @@ int32_t glm_logistic_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offs
     logerrprint("Warning: Skipping --logistic since less than two phenotypes are present.\n");
     goto glm_logistic_assoc_ret_1;
   }
-  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
+  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
     hh_or_mt_exists |= NXMHH_EXISTS;
   }
   if (is_set_test) {
@@ -7153,7 +7153,7 @@ int32_t glm_linear_nosnp(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset
     goto glm_linear_nosnp_ret_NOMEM;
   }
   sample_valid_ct = popcount_longs(load_mask, unfiltered_sample_ctl);
-  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
+  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
     hh_or_mt_exists |= NXMHH_EXISTS;
   }
   if (condition_mname || condition_fname) {
@@ -8014,7 +8014,7 @@ int32_t glm_logistic_nosnp(pthread_t* threads, FILE* bedfile, uintptr_t bed_offs
     goto glm_logistic_nosnp_ret_NOMEM;
   }
   sample_valid_ct = popcount_longs(load_mask, unfiltered_sample_ctl);
-  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
+  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
     hh_or_mt_exists |= NXMHH_EXISTS;
   }
   if (condition_mname || condition_fname) {


=====================================
plink_homozyg.c
=====================================
@@ -2543,7 +2543,7 @@ int32_t calc_homozyg(Homozyg_info* hp, FILE* bedfile, uintptr_t bed_offset, uint
       bigstack_end_alloc_ui(window_size, &uidx_buf)) {
     goto calc_homozyg_ret_NOMEM;
   }
-  if ((x_code != -1) && is_set(chrom_info_ptr->chrom_mask, x_code)) {
+  if ((x_code != -2) && is_set(chrom_info_ptr->chrom_mask, x_code)) {
     if (bigstack_end_alloc_ul(sample_ctl, &sample_male)) {
       goto calc_homozyg_ret_NOMEM;
     }
@@ -2567,7 +2567,7 @@ int32_t calc_homozyg(Homozyg_info* hp, FILE* bedfile, uintptr_t bed_offset, uint
     uii = chrom_info_ptr->chrom_file_order[chrom_fo_idx];
     roh_list_chrom_starts[chrom_fo_idx] = roh_ct;
     chrom_end = chrom_info_ptr->chrom_fo_vidx_start[chrom_fo_idx + 1];
-    if ((x_code == -1) || (uii != ((uint32_t)x_code))) {
+    if ((x_code == -2) || (uii != ((uint32_t)x_code))) {
       if (IS_SET(haploid_mask, uii) || (uii == (uint32_t)mt_code)) {
 	marker_uidx = chrom_end;
 	if (fseeko(bedfile, bed_offset + (uint64_t)marker_uidx * unfiltered_sample_ct4, SEEK_SET)) {


=====================================
plink_lasso.c
=====================================
@@ -482,7 +482,7 @@ int32_t lasso_lambda(const uintptr_t* marker_exclude, const uintptr_t* marker_re
       goto lasso_lambda_ret_NOMEM;
     }
     fill_quatervec_55(sample_valid_ct, sample_include2);
-    if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
+    if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
       hh_or_mt_exists |= NXMHH_EXISTS;
     }
     uintptr_t* sample_male_include2;
@@ -1135,7 +1135,7 @@ int32_t lasso(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, char* out
   }
   fill_quatervec_55(sample_valid_ct, sample_include2);
   fill_ulong_zero(unfiltered_marker_ctl, polymorphic_markers);
-  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
+  if ((chrom_info_ptr->xymt_codes[MT_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[MT_OFFSET])) {
     hh_or_mt_exists |= NXMHH_EXISTS;
   }
   if (alloc_collapsed_haploid_filters(pheno_nm2, sex_male, unfiltered_sample_ct, sample_valid_ct, hh_or_mt_exists, 1, &sample_include2, &sample_male_include2)) {


=====================================
plink_ld.c
=====================================
@@ -2711,7 +2711,7 @@ uint32_t ld_regular_emitn(uint32_t overflow_ct, unsigned char* readbuf) {
     while (block_idx2 < block_end2) {
       next_unset_ul_unsafe_ck(marker_exclude, &marker_uidx2);
       dxx = *dptr++;
-      if ((!is_r2) || (fabs(dxx) >= window_r2)) {
+      if (fabs(dxx) >= window_r2) {
 	sptr_cur = memcpya(sptr_cur, g_textbuf, prefix_len);
 	if (is_inter_chr) {
 	  if (marker_uidx2 >= chrom_end2) {
@@ -5312,7 +5312,7 @@ int32_t ld_report_dprime(pthread_t* threads, Ld_info* ldip, FILE* bedfile, uintp
   loadbuf[founder_ctl * 2 - 1] = 0;
   fill_all_bits(founder_ct, dummy_nm);
   g_ld_thread_wkspace = nullptr;
-  if ((x_code != -1) && is_set(chrom_info_ptr->chrom_mask, x_code)) {
+  if ((x_code != -2) && is_set(chrom_info_ptr->chrom_mask, x_code)) {
     uii = get_chrom_start_vidx(chrom_info_ptr, (uint32_t)x_code);
     chrom_end = get_chrom_end_vidx(chrom_info_ptr, (uint32_t)x_code);
     chrom_end = chrom_end - uii - popcount_bit_idx(marker_exclude, uii, chrom_end);
@@ -5863,6 +5863,8 @@ int32_t ld_report_regular(pthread_t* threads, Ld_info* ldip, FILE* bedfile, uint
   g_ld_is_first_block = (!parallel_idx);
   if (g_ld_is_r2) {
     g_ld_window_r2 = ldip->window_r2;
+  } else {
+    g_ld_window_r2 = sqrt(ldip->window_r2);
   }
   if (ld_modifier & LD_DX) {
     // this is more like --fast-epistasis under the hood, since it requires the
@@ -10535,7 +10537,7 @@ int32_t indep_pairphase(Ld_info* ldip, FILE* bedfile, uintptr_t bed_offset, uint
     geno[ulii * founder_ctsplit + 2 * founder_ctv3 - 1] = 0;
     geno[ulii * founder_ctsplit + founder_ctsplit - 1] = 0;
   }
-  if ((chrom_info_ptr->xymt_codes[X_OFFSET] != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[X_OFFSET])) {
+  if ((chrom_info_ptr->xymt_codes[X_OFFSET] != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_info_ptr->xymt_codes[X_OFFSET])) {
     if (bigstack_alloc_ul(founder_ctl, &sex_male_collapsed) ||
         bigstack_alloc_ul(founder_ctsplit, &cur_geno1_male)) {
       goto indep_pairphase_ret_NOMEM;


=====================================
plink_misc.c
=====================================
@@ -2444,7 +2444,7 @@ int32_t write_stratified_freqs(FILE* bedfile, uintptr_t bed_offset, char* outnam
     }
   }
   chrom_idx = chrom_info_ptr->xymt_codes[X_OFFSET];
-  if ((chrom_idx != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_idx)) {
+  if ((chrom_idx != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_idx)) {
     if (bigstack_alloc_ui(cluster_ct + 1, &cluster_starts_nonmale) ||
         bigstack_alloc_ui(sample_f_ct - sample_f_male_ct, &cluster_map_nonmale)) {
       goto write_stratified_freqs_ret_NOMEM;
@@ -2464,7 +2464,7 @@ int32_t write_stratified_freqs(FILE* bedfile, uintptr_t bed_offset, char* outnam
     }
   }
   chrom_idx = chrom_info_ptr->xymt_codes[Y_OFFSET];
-  if (cluster_map_nonmale || ((chrom_idx != -1) && is_set(chrom_info_ptr->chrom_mask, chrom_idx))) {
+  if (cluster_map_nonmale || ((chrom_idx != -2) && is_set(chrom_info_ptr->chrom_mask, chrom_idx))) {
     if (bigstack_alloc_ui(cluster_ct + 1, &cluster_starts_male) ||
         bigstack_alloc_ui(sample_f_male_ct, &cluster_map_male)) {
       goto write_stratified_freqs_ret_NOMEM;
@@ -3067,7 +3067,7 @@ int32_t sexcheck(FILE* bedfile, uintptr_t bed_offset, char* outname, char* outna
     }
   }
   if (!yonly) {
-    if ((x_code == -1) || (!is_set(chrom_info_ptr->chrom_mask, (uint32_t)x_code))) {
+    if ((x_code == -2) || (!is_set(chrom_info_ptr->chrom_mask, (uint32_t)x_code))) {
       goto sexcheck_ret_NO_X_VAR;
     }
     marker_uidx_end = get_chrom_end_vidx(chrom_info_ptr, (uint32_t)x_code);
@@ -3134,7 +3134,7 @@ int32_t sexcheck(FILE* bedfile, uintptr_t bed_offset, char* outname, char* outna
     }
   }
   if (check_y) {
-    if ((y_code != -1) && is_set(chrom_info_ptr->chrom_mask, (uint32_t)y_code)) {
+    if ((y_code != -2) && is_set(chrom_info_ptr->chrom_mask, (uint32_t)y_code)) {
       marker_uidx_end = get_chrom_end_vidx(chrom_info_ptr, (uint32_t)y_code);
       marker_uidx = next_unset_ul(marker_exclude, get_chrom_start_vidx(chrom_info_ptr, (uint32_t)y_code), marker_uidx_end);
       ytotal = marker_uidx_end - marker_uidx - popcount_bit_idx(marker_exclude, marker_uidx, marker_uidx_end);



View it on GitLab: https://salsa.debian.org/med-team/plink1-9/-/commit/22fe3e35f31f2f55a902e5138006b61c005a2a86

-- 
View it on GitLab: https://salsa.debian.org/med-team/plink1-9/-/commit/22fe3e35f31f2f55a902e5138006b61c005a2a86
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200529/2a28d51b/attachment-0001.html>


More information about the debian-med-commit mailing list