[med-svn] [plink1.9] 01/02: Imported Upstream version 1.90~b3.46-170213

Dylan Aïssi bob.dybian-guest at moszumanska.debian.org
Wed Feb 22 22:36:19 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 cc58cd2b5b51bb8b801e79440602c6d47bc51bbd
Author: Dylan Aïssi <bob.dybian at gmail.com>
Date:   Wed Feb 22 23:36:01 2017 +0100

    Imported Upstream version 1.90~b3.46-170213
---
 Makefile            |  6 +++---
 pigz.c              |  4 ++--
 plink.c             |  4 ++--
 plink_common.h      |  2 +-
 plink_data.c        |  9 +++++----
 plink_first_compile | 17 ++++++++++++-----
 plink_ld.c          |  9 +++------
 plink_rserve.c      | 20 +++++++++++++++++---
 8 files changed, 45 insertions(+), 26 deletions(-)

diff --git a/Makefile b/Makefile
index cd57113..bb156e5 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ endif
 CFLAGS=-Wall -O2
 BLASFLAGS=-L/usr/lib64/atlas -llapack -lcblas -latlas
 LINKFLAGS=-lm -lpthread -ldl
-ZLIB=zlib-1.2.10/libz.so.1.2.10
+ZLIB=zlib-1.2.11/libz.so.1.2.11
 
 ifeq ($(SYS), MAC)
   GCC_GTEQ_43 := $(shell expr `g++ -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \>= 40300)
@@ -36,7 +36,7 @@ ifeq ($(SYS), MAC)
   endif
   BLASFLAGS=-framework Accelerate
   LINKFLAGS=-ldl
-  ZLIB=zlib-1.2.10/libz.1.2.10.dylib
+  ZLIB=zlib-1.2.11/libz.1.2.11.dylib
 endif
 
 ifeq ($(SYS), WIN)
@@ -47,7 +47,7 @@ ifeq ($(SYS), WIN)
 # NO_LAPACK.
   BLASFLAGS=-L. lapack/liblapack.a -L. lapack/librefblas.a
   LINKFLAGS=-lm -static-libgcc
-  ZLIB=zlib-1.2.10/libz.a
+  ZLIB=zlib-1.2.11/libz.a
 endif
 
 ifdef NO_LAPACK
diff --git a/pigz.c b/pigz.c
index 757a7fa..d83aa5e 100644
--- a/pigz.c
+++ b/pigz.c
@@ -300,7 +300,7 @@
 #ifdef DYNAMIC_ZLIB
   #include <zlib.h>
 #else
-  #include "zlib-1.2.10/zlib.h"
+  #include "zlib-1.2.11/zlib.h"
 #endif
 
 #include "pigz.h"
@@ -526,7 +526,7 @@ int32_t flex_pzwrite_close_null(Pigz_state* ps_ptr, char* writep) {
 #ifdef DYNAMIC_ZLIB
   #include <zlib.h>
 #else
-  #include "zlib-1.2.10/zlib.h" /* deflateInit2(), deflateReset(), deflate(), */
+  #include "zlib-1.2.11/zlib.h" /* deflateInit2(), deflateReset(), deflate(), */
                         /* deflateEnd(), deflateSetDictionary(), crc32(),
                            inflateBackInit(), inflateBack(), inflateBackEnd(),
                            Z_DEFAULT_COMPRESSION, Z_DEFAULT_STRATEGY,
diff --git a/plink.c b/plink.c
index 9e111e0..9fc762a 100644
--- a/plink.c
+++ b/plink.c
@@ -93,7 +93,7 @@
 
 static const char ver_str[] =
 #ifdef STABLE_BUILD
-  "PLINK v1.90b3.45"
+  "PLINK v1.90b3.46"
 #else
   "PLINK v1.90p"
 #endif
@@ -105,7 +105,7 @@ static const char ver_str[] =
 #else
   " 32-bit"
 #endif
-  " (13 Jan 2017)";
+  " (13 Feb 2017)";
 static const char ver_str2[] =
   // include leading space if day < 10, so character length stays the same
   ""
diff --git a/plink_common.h b/plink_common.h
index 8e2f54a..50b1c63 100644
--- a/plink_common.h
+++ b/plink_common.h
@@ -231,7 +231,7 @@
     #error "zlib version 1.2.4 or later required."
   #endif
 #else
-  #include "zlib-1.2.10/zlib.h"
+  #include "zlib-1.2.11/zlib.h"
 #endif
 #include "SFMT.h"
 
diff --git a/plink_data.c b/plink_data.c
index d98043f..23e789c 100644
--- a/plink_data.c
+++ b/plink_data.c
@@ -4849,10 +4849,11 @@ int32_t oxford_to_bed(char* genname, char* samplename, char* outname, char* outn
 	goto oxford_to_bed_ret_READ_FAIL;
       }
       if (uii & (~5)) {
-	uii = (uii >> 2) & 15;
-	if (uii == 2) {
-	  logerrprint("Error: BGEN v1.2 input requires PLINK 2.0 (under development as of this\nwriting).  Use gen-convert to downcode to BGEN v1.1 if you want to process this\ndata with PLINK 1.9.\n");
-	} else if (uii > 2) {
+	const uint32_t layout = (uii >> 2) & 15;
+	const uint32_t compression_mode = uii & 3;
+	if ((layout == 2) && (compression_mode != 3)) {
+	  LOGERRPRINTF("Error: BGEN v1.%c input requires PLINK 2.0 (under development as of this\nwriting).  Use gen-convert to downcode to BGEN v1.1 if you want to process this\ndata with PLINK 1.9.\n", (compression_mode == 2)? '3' : '2');
+	} else if (layout > 2) {
 	  logerrprint("Error: Unrecognized BGEN version.  Use gen-convert or a similar tool to\ndowncode to BGEN v1.1 if you want to process this data with PLINK 1.9.\n");
 	} else {
 	  logerrprint("Error: Unrecognized flags in .bgen header.  (PLINK 1.9 only supports\nBGEN v1.0 and v1.1.)\n");
diff --git a/plink_first_compile b/plink_first_compile
index 35e361a..39ebf51 100755
--- a/plink_first_compile
+++ b/plink_first_compile
@@ -1,17 +1,24 @@
 #!/bin/bash
 
 # Download and verify zlib
-EXPECTEDCHECKSUM=76af0bfb4d17fad1d8bda13cb5593c311f59adee
-curl -O http://zlib.net/zlib-1.2.10.tar.gz
-CHECKSUM=$(shasum zlib-1.2.10.tar.gz | cut -b-40)
+curl -Of http://zlib.net/zlib-1.2.11.tar.gz
+last_exit_code=$?
+if [ $last_exit_code -ne 0 ]; then
+    # There's a newer zlib, and we might want to update this script.  But
+    # download the hardcoded version for now to make the static build work...
+    curl -O http://zlib.net/fossils/zlib-1.2.11.tar.gz
+fi
+
+EXPECTEDCHECKSUM=e6d119755acdf9104d7ba236b1242696940ed6dd
+CHECKSUM=$(shasum zlib-1.2.11.tar.gz | cut -b-40)
 if [ "$EXPECTEDCHECKSUM" != "$CHECKSUM" ]; then
     echo "Zlib checksum verification failure"
     exit 1
 fi;
 
 # Unpack and compile zlib
-tar -xzvf zlib-1.2.10.tar.gz
-cd zlib-1.2.10
+tar -xzvf zlib-1.2.11.tar.gz
+cd zlib-1.2.11
 ./configure
 make
 
diff --git a/plink_ld.c b/plink_ld.c
index 2b0b655..0d6ccd8 100644
--- a/plink_ld.c
+++ b/plink_ld.c
@@ -8742,7 +8742,7 @@ int32_t epistasis_linear_regression(pthread_t* threads, Epi_info* epi_ip, FILE*
 	chrom_end2 = chrom_info_ptr->chrom_fo_vidx_start[chrom_fo_idx2 + 1];
 	wptr_start2 = width_force(4, wptr_start, chrom_name_write(chrom_info_ptr, chrom_idx2, wptr_start));
 	*wptr_start2++ = ' ';
-	for (; marker_uidx2 < chrom_end2; next_unset_ul_ck(marker_exclude2, chrom_end2, &marker_uidx2), marker_idx2++, dptr = &(dptr[2])) {
+	for (; marker_uidx2 < chrom_end2; ++marker_uidx2, next_unset_ul_ck(marker_exclude2, unfiltered_marker_ct, &marker_uidx2), ++marker_idx2, dptr = &(dptr[2])) {
 	  if (marker_idx2 == ujj) {
 	    marker_idx2 = g_epi_geno1_offsets[2 * block_idx1 + 1];
 	    if (marker_idx2 == marker_ct2) {
@@ -8776,7 +8776,6 @@ int32_t epistasis_linear_regression(pthread_t* threads, Epi_info* epi_ip, FILE*
 	    // could remove this writeback in --epi1 1 case
 	    *dptr = -1;
 	  }
-	  marker_uidx2++;
 	}
       }
     epistasis_linear_regression_write_loop:
@@ -9219,7 +9218,7 @@ int32_t epistasis_logistic_regression(pthread_t* threads, Epi_info* epi_ip, FILE
 	chrom_end2 = chrom_info_ptr->chrom_fo_vidx_start[chrom_fo_idx2 + 1];
 	wptr_start2 = width_force(4, wptr_start, chrom_name_write(chrom_info_ptr, chrom_idx2, wptr_start));
 	*wptr_start2++ = ' ';
-	for (; marker_uidx2 < chrom_end2; next_unset_ul_ck(marker_exclude2, chrom_end2, &marker_uidx2), marker_idx2++, fptr = &(fptr[2])) {
+	for (; marker_uidx2 < chrom_end2; ++marker_uidx2, next_unset_ul_ck(marker_exclude2, unfiltered_marker_ct, &marker_uidx2), ++marker_idx2, fptr = &(fptr[2])) {
 	  if (marker_idx2 == ujj) {
 	    marker_idx2 = g_epi_geno1_offsets[2 * block_idx1 + 1];
 	    if (marker_idx2 == marker_ct2) {
@@ -9254,7 +9253,6 @@ int32_t epistasis_logistic_regression(pthread_t* threads, Epi_info* epi_ip, FILE
 	    // could remove this writeback in --epi1 1 case
 	    *fptr = -1;
 	  }
-	  marker_uidx2++;
 	}
       }
     epistasis_logistic_regression_write_loop:
@@ -10140,7 +10138,7 @@ int32_t epistasis_report(pthread_t* threads, Epi_info* epi_ip, FILE* bedfile, ui
           chrom_idx2 = chrom_info_ptr->chrom_file_order[chrom_fo_idx2];
           wptr_start2 = width_force(4, wptr_start, chrom_name_write(chrom_info_ptr, chrom_idx2, wptr_start));
 	  *wptr_start2++ = ' ';
-	  for (; marker_uidx2 < chrom_end2; next_unset_ul_ck(marker_exclude2, unfiltered_marker_ct, &marker_uidx2), marker_idx2++, dptr++) {
+	  for (; marker_uidx2 < chrom_end2; ++marker_uidx2, next_unset_ul_ck(marker_exclude2, unfiltered_marker_ct, &marker_uidx2), ++marker_idx2, ++dptr) {
 	    if (marker_idx2 == ujj) {
 	      marker_idx2 = g_epi_geno1_offsets[2 * block_idx1 + 1];
 	      if (marker_idx2 == marker_ct2) {
@@ -10200,7 +10198,6 @@ int32_t epistasis_report(pthread_t* threads, Epi_info* epi_ip, FILE* bedfile, ui
 	      // could remove this writeback in --epi1 1 case
 	      *dptr = -1;
 	    }
-	    marker_uidx2++;
 	  }
 	}
       epistasis_report_write_loop:
diff --git a/plink_rserve.c b/plink_rserve.c
index b72cb7e..5d1aa6c 100644
--- a/plink_rserve.c
+++ b/plink_rserve.c
@@ -64,6 +64,7 @@ int32_t rserve_call(char* rplugin_fname, uint32_t rplugin_port, uint32_t rplugin
   Rinteger* r_g;
   Rdouble* r_data;
   double* pheno_d2;
+  double* covar_d2 = nullptr;
   double* dptr;
   char* inbuf_start;
   char* inbuf_end;
@@ -149,6 +150,19 @@ int32_t rserve_call(char* rplugin_fname, uint32_t rplugin_port, uint32_t rplugin
   } else {
     pheno_d2 = pheno_d;
   }
+  if (covar_ct) {
+    if (pheno_nm_ct == unfiltered_sample_ct) {
+      covar_d2 = covar_d;
+    } else {
+      if (bigstack_alloc_d(pheno_nm_ct * covar_ct, &covar_d2)) {
+	goto rserve_call_ret_NOMEM;
+      }
+      for (sample_uidx = 0, sample_idx = 0; sample_idx < pheno_nm_ct; ++sample_uidx, ++sample_idx) {
+	next_set_unsafe_ck(pheno_nm, &sample_uidx);
+	memcpy(&(covar_d2[sample_idx * covar_ct]), &(covar_d[sample_uidx * covar_ct]), covar_ct * sizeof(double));
+      }
+    }
+  }
   if (cluster_ct) {
     if (bigstack_alloc_i(unfiltered_sample_ct, &sample_to_cluster)) {
       goto rserve_call_ret_NOMEM;
@@ -183,7 +197,7 @@ int32_t rserve_call(char* rplugin_fname, uint32_t rplugin_port, uint32_t rplugin
     rc->assign("CLUSTER", r_s);
     rc->eval("CLUSTER[CLUSTER==-1] <- NA");
     if (covar_ct) {
-      r_cov = new Rdouble(covar_d, pheno_nm_ct * covar_ct);
+      r_cov = new Rdouble(covar_d2, pheno_nm_ct * covar_ct);
       rc->assign("c", r_cov);
       rc->eval("COVAR<-matrix(c,nrow=n,byrow=T)");
     } else {
@@ -221,11 +235,11 @@ int32_t rserve_call(char* rplugin_fname, uint32_t rplugin_port, uint32_t rplugin
       fputs("c <- c( ", outfile);
       uljj = pheno_nm_ct * covar_ct - 1;
       for (ulii = 0; ulii < uljj; ulii++) {
-	bufptr = dtoa_g(covar_d[ulii], g_textbuf);
+	bufptr = dtoa_g(covar_d2[ulii], g_textbuf);
 	bufptr = memcpya(bufptr, ", ", 2);
 	fwrite(g_textbuf, 1, (uintptr_t)(bufptr - g_textbuf), outfile);
       }
-      bufptr = dtoa_g(covar_d[ulii], g_textbuf);
+      bufptr = dtoa_g(covar_d2[ulii], g_textbuf);
       fwrite(g_textbuf, 1, (uintptr_t)(bufptr - g_textbuf), outfile);
       fputs(" ) \nCOVAR <- matrix( c , nrow = n , byrow=T)\n", outfile);
     } else {

-- 
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