[med-svn] [plink1.9] 01/05: New upstream version 1.90~b5-171114

Dylan Aïssi bob.dybian-guest at moszumanska.debian.org
Thu Nov 30 22:09:52 UTC 2017


This is an automated email from the git hooks/post-receive script.

bob.dybian-guest pushed a commit to branch master
in repository plink1.9.

commit 9ee19f9139a7bd4cf6b3af9f4af31eb4862029b0
Author: Dylan Aïssi <bob.dybian at gmail.com>
Date:   Thu Nov 30 22:52:33 2017 +0100

    New upstream version 1.90~b5-171114
---
 Makefile                 |  4 ++--
 Makefile => Makefile.std |  4 ++--
 plink.c                  | 14 +++++++-------
 plink_common.c           | 47 ++++++++++++++++++++++++-----------------------
 plink_common.h           |  2 +-
 plink_data.c             | 36 +++++++++++++++++++++++++-----------
 plink_first_compile      |  2 +-
 plink_ld.c               | 16 ++++++++--------
 plink_misc.c             | 12 +++++++-----
 9 files changed, 77 insertions(+), 60 deletions(-)

diff --git a/Makefile b/Makefile
index 7e1c335..acbe07a 100644
--- a/Makefile
+++ b/Makefile
@@ -96,7 +96,7 @@ clean:
 # includes a C++ header and exposed functions will need to be declared with
 # extern "C".
 %.o: %.c
-	$(CXX) -c $(CFLAGS) $< -o $@
+	$(CXX) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
 
 %.o: %.cc
-	$(CXX) -x c++ -c $(CXXFLAGS) $< -o $@
+	$(CXX) -x c++ -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
diff --git a/Makefile b/Makefile.std
similarity index 97%
copy from Makefile
copy to Makefile.std
index 7e1c335..acbe07a 100644
--- a/Makefile
+++ b/Makefile.std
@@ -96,7 +96,7 @@ clean:
 # includes a C++ header and exposed functions will need to be declared with
 # extern "C".
 %.o: %.c
-	$(CXX) -c $(CFLAGS) $< -o $@
+	$(CXX) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
 
 %.o: %.cc
-	$(CXX) -x c++ -c $(CXXFLAGS) $< -o $@
+	$(CXX) -x c++ -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
diff --git a/plink.c b/plink.c
index 792e8d9..9a9e57c 100644
--- a/plink.c
+++ b/plink.c
@@ -93,7 +93,7 @@
 
 static const char ver_str[] =
 #ifdef STABLE_BUILD
-  "PLINK v1.90b4.9"
+  "PLINK v1.90b5"
 #else
   "PLINK v1.90p"
 #endif
@@ -105,19 +105,19 @@ static const char ver_str[] =
 #else
   " 32-bit"
 #endif
-  " (13 Oct 2017)";
+  " (14 Nov 2017)";
 static const char ver_str2[] =
   // include leading space if day < 10, so character length stays the same
   ""
 #ifdef STABLE_BUILD
-  "" // (don't want this when version number has a trailing letter)
+  "   " // (don't want this when version number has a trailing letter)
 #else
-  "   " // (don't want this when version number has e.g. "b3" before "p")
+  "    " // (don't want this when version number has e.g. "b3" before "p")
 #endif
 #ifndef NOLAPACK
   "  "
 #endif
-  "         www.cog-genomics.org/plink/1.9/\n"
+  "        www.cog-genomics.org/plink/1.9/\n"
   "(C) 2005-2017 Shaun Purcell, Christopher Chang   GNU General Public License v3"
 #if SPECIES_DEFAULT > 0
   "\nRecompiled with default species = "
@@ -2201,7 +2201,7 @@ int32_t plink(char* outname, char* outname_end, char* bedname, char* bimname, ch
 
 static inline int32_t is_flag(char* param) {
   unsigned char ucc = param[1];
-  return ((*param == '-') && ((ucc > '9') || ((ucc < '0') && (ucc != '.') && (ucc != '\0')))); 
+  return ((*param == '-') && ((ucc > '9') || ((ucc < '0') && (ucc != '.') && (ucc != '\0'))));
 }
 
 static inline char* is_flag_start(char* param) {
@@ -7492,7 +7492,7 @@ int32_t main(int32_t argc, char** argv) {
 	    goto main_ret_INVALID_CMDLINE_WWA;
 	  } else if (dxx > (0.5 + SMALLISH_EPSILON)) {
 	    sprintf(g_logbuf, "Error: The --hard-call-threshold parameter must be smaller than 0.5.  (Did you\nmean '--hard-call-threshold %g'?)\n", 1.0 - dxx);
-	    goto main_ret_INVALID_CMDLINE_2A; 
+	    goto main_ret_INVALID_CMDLINE_2A;
 	  } else if (dxx > (0.5 - SMALLISH_EPSILON)) {
 	    logerrprint("Error: The --hard-call-threshold parameter must be smaller than 0.5, to prevent\nties.\n");
 	    goto main_ret_INVALID_CMDLINE_A;
diff --git a/plink_common.c b/plink_common.c
index 47fa921..7854f6c 100644
--- a/plink_common.c
+++ b/plink_common.c
@@ -271,7 +271,7 @@ unsigned char* bigstack_end_alloc_presized(uintptr_t size) {
   } else {
     g_bigstack_end -= size;
     return g_bigstack_end;
-  }  
+  }
 }
 
 uint32_t match_upper(const char* ss, const char* fixed_str) {
@@ -344,7 +344,7 @@ uint32_t scan_posint_capped(const char* ss, uint64_t cap, uint32_t* valp) {
 }
 
 uint32_t scan_uint_capped(const char* ss, uint64_t cap, uint32_t* valp) {
-  // Reads an integer in [0, cap].  Assumes first character is nonspace. 
+  // Reads an integer in [0, cap].  Assumes first character is nonspace.
   uint32_t val = (uint32_t)((unsigned char)(*ss++)) - 48;
   if (val >= 10) {
     if (val != 0xfffffffbU) {
@@ -355,7 +355,7 @@ uint32_t scan_uint_capped(const char* ss, uint64_t cap, uint32_t* valp) {
       // accept "-0", "-00", etc.
       while (*(++ss) == '0');
       *valp = 0;
-      return ((uint32_t)((unsigned char)(*ss)) - 48) < 10;      
+      return ((uint32_t)((unsigned char)(*ss)) - 48) < 10;
     }
     // accept leading '+'
     val = (uint32_t)((unsigned char)(*ss++)) - 48;
@@ -422,7 +422,7 @@ uint32_t scan_posint_capped32(const char* ss, uint32_t cap_div_10, uint32_t cap_
 }
 
 uint32_t scan_uint_capped32(const char* ss, uint32_t cap_div_10, uint32_t cap_mod_10, uint32_t* valp) {
-  // Reads an integer in [0, cap].  Assumes first character is nonspace. 
+  // Reads an integer in [0, cap].  Assumes first character is nonspace.
   uint32_t val = (uint32_t)((unsigned char)(*ss++)) - 48;
   if (val >= 10) {
     if (val != 0xfffffffbU) {
@@ -482,7 +482,7 @@ uint32_t scan_int_abs_bounded32(const char* ss, uint32_t bound_div_10, uint32_t
 
 uint32_t scan_posintptr(const char* ss, uintptr_t* valp) {
   // Reads an integer in [1, 2^BITCT - 1].  Assumes first character is
-  // nonspace. 
+  // nonspace.
   uintptr_t val = (uintptr_t)((unsigned char)(*ss++)) - 48;
   if (val >= 10) {
 #ifdef __LP64__
@@ -1512,7 +1512,7 @@ static inline void double_bround1(double dxx, const double* banker_round, uint32
   uint32_t remainder = (int32_t)dxx;
   remainder += (int32_t)((dxx - ((int32_t)remainder)) + banker_round[remainder & 1]);
   *quotientp = remainder / 10;
-  *remainderp = remainder - (*quotientp) * 10; 
+  *remainderp = remainder - (*quotientp) * 10;
 }
 
 static inline void double_bround2(double dxx, const double* banker_round, uint32_t* quotientp, uint32_t* remainderp) {
@@ -1520,7 +1520,7 @@ static inline void double_bround2(double dxx, const double* banker_round, uint32
   uint32_t remainder = (int32_t)dxx;
   remainder += (int32_t)((dxx - ((int32_t)remainder)) + banker_round[remainder & 1]);
   *quotientp = remainder / 100;
-  *remainderp = remainder - (*quotientp) * 100; 
+  *remainderp = remainder - (*quotientp) * 100;
 }
 
 static inline void double_bround3(double dxx, const double* banker_round, uint32_t* quotientp, uint32_t* remainderp) {
@@ -1528,7 +1528,7 @@ static inline void double_bround3(double dxx, const double* banker_round, uint32
   uint32_t remainder = (int32_t)dxx;
   remainder += (int32_t)((dxx - ((int32_t)remainder)) + banker_round[remainder & 1]);
   *quotientp = remainder / 1000;
-  *remainderp = remainder - (*quotientp) * 1000; 
+  *remainderp = remainder - (*quotientp) * 1000;
 }
 
 static inline void double_bround4(double dxx, const double* banker_round, uint32_t* quotientp, uint32_t* remainderp) {
@@ -1536,7 +1536,7 @@ static inline void double_bround4(double dxx, const double* banker_round, uint32
   uint32_t remainder = (int32_t)dxx;
   remainder += (int32_t)((dxx - ((int32_t)remainder)) + banker_round[remainder & 1]);
   *quotientp = remainder / 10000;
-  *remainderp = remainder - (*quotientp) * 10000; 
+  *remainderp = remainder - (*quotientp) * 10000;
 }
 
 static inline void double_bround5(double dxx, const double* banker_round, uint32_t* quotientp, uint32_t* remainderp) {
@@ -1544,7 +1544,7 @@ static inline void double_bround5(double dxx, const double* banker_round, uint32
   uint32_t remainder = (int32_t)dxx;
   remainder += (int32_t)((dxx - ((int32_t)remainder)) + banker_round[remainder & 1]);
   *quotientp = remainder / 100000;
-  *remainderp = remainder - (*quotientp) * 100000; 
+  *remainderp = remainder - (*quotientp) * 100000;
 }
 
 static inline void double_bround6(double dxx, const double* banker_round, uint32_t* quotientp, uint32_t* remainderp) {
@@ -1552,7 +1552,7 @@ static inline void double_bround6(double dxx, const double* banker_round, uint32
   uint32_t remainder = (int32_t)dxx;
   remainder += (int32_t)((dxx - ((int32_t)remainder)) + banker_round[remainder & 1]);
   *quotientp = remainder / 1000000;
-  *remainderp = remainder - (*quotientp) * 1000000; 
+  *remainderp = remainder - (*quotientp) * 1000000;
 }
 
 static inline void double_bround7(double dxx, const double* banker_round, uint32_t* quotientp, uint32_t* remainderp) {
@@ -1560,7 +1560,7 @@ static inline void double_bround7(double dxx, const double* banker_round, uint32
   uint32_t remainder = (int32_t)dxx;
   remainder += (int32_t)((dxx - ((int32_t)remainder)) + banker_round[remainder & 1]);
   *quotientp = remainder / 10000000;
-  *remainderp = remainder - (*quotientp) * 10000000; 
+  *remainderp = remainder - (*quotientp) * 10000000;
 }
 
 char* dtoa_so6(double dxx, char* start) {
@@ -3804,7 +3804,7 @@ uint32_t murmurhash3_32(const void* key, uint32_t len) {
       k1 *= c1;
       k1 = rotl32(k1,15);
       k1 *= c2;
-   
+
       h1 ^= k1;
       h1 = rotl32(h1,13);
       h1 = h1*5+0xe6546b64;
@@ -4785,7 +4785,7 @@ int32_t try_to_add_chrom_name(const char* chrom_name, const char* file_descrip,
   }
 
   // quasi-bugfix: remove redundant hash table check
-  
+
   if (chrom_name[0] == '#') {
     // redundant with some of the comment-skipping loaders, but this isn't
     // performance-critical
@@ -5651,7 +5651,8 @@ uint32_t bsearch_read_fam_indiv(char* __restrict read_ptr, const char* __restric
     *retval_ptr = -1;
     return 0;
   }
-  memcpy(memcpyax(id_buf, read_ptr, slen_fid, '\t'), iid_ptr, slen_iid);
+  // error message bugfix: null-terminate this string
+  memcpyx(memcpyax(id_buf, read_ptr, slen_fid, '\t'), iid_ptr, slen_iid, '\0');
   *retval_ptr = bsearch_str(id_buf, slen_final, lptr, max_id_len, filter_line_ct);
   return 0;
 }
@@ -6454,7 +6455,7 @@ uint32_t window_back(const uint32_t* __restrict marker_pos, const double* __rest
     }
     remaining_count -= uii;
     marker_uidx_last = marker_uwidx_cur;
-  window_back_zstart:  
+  window_back_zstart:
     cur_word = ~(*(--marker_exclude_cur));
     marker_uwidx_cur -= BITCT;
   }
@@ -8395,7 +8396,7 @@ void copy_quaterarr_nonempty_subset_excl(const uintptr_t* __restrict raw_quatera
       if (subset_excl_widx == subset_excl_widx_last) {
 	cur_include_word &= (ONELU << (raw_quaterarr_size % BITCT)) - ONELU;
       }
-      
+
       if (cur_include_word) {
 	uint32_t wordhalf_idx = 0;
 #ifdef __LP64__
@@ -8436,7 +8437,7 @@ void copy_quaterarr_nonempty_subset_excl(const uintptr_t* __restrict raw_quatera
 	  }
 	}
       }
-      subset_excl_widx++;	
+      subset_excl_widx++;
     }
   }
   // blocked copy
@@ -8569,7 +8570,7 @@ void copy_quaterarr_nonempty_subset(const uintptr_t* __restrict raw_quaterarr, c
 	  }
 	}
       }
-      subset_mask_widx++;	
+      subset_mask_widx++;
     }
   }
   // blocked copy
@@ -8694,7 +8695,7 @@ void inplace_quaterarr_proper_subset(const uintptr_t* __restrict subset_mask, ui
 	  }
 	}
       }
-      subset_mask_widx++;	
+      subset_mask_widx++;
     }
   }
   // blocked copy
@@ -9244,7 +9245,7 @@ void vec_rotate_plink1_to_plink2(uintptr_t* lptr, uint32_t word_ct) {
   __m128i vjj;
   do {
     // new high bit set iff old low bit was set
-    // new low bit set iff old bits differed 
+    // new low bit set iff old bits differed
     vii = *vptr;
     vjj = _mm_and_si128(vii, m1); // old low bit
     vii = _mm_and_si128(_mm_srli_epi64(vii, 1), m1); // old high bit, shifted
@@ -10161,10 +10162,10 @@ void copy_bitarr_subset(const uintptr_t* __restrict raw_bitarr, const uintptr_t*
   }
   while (item_idx < subset_size) {
     item_uidx = next_set_unsafe(subset_mask, item_uidx);
-    
+
     // can speed this up a bit once we have a guaranteed unset bit at the end
     item_uidx_stop = next_unset(subset_mask, item_uidx, raw_bitarr_size);
-    
+
     item_idx += item_uidx_stop - item_uidx;
     do {
       cur_output_word |= ((raw_bitarr[item_uidx / BITCT] >> (item_uidx % BITCT)) & 1) << word_write_shift;
diff --git a/plink_common.h b/plink_common.h
index 28e6728..ee22f8f 100644
--- a/plink_common.h
+++ b/plink_common.h
@@ -2122,7 +2122,7 @@ typedef struct {
   // currently tolerates out-of-order chromosomes, as long as all variants for
   // any given chromosome are together
   uint32_t* chrom_file_order;
-  
+
   // if the second chromosome in the dataset is chr5, chrom_file_order[1] == 5,
   // the raw variant indexes for chr5 are in [chrom_fo_vidx_start[1],
   // chrom_fo_vidx_start[2]). and chrom_idx_to_foidx[5] == 1.
diff --git a/plink_data.c b/plink_data.c
index 1046d32..7c289f4 100644
--- a/plink_data.c
+++ b/plink_data.c
@@ -3593,7 +3593,7 @@ int32_t make_bed(FILE* bedfile, uintptr_t bed_offset, char* bimname, char* outna
     bigstack_reset(map_reverse);
     if (calculation_type & CALC_MAKE_BIM) {
       logprint("done.\n");
-    }    
+    }
   }
 
   if (calculation_type & (CALC_MAKE_BED | CALC_MAKE_FAM)) {
@@ -4102,17 +4102,17 @@ int32_t oxford_to_bed(char* genname, char* samplename, char* outname, char* outn
     } while (is_eoln_kns(*bufptr));
     bufptr2 = token_endnn(bufptr);
     if ((((uintptr_t)(bufptr2 - bufptr)) != 4) || memcmp(bufptr, "ID_1", 4)) {
-      goto oxford_to_bed_ret_INVALID_SAMPLE_HEADER_1; 
+      goto oxford_to_bed_ret_INVALID_SAMPLE_HEADER_1;
     }
     bufptr = skip_initial_spaces(bufptr2);
     slen = strlen_se(bufptr);
     if ((slen != 4) || memcmp(bufptr, "ID_2", 4)) {
-      goto oxford_to_bed_ret_INVALID_SAMPLE_HEADER_1; 
+      goto oxford_to_bed_ret_INVALID_SAMPLE_HEADER_1;
     }
     bufptr = skip_initial_spaces(&(bufptr[4]));
     slen = strlen_se(bufptr);
     if ((slen != 7) || (!match_upper_counted(bufptr, "MISSING", 7))) {
-      goto oxford_to_bed_ret_INVALID_SAMPLE_HEADER_1; 
+      goto oxford_to_bed_ret_INVALID_SAMPLE_HEADER_1;
     }
     bufptr = skip_initial_spaces(&(bufptr[7]));
     if (pheno_name) {
@@ -4412,7 +4412,7 @@ int32_t oxford_to_bed(char* genname, char* samplename, char* outname, char* outn
 	  // maybe add a warning?
 	  fwrite(bufptr2, 1, strlen_se(bufptr2), outfile_bim);
 	  fputs(" 0 ", outfile_bim);
-	  fwrite(bufptr3, 1, bufptr4 - bufptr3, outfile_bim);        
+	  fwrite(bufptr3, 1, bufptr4 - bufptr3, outfile_bim);
 	} else {
 	  fwrite(bufptr2, 1, bufptr4 - bufptr2, outfile_bim);
 	}
@@ -5911,9 +5911,11 @@ int32_t ped_to_bed(char* pedname, char* mapname, char* outname, char* outname_en
     }
     // provisionally assume max_marker_allele_blen == 2
     // bugfix: allocate this after map_reverse
+    // quasi-bugfix (14 Nov 2017): need to zero-initialize marker_allele_cts
+    //   for consistent allele ordering
     if (bigstack_alloc_c(marker_ct * 2, &marker_alleles_f) ||
 	bigstack_calloc_c(marker_ct * 4, &marker_alleles) ||
-	bigstack_alloc_ui(marker_ct * 4, &marker_allele_cts)) {
+	bigstack_calloc_ui(marker_ct * 4, &marker_allele_cts)) {
       goto ped_to_bed_ret_NOMEM;
     }
 
@@ -8014,7 +8016,7 @@ int32_t vcf_to_bed(char* vcfname, char* outname, char* outname_end, int32_t miss
       if ((uii > 4) && (!memcmp(&(vcfname[uii - 4]), ".vcf", 4))) {
 	LOGERRPRINTFWW("Error: Failed to open %s.\n", vcfname);
       } else {
-	LOGERRPRINTFWW("Error: Failed to open %s. (--vcf expects a complete filename; did you forget '.vcf' at the end?)\n", vcfname);	
+	LOGERRPRINTFWW("Error: Failed to open %s. (--vcf expects a complete filename; did you forget '.vcf' at the end?)\n", vcfname);
       }
       goto vcf_to_bed_ret_OPEN_FAIL;
     }
@@ -8218,7 +8220,7 @@ int32_t vcf_to_bed(char* vcfname, char* outname, char* outname_end, int32_t miss
 	  break;
 	}
 	cc = *(++bufptr);
-	alt_ct++;      
+	alt_ct++;
       }
       if (cc != '\t') {
 	sprintf(g_logbuf, "Error: Malformed ALT field on line %" PRIuPTR " of .vcf file.\n", line_idx);
@@ -8342,7 +8344,7 @@ int32_t vcf_to_bed(char* vcfname, char* outname, char* outname_end, int32_t miss
 	    // other things, providing a useful error message instead of
 	    // segfaulting on an invalid GT field, to help other tool
 	    // developers.
-	    
+
 	    if (uii <= 9) {
 	      // no GQ field with ./. calls, so this check cannot occur earlier
 	      if (gq_field_pos) {
@@ -12425,7 +12427,7 @@ int32_t recode(uint32_t recode_modifier, FILE* bedfile, uintptr_t bed_offset, ch
       // to the output header line.  If that's not what the user wants,
       // they can do a two-step recode.
       // (--recode12 simply overrode --recodeA/--recodeAD in PLINK 1.07; no
-      // need to replicate that.) 
+      // need to replicate that.)
       retval = recode_allele_load((char*)loadbuf, ulii, recode_allele_name, &allele_missing, unfiltered_marker_ct, marker_exclude, marker_ct, marker_ids, max_marker_id_len, marker_allele_ptrs, max_marker_allele_len, recode_allele_reverse, recode_allele_extra);
       bigstack_end_reset(bigstack_end_mark);
       if (retval) {
@@ -14925,7 +14927,7 @@ int32_t merge_bim_scan(char* bimname, uint32_t is_binary, uint32_t allow_no_vari
     *cur_marker_ct_ptr = cur_marker_ct;
     *position_warning_ct_ptr = position_warning_ct;
   }
-  
+
   while (0) {
   merge_bim_scan_ret_NOMEM:
     retval = RET_NOMEM;
@@ -15704,6 +15706,8 @@ int32_t merge_main(char* bedname, char* bimname, char* famname, char* bim_loadbu
 	      ukk = uii * 2;
 	    } else if (marker_allele_ptrs[uii * 2 + 1] == missing_geno_ptr) {
               ukk = uii * 2 + 1;
+              // bugfix (14 Nov 2017): forgot to increment the A2 allele count!
+              ++ucc2;
 	    } else {
 	      goto merge_main_ret_NOT_BIALLELIC;
 	    }
@@ -16108,6 +16112,10 @@ int32_t merge_datasets(char* bedname, char* bimname, char* famname, char* outnam
     goto merge_datasets_ret_INVALID_FORMAT_2;
   }
 #endif
+  if (max_sample_id_len > 2 * MAX_ID_BLEN) {
+    logerrprint("Error: FIDs and IIDs are limited to " MAX_ID_SLEN_STR " characters.\n");
+    goto merge_datasets_ret_INVALID_FORMAT;
+  }
   tot_sample_ct = ullxx;
   if (sample_sort & (SAMPLE_SORT_NONE | SAMPLE_SORT_FILE)) {
     if (bigstack_alloc_ui(tot_sample_ct, &sample_nsmap)) {
@@ -16344,6 +16352,12 @@ int32_t merge_datasets(char* bedname, char* bimname, char* famname, char* outnam
     goto merge_datasets_ret_INVALID_FORMAT;
   }
 #endif
+  if (max_marker_id_len > MAX_ID_BLEN) {
+    logerrprint("Error: Variant names are limited to " MAX_ID_SLEN_STR " characters.\n");
+    goto merge_datasets_ret_INVALID_FORMAT;
+  } else if (max_marker_id_len > 80) {
+    logerrprint("Warning: Unusually long variant ID(s) present.  PLINK 1.9 does not scale well\nto length-80+ variant IDs; consider using a different naming scheme for long\nindels and the like.\n");
+  }
   if (non_biallelics) {
     bigstack_reset(bigstack_mark);
     retval = report_non_biallelics(outname, outname_end, non_biallelics);
diff --git a/plink_first_compile b/plink_first_compile
index 639b38b..2395726 100755
--- a/plink_first_compile
+++ b/plink_first_compile
@@ -25,4 +25,4 @@ make
 
 # Compile
 cd ../1.9
-make plink
+make -f Makefile.std plink
diff --git a/plink_ld.c b/plink_ld.c
index 0db5e15..d14a719 100644
--- a/plink_ld.c
+++ b/plink_ld.c
@@ -1679,7 +1679,7 @@ int32_t flipscan(Ld_info* ldip, FILE* bedfile, uintptr_t bed_offset, uintptr_t m
     *wptr_start++ = ' ';
     is_haploid = is_set(chrom_info_ptr->haploid_mask, chrom_idx);
     is_x = (chrom_idx == ((uint32_t)chrom_info_ptr->xymt_codes[X_OFFSET]));
-    is_y = (chrom_idx == ((uint32_t)chrom_info_ptr->xymt_codes[Y_OFFSET]));    
+    is_y = (chrom_idx == ((uint32_t)chrom_info_ptr->xymt_codes[Y_OFFSET]));
     if (fseeko(bedfile, bed_offset + (marker_uidx * ((uint64_t)unfiltered_sample_ct4)), SEEK_SET)) {
       goto flipscan_ret_READ_FAIL;
     }
@@ -3727,7 +3727,7 @@ double fepi_counts_to_boost_chisq(uint32_t* counts, double* p_bc, double* p_ca,
   }
   if (interaction_measure >= alpha2sq_ptr[df_adj]) {
     *sig_ct1_ptr += 1;
-    *sig_ct2_ptr += 1;    
+    *sig_ct2_ptr += 1;
   }
   return interaction_measure;
 }
@@ -7958,7 +7958,7 @@ int32_t twolocus(Epi_info* epi_ip, FILE* bedfile, uintptr_t bed_offset, uintptr_
   }
   if (marker_idx == marker_ct) {
     goto twolocus_ret_MARKER_NOT_FOUND;
-  }  
+  }
   if (bigstack_alloc_ul(unfiltered_sample_ctl2, &loadbuf_raw) ||
       bigstack_alloc_ul(sample_ctl2, &loadbufs[0]) ||
       bigstack_alloc_ul(sample_ctl2, &loadbufs[1])) {
@@ -9844,7 +9844,7 @@ int32_t epistasis_report(pthread_t* threads, Epi_info* epi_ip, FILE* bedfile, ui
     wptr = memcpya(wptr, " to ", 4);
     wptr = strcpya(wptr, outname);
     memcpy(wptr, " ... ", 6);
-    wordwrapb(16); // strlen("99% [processing]") 
+    wordwrapb(16); // strlen("99% [processing]")
     logprintb();
     fputs("0%", stdout);
     do {
@@ -12012,7 +12012,7 @@ int32_t construct_ld_map(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset
 	  bitvec_or(&(tmp_set_bitfield[firstw]), wlen - firstw, &(load2_bitfield[firstw]));
 	}
       }
-    }    
+    }
     load_idx2_tot = popcount_longs(load2_bitfield, marker_ctv);
     if (!load_idx2_tot) {
       // no new r^2 computations to make at all!
@@ -12843,7 +12843,7 @@ int32_t clump_reports(FILE* bedfile, uintptr_t bed_offset, char* outname, char*
   // P-value, 2 or more = annotation).
   // In the main loop, cur_parse_info[2k] stores the in-loadbuft offset of the
   // the string with that parse_table[2k] index, and cur_parse_info[2k + 1]
-  // stores string length. 
+  // stores string length.
   annot_ct_p2 = 2 + annot_ct;
   annot_ct_p2_ctl = (annot_ct + (BITCT + 1)) / BITCT;
   if (bigstack_alloc_c(max_header_len * header_dict_ct, &sorted_header_dict) ||
@@ -13217,7 +13217,7 @@ int32_t clump_reports(FILE* bedfile, uintptr_t bed_offset, char* outname, char*
     index_data[uii * founder_ctv2 - 1] = 0;
   }
   if (alloc_collapsed_haploid_filters(founder_info, sex_male, unfiltered_sample_ct, founder_ct, Y_FIX_NEEDED, 1, &founder_include2, &founder_male_include2)) {
-    goto clump_reports_ret_NOMEM; 
+    goto clump_reports_ret_NOMEM;
  }
   if (clump_verbose && rg_setdefs) {
     if (bigstack_alloc_ul(BITCT_TO_WORDCT(range_chrom_max), &rangematch_bitfield)) {
@@ -13487,7 +13487,7 @@ int32_t clump_reports(FILE* bedfile, uintptr_t bed_offset, char* outname, char*
     // iff
     //   i. there were co-located entries in the first place, and either
     //     ii-a. overlaps are permitted or
-    //     ii-b. index variant position was not previously clumped 
+    //     ii-b. index variant position was not previously clumped
     if ((uii || nsig_arr[ivar_idx]) && (allow_overlap || (!is_set(cur_bitfield, ivar_idx)))) {
       histo[0] += nsig_arr[ivar_idx];
       set_bit(ivar_idx, cur_bitfield);
diff --git a/plink_misc.c b/plink_misc.c
index 09f356b..6ebff41 100644
--- a/plink_misc.c
+++ b/plink_misc.c
@@ -186,7 +186,7 @@ int32_t makepheno_load(FILE* phenofile, char* makepheno_str, uintptr_t unfiltere
     fill_all_bits(unfiltered_sample_ct, pheno_nm);
   }
   // probably want to permit long lines here
-  g_textbuf[MAXLINELEN - 1] = ' '; 
+  g_textbuf[MAXLINELEN - 1] = ' ';
   while (fgets(g_textbuf, MAXLINELEN, phenofile) != nullptr) {
     line_idx++;
     if (!g_textbuf[MAXLINELEN - 1]) {
@@ -363,7 +363,7 @@ int32_t load_pheno(FILE* phenofile, uintptr_t unfiltered_sample_ct, uintptr_t sa
 	if (ss == bufptr) {
 	  dxx = missing_phenod;
 	}
-	
+
 	if (affection) {
 	  if (dxx == pheno_cased) {
 	    set_bit(sample_idx, pheno_c);
@@ -5102,7 +5102,7 @@ int32_t meta_analysis_open_and_read_header(const char* fname, char* loadbuf, uin
     col_sequence[uii] = ujj & 15;
   }
   *token_ct_ptr = token_ct;
-  
+
   while (0) {
   meta_analysis_open_and_read_header_ret_NOMEM:
     retval = RET_NOMEM;
@@ -5283,7 +5283,8 @@ int32_t meta_analysis(char* input_fnames, char* snpfield_search_order, char* a1f
   {
     // 1. Construct header search dictionary.  Similar to clump_reports().
     if (snpfield_search_order) {
-      header_dict_ct = count_and_measure_multistr(snpfield_search_order, &max_header_len);
+      // bugfix (3 Nov 2017): this needs to be +=, not =
+      header_dict_ct += count_and_measure_multistr(snpfield_search_order, &max_header_len);
     } else {
       max_header_len = 4; // 'SNP' + null terminator
       header_dict_ct++;
@@ -5370,7 +5371,8 @@ int32_t meta_analysis(char* input_fnames, char* snpfield_search_order, char* a1f
 	header_id_map[ulii++] = 0x20000000;
       }
       if (essfield_search_order) {
-	bufptr = pfield_search_order;
+        // bugfix (3 Nov 2017): had pfield_search_order here
+	bufptr = essfield_search_order;
 	uii = 0x30000000;
 	do {
 	  slen = strlen(bufptr) + 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/plink1.9.git



More information about the debian-med-commit mailing list