[med-svn] [plink1.9] 01/02: Imported Upstream version 1.90~b3.43-161010
Dylan Aïssi
bob.dybian-guest at moszumanska.debian.org
Sun Oct 23 21:53:32 UTC 2016
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 96b85b5e183fafe053cfbd4a5717e7339d692411
Author: Dylan Aïssi <bob.dybian at gmail.com>
Date: Sun Oct 23 23:45:57 2016 +0200
Imported Upstream version 1.90~b3.43-161010
---
bgzf.c | 2 ++
plink.c | 15 ++++++++-------
plink_assoc.c | 30 ++++++++++++++++++++++++++----
plink_assoc.h | 17 +++++++++++++++++
plink_calc.c | 17 +++++++++++++++++
plink_cluster.c | 19 +++++++++++++++++++
plink_cnv.c | 17 +++++++++++++++++
plink_cnv.h | 17 +++++++++++++++++
plink_common.c | 17 +++++++++++++++++
plink_common.h | 37 +++++++++++++++++++++++++++++--------
plink_data.c | 37 ++++++++++++++++++++++---------------
plink_data.h | 17 +++++++++++++++++
plink_dosage.c | 17 +++++++++++++++++
plink_dosage.h | 17 +++++++++++++++++
plink_family.c | 19 ++++++++++++++++++-
plink_family.h | 17 +++++++++++++++++
plink_filter.c | 35 ++++++++++++++++++++++++-----------
plink_filter.h | 17 +++++++++++++++++
plink_glm.c | 25 +++++++++++++++++++++----
plink_glm.h | 17 +++++++++++++++++
plink_help.c | 19 ++++++++++++++++++-
plink_help.h | 17 +++++++++++++++++
plink_homozyg.c | 18 ++++++++++++++++++
plink_homozyg.h | 17 +++++++++++++++++
plink_lasso.c | 17 +++++++++++++++++
plink_lasso.h | 17 +++++++++++++++++
plink_ld.c | 35 +++++++++++++++++++++++++++++++----
plink_ld.h | 17 +++++++++++++++++
plink_matrix.c | 17 +++++++++++++++++
plink_matrix.h | 17 +++++++++++++++++
plink_misc.c | 18 ++++++++++++++++++
plink_misc.h | 17 +++++++++++++++++
plink_perm.c | 17 +++++++++++++++++
plink_perm.h | 17 +++++++++++++++++
plink_rserve.c | 17 +++++++++++++++++
plink_rserve.h | 17 +++++++++++++++++
plink_set.c | 17 +++++++++++++++++
plink_set.h | 17 +++++++++++++++++
plink_stats.c | 21 +++++++++++++++++++--
plink_stats.h | 17 +++++++++++++++++
40 files changed, 715 insertions(+), 57 deletions(-)
diff --git a/bgzf.c b/bgzf.c
index a6c9c9b..60e3d3c 100644
--- a/bgzf.c
+++ b/bgzf.c
@@ -23,6 +23,8 @@
THE SOFTWARE.
*/
+#define _FILE_OFFSET_BITS 64
+
#include <errno.h>
#include <unistd.h>
#include <assert.h>
diff --git a/plink.c b/plink.c
index 09967d6..beca41d 100644
--- a/plink.c
+++ b/plink.c
@@ -1,19 +1,20 @@
-// PLINK 1.90
-// Copyright (C) 2005-2016 Shaun Purcell, Christopher Chang
-
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
// Uncomment "#define NOLAPACK" in plink_common.h to build without LAPACK.
#include "plink_common.h"
@@ -92,7 +93,7 @@
static const char ver_str[] =
#ifdef STABLE_BUILD
- "PLINK v1.90b3.40"
+ "PLINK v1.90b3.43"
#else
"PLINK v1.90p"
#endif
@@ -104,7 +105,7 @@ static const char ver_str[] =
#else
" 32-bit"
#endif
- " (16 Aug 2016)";
+ " (10 Oct 2016)";
static const char ver_str2[] =
// include leading space if day < 10, so character length stays the same
""
diff --git a/plink_assoc.c b/plink_assoc.c
index c9c5ef9..f41f0ad 100644
--- a/plink_assoc.c
+++ b/plink_assoc.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_assoc.h"
@@ -4809,15 +4826,20 @@ THREAD_RET_TYPE model_maxt_gen_thread(void* arg) {
for (; marker_bidx < marker_bceil; marker_bidx++) {
if (model_fisher) {
if (orig_pvals[marker_idx] == -9) {
+ model_maxt_gen_thread_skip_marker:
marker_idx++;
+ if (msa_ptr) {
+ for (pidx = 0; pidx < perm_vec_ct; ++pidx) {
+ *msa_ptr++ = -9;
+ }
+ }
continue;
}
stat_high = orig_pvals[marker_idx] * (1.0 + EPSILON);
stat_low = orig_pvals[marker_idx] * (1.0 - EPSILON);
} else {
if (orig_chisq[marker_idx] == -9) {
- marker_idx++;
- continue;
+ goto model_maxt_gen_thread_skip_marker;
}
stat_high = orig_chisq[marker_idx] + EPSILON;
stat_low = orig_chisq[marker_idx] - EPSILON;
@@ -6202,7 +6224,7 @@ int32_t model_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, cha
goto model_assoc_ret_WRITE_FAIL;
}
if (display_ci) {
- uii = (uint32_t)((int32_t)(ci_size * 100));
+ uii = (uint32_t)((int32_t)(ci_size * (100 + EPSILON)));
if (uii >= 10) {
fprintf(outfile, " SE L%u U%u ", uii, uii);
} else {
@@ -11065,7 +11087,7 @@ int32_t cmh_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, char*
fflush(stdout);
sprintf(g_textbuf, " CHR %%%us BP A1 MAF A2 CHISQ P OR SE ", plink_maxsnp);
fprintf(outfile, g_textbuf, "SNP");
- uii = (uint32_t)((int32_t)(ci_size * 100));
+ uii = (uint32_t)((int32_t)(ci_size * (100 + EPSILON)));
if (uii >= 10) {
fprintf(outfile, "L%u U%u ", uii, uii);
} else {
diff --git a/plink_assoc.h b/plink_assoc.h
index 2d81f4b..668d56d 100644
--- a/plink_assoc.h
+++ b/plink_assoc.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_ASSOC_H__
#define __PLINK_ASSOC_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#define TESTMISS_PERM 1
#define TESTMISS_MPERM 2
#define TESTMISS_PERM_COUNT 4
diff --git a/plink_calc.c b/plink_calc.c
index 2382c6c..7b567b6 100644
--- a/plink_calc.c
+++ b/plink_calc.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
// The key ideas behind this calculator's design are:
//
// 1. Incremental processing of SNPs. Each element A_{jk} of a distance or
diff --git a/plink_cluster.c b/plink_cluster.c
index c323e3e..6dabe11 100644
--- a/plink_cluster.c
+++ b/plink_cluster.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_cluster.h"
@@ -473,6 +490,8 @@ int32_t load_clusters(char* fname, uintptr_t unfiltered_sample_ct, uintptr_t* sa
sorted_idx = bsearch_str(cluster_name_ptr, slen, sorted_remove_ids, max_cluster_kr_len, cluster_kr_ct);
if (sorted_idx != -1) {
set_bit(sample_uidx, sample_exclude_new);
+ // bugfix: forgot to avoid incrementing assigned_ct
+ continue;
}
}
if (slen >= max_cluster_id_len) {
diff --git a/plink_cnv.c b/plink_cnv.c
index e797fe2..dddcc9b 100644
--- a/plink_cnv.c
+++ b/plink_cnv.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
int32_t cnv_subset_load(char* subset_fname, char** subset_list_ptr, uintptr_t* subset_ct_ptr, uintptr_t* max_subset_name_len_ptr) {
diff --git a/plink_cnv.h b/plink_cnv.h
index fab05ee..9e8303f 100644
--- a/plink_cnv.h
+++ b/plink_cnv.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_CNV_H__
#define __PLINK_CNV_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
int32_t plink_cnv(char* outname, char* outname_end, char* cnvname, char* mapname, char* famname, char* phenoname, char* keepname, char* removename, char* filtername, uint64_t misc_flags, Two_col_params* update_chr, Two_col_params* update_cm, Two_col_params* update_map, Two_col_params* update_name, char* update_ids_fname, char* update_parents_fname, char* update_sex_fname, char* filtervals_flattened, uint64_t filter_flags, uint32_t cnv_calc_type, uint32_t min_seglen, uint32_t max_seglen, [...]
int32_t plink_gvar(char* outname, char* outname_end, char* gvarname, char* mapname, char* famname);
diff --git a/plink_common.c b/plink_common.c
index 06fdab5..8399099 100644
--- a/plink_common.c
+++ b/plink_common.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
// #include "pigz.h"
diff --git a/plink_common.h b/plink_common.h
index e8666df..62bd4b6 100644
--- a/plink_common.h
+++ b/plink_common.h
@@ -1,8 +1,27 @@
-// Resources needed across all plink modules.
-
#ifndef __PLINK_COMMON_H__
#define __PLINK_COMMON_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+// Resources needed across all plink modules.
+
+#define _FILE_OFFSET_BITS 64
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -108,11 +127,14 @@
#define CTZLU __builtin_ctzl
#define CLZLU __builtin_clzl
#ifndef __LP64__
- #ifndef uintptr_t
- #define uintptr_t unsigned long
- #endif
- #ifndef intptr_t
- #define intptr_t long
+ // attempt to patch GCC 6 build failure
+ #if (__GNUC__ <= 4) && (__GNUC_MINOR__ < 8)
+ #ifndef uintptr_t
+ #define uintptr_t unsigned long
+ #endif
+ #ifndef intptr_t
+ #define intptr_t long
+ #endif
#endif
#endif
#endif
@@ -733,7 +755,6 @@ HEADER_INLINE uint32_t round_up_pow2_ui(uint32_t val, uint32_t alignment) {
#define MAXV(aa, bb) (((bb) > (aa))? (bb) : (aa))
#define MINV(aa, bb) (((aa) > (bb))? (bb) : (aa))
-#define _FILE_OFFSET_BITS 64
#ifdef _WIN32
// if MAX_THREADS > 65, single WaitForMultipleObjects calls must be converted
// into loops
diff --git a/plink_data.c b/plink_data.c
index c19237c..b553cd8 100644
--- a/plink_data.c
+++ b/plink_data.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include <ctype.h>
@@ -7920,15 +7937,12 @@ int32_t transposed_to_bed(char* tpedname, char* tfamname, char* outname, char* o
}
transposed_to_bed_ret_1:
chrom_info_ptr->zero_extra_chroms = orig_zec;
- printf("step 1\n");
for (uii = 0; uii < allele_tot; uii++) {
if (alleles[uii][1]) {
free(alleles[uii]);
}
}
- printf("step 2\n");
cleanup_allele_storage(max_marker_allele_blen - 1, marker_ct * 2, marker_allele_ptrs);
- printf("step 3\n");
fclose_cond(infile);
fclose_cond(bimfile);
fclose_cond(outfile);
@@ -12854,7 +12868,7 @@ int32_t recode(uint32_t recode_modifier, FILE* bedfile, uintptr_t bed_offset, ch
goto recode_ret_OPEN_FAIL;
}
} else {
- memcpy(outname_end, ".vcf.gz", 7);
+ memcpy(outname_end, ".vcf.gz", 8);
bgz_outfile = bgzf_open(outname, "w");
if (!bgz_outfile) {
goto recode_ret_OPEN_FAIL;
@@ -13018,18 +13032,11 @@ int32_t recode(uint32_t recode_modifier, FILE* bedfile, uintptr_t bed_offset, ch
invalid_allele_code_seen = 1;
}
// if ALT allele was not actually present in immediate dataset, VCF
- // spec actually required '.'
+ // spec actually used to require '.'
// this restriction was contrary to practice (even by the 1000G team)
- // and should be retroactively removed very soon: see
- // github.com/samtools/hts-specs/pull/152
- if (!is_monomorphic_a2(loadbuf_collapsed, sample_ct)) {
- if (flexbputs_checked(cptr, output_bgz, outfile, bgz_outfile)) {
- goto recode_ret_WRITE_FAIL;
- }
- } else {
- if (flexbputc_checked('.', output_bgz, outfile, bgz_outfile)) {
- goto recode_ret_WRITE_FAIL;
- }
+ // and was removed from plink after b3.41.
+ if (flexbputs_checked(cptr, output_bgz, outfile, bgz_outfile)) {
+ goto recode_ret_WRITE_FAIL;
}
} else {
if (flexbputc_checked('.', output_bgz, outfile, bgz_outfile)) {
diff --git a/plink_data.h b/plink_data.h
index 400e8c0..c745726 100644
--- a/plink_data.h
+++ b/plink_data.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_DATA_H__
#define __PLINK_DATA_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
int32_t sample_major_to_snp_major(char* sample_major_fname, char* outname, uintptr_t unfiltered_marker_ct, uintptr_t unfiltered_sample_ct, uint64_t fsize);
int32_t load_bim(char* bimname, uintptr_t* unfiltered_marker_ct_ptr, uintptr_t* marker_exclude_ct_ptr, uintptr_t* max_marker_id_blen_ptr, uintptr_t** marker_exclude_ptr, double** set_allele_freqs_ptr, uint32_t** nchrobs_ptr, char*** marker_allele_pp, uintptr_t* max_marker_allele_blen_ptr, char** marker_ids_ptr, char* missing_mid_template, uint32_t new_id_max_allele_slen, const char* missing_marker_id_match, Chrom_info* chrom_info_ptr, double** marker_cms_ptr, uint32_t** marker_pos_ptr, u [...]
diff --git a/plink_dosage.c b/plink_dosage.c
index 87cbfbc..03f9995 100644
--- a/plink_dosage.c
+++ b/plink_dosage.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_cluster.h"
diff --git a/plink_dosage.h b/plink_dosage.h
index 5df6173..e29f537 100644
--- a/plink_dosage.h
+++ b/plink_dosage.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_DOSAGE_H__
#define __PLINK_DOSAGE_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_glm.h"
#include "plink_misc.h"
diff --git a/plink_family.c b/plink_family.c
index d8056f5..df0286d 100644
--- a/plink_family.c
+++ b/plink_family.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_assoc.h"
@@ -2203,7 +2220,7 @@ int32_t tdt(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, char* outna
sprintf(textbuf, " CHR %%%us BP A1 A2 T U OR ", plink_maxsnp);
fprintf(outfile, textbuf, "SNP");
if (display_ci) {
- uii = (uint32_t)((int32_t)(ci_size * 100));
+ uii = (uint32_t)((int32_t)(ci_size * (100 + EPSILON)));
if (uii >= 10) {
fprintf(outfile, " L%u U%u ", uii, uii);
} else {
diff --git a/plink_family.h b/plink_family.h
index 4223c6b..3c20eb5 100644
--- a/plink_family.h
+++ b/plink_family.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_FAMILY_H__
#define __PLINK_FAMILY_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_set.h"
#define TDT_EXACT 1
diff --git a/plink_filter.c b/plink_filter.c
index 77013ac..d198347 100644
--- a/plink_filter.c
+++ b/plink_filter.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_filter.h"
@@ -263,6 +280,7 @@ int32_t extract_exclude_flag_norange(char* fname, uint32_t* marker_id_htable, ui
}
if (!bufsize) {
if (curtoklen) {
+ g_textbuf[MAXLINELEN] = ' '; // bugfix for no-\n-on-last-line case
extract_exclude_process_token(&(g_textbuf[MAXLINELEN - curtoklen]), marker_id_htable, marker_id_htable_size, extra_alloc_base, marker_ids, max_marker_id_len, marker_exclude, already_seen, &duplicate_ct, do_exclude, curtoklen);
}
break;
@@ -3031,7 +3049,7 @@ int32_t write_missingness_reports(FILE* bedfile, uintptr_t bed_offset, char* out
return retval;
}
-int32_t hardy_report_write_line(Pigz_state* ps_ptr, char** pzwritep_ptr, char* prefix_buf, uint32_t prefix_len, uint32_t reverse, uint32_t ll_ct, uint32_t lh_ct, uint32_t hh_ct, uint32_t hwe_midp, uint32_t is_mt, char* midbuf_ptr, double pval, double output_min_p) {
+int32_t hardy_report_write_line(Pigz_state* ps_ptr, char** pzwritep_ptr, char* prefix_buf, uint32_t prefix_len, uint32_t reverse, uint32_t ll_ct, uint32_t lh_ct, uint32_t hh_ct, uint32_t hwe_midp, uint32_t is_mt, double pval, double output_min_p) {
char* pzwritep = *pzwritep_ptr;
char wbuf[48];
char* cptr;
@@ -3096,7 +3114,6 @@ int32_t hardy_report(char* outname, char* outname_end, double output_min_p, uint
char* writebuf;
char* cptr0;
char* cptr;
- char* cptr2;
char* cptr3;
char* cptr4;
char* cptr5;
@@ -3154,7 +3171,6 @@ int32_t hardy_report(char* outname, char* outname_end, double output_min_p, uint
} else {
memcpy(&(cptr0[plink_maxsnp]), " ALL(NP) ", 20);
}
- cptr2 = &(cptr[18 + 2 * max_marker_allele_len]);
for (; pct <= 100; pct++) {
loop_end = (((uint64_t)pct) * marker_ct) / 100LLU;
for (; marker_idx < loop_end; marker_uidx++, marker_idx++) {
@@ -3171,7 +3187,6 @@ int32_t hardy_report(char* outname, char* outname_end, double output_min_p, uint
} else {
memcpy(&(cptr0[plink_maxsnp]), " ALL(NP) ", 20);
}
- cptr2 = &(cptr[18 + 2 * max_marker_allele_len]);
}
fw_strcpy(plink_maxsnp, &(marker_ids[marker_uidx * max_marker_id_len]), cptr0);
reverse = IS_SET(marker_reverse, marker_uidx);
@@ -3182,7 +3197,7 @@ int32_t hardy_report(char* outname, char* outname_end, double output_min_p, uint
cptr5 = fw_strcpy(4, cptr4, &(cptr5[1]));
*cptr5 = ' ';
prefix_len = 1 + (cptr5 - writebuf);
- if (hardy_report_write_line(&ps, &pzwritep, writebuf, prefix_len, reverse, hwe_ll_allfs[marker_uidx], hwe_lh_allfs[marker_uidx], hwe_hh_allfs[marker_uidx], hwe_midp, is_mt, cptr2, p_values[marker_idx], output_min_p)) {
+ if (hardy_report_write_line(&ps, &pzwritep, writebuf, prefix_len, reverse, hwe_ll_allfs[marker_uidx], hwe_lh_allfs[marker_uidx], hwe_hh_allfs[marker_uidx], hwe_midp, is_mt, p_values[marker_idx], output_min_p)) {
goto hardy_report_ret_WRITE_FAIL;
}
}
@@ -3196,7 +3211,6 @@ int32_t hardy_report(char* outname, char* outname_end, double output_min_p, uint
}
} else {
memset(&(cptr0[plink_maxsnp]), 32, 20);
- cptr2 = &(cptr[18 + 2 * max_marker_allele_len]);
for (; pct <= 100; pct++) {
loop_end = (((uint64_t)pct) * marker_ct) / 100LLU;
for (; marker_idx < loop_end; marker_uidx++, marker_idx++) {
@@ -3208,7 +3222,6 @@ int32_t hardy_report(char* outname, char* outname_end, double output_min_p, uint
*cptr0++ = ' ';
memset(&(cptr0[plink_maxsnp]), 32, 20);
cptr = &(cptr0[10 + plink_maxsnp]);
- cptr2 = &(cptr[18 + 2 * max_marker_allele_len]);
prefix_len = 10 + ((uintptr_t)(cptr - writebuf));
}
fw_strcpy(plink_maxsnp, &(marker_ids[marker_uidx * max_marker_id_len]), cptr0);
@@ -3221,17 +3234,17 @@ int32_t hardy_report(char* outname, char* outname_end, double output_min_p, uint
cptr5 = fw_strcpy(4, cptr4, &(cptr5[1]));
*cptr5 = ' ';
prefix_len = 1 + (cptr5 - writebuf);
- if (hardy_report_write_line(&ps, &pzwritep, writebuf, prefix_len, reverse, hwe_ll_allfs[marker_uidx], hwe_lh_allfs[marker_uidx], hwe_hh_allfs[marker_uidx], hwe_midp, is_mt, cptr2, p_values[3 * marker_idx], output_min_p)) {
+ if (hardy_report_write_line(&ps, &pzwritep, writebuf, prefix_len, reverse, hwe_ll_allfs[marker_uidx], hwe_lh_allfs[marker_uidx], hwe_hh_allfs[marker_uidx], hwe_midp, is_mt, p_values[3 * marker_idx], output_min_p)) {
goto hardy_report_ret_WRITE_FAIL;
}
memcpy(&(cptr0[7 + plink_maxsnp]), "FF", 2);
- if (hardy_report_write_line(&ps, &pzwritep, writebuf, prefix_len, reverse, hwe_ll_cases[marker_uidx], hwe_lh_cases[marker_uidx], hwe_hh_cases[marker_uidx], hwe_midp, is_mt, cptr2, p_values[3 * marker_idx + 1], output_min_p)) {
+ if (hardy_report_write_line(&ps, &pzwritep, writebuf, prefix_len, reverse, hwe_ll_cases[marker_uidx], hwe_lh_cases[marker_uidx], hwe_hh_cases[marker_uidx], hwe_midp, is_mt, p_values[3 * marker_idx + 1], output_min_p)) {
goto hardy_report_ret_WRITE_FAIL;
}
memcpy(&(cptr0[4 + plink_maxsnp]), "UN", 2);
- if (hardy_report_write_line(&ps, &pzwritep, writebuf, prefix_len, reverse, hwe_lls[marker_uidx], hwe_lhs[marker_uidx], hwe_hhs[marker_uidx], hwe_midp, is_mt, cptr2, p_values[3 * marker_idx + 2], output_min_p)) {
+ if (hardy_report_write_line(&ps, &pzwritep, writebuf, prefix_len, reverse, hwe_lls[marker_uidx], hwe_lhs[marker_uidx], hwe_hhs[marker_uidx], hwe_midp, is_mt, p_values[3 * marker_idx + 2], output_min_p)) {
goto hardy_report_ret_WRITE_FAIL;
}
}
@@ -3283,7 +3296,7 @@ uint32_t enforce_hwe_threshold(double hwe_thresh, uintptr_t unfiltered_marker_ct
logerrprint("Warning: --hwe has no effect since entire genome is haploid.\n");
return 0;
}
- hwe_thresh *= 1 + SMALL_EPSILON;
+ hwe_thresh *= 1 - SMALL_EPSILON;
if (hwe_all) {
hwe_lhs = hwe_lh_allfs;
hwe_lls = hwe_ll_allfs;
diff --git a/plink_filter.h b/plink_filter.h
index 5298c0e..70b7381 100644
--- a/plink_filter.h
+++ b/plink_filter.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_FILTER_H__
#define __PLINK_FILTER_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
typedef struct {
diff --git a/plink_glm.c b/plink_glm.c
index 3db0ae6..ebd5b06 100644
--- a/plink_glm.c
+++ b/plink_glm.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_assoc.h"
@@ -4911,7 +4928,7 @@ int32_t glm_linear_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset
sprintf(g_textbuf, " CHR %%%us BP A1 TEST NMISS BETA ", plink_maxsnp);
fprintf(outfile, g_textbuf, "SNP");
if (display_ci) {
- uii = (uint32_t)((int32_t)(ci_size * 100));
+ uii = (uint32_t)((int32_t)(ci_size * (100 + EPSILON)));
if (uii >= 10) {
fprintf(outfile, " SE L%u U%u ", uii, uii);
} else {
@@ -6389,7 +6406,7 @@ int32_t glm_logistic_assoc(pthread_t* threads, FILE* bedfile, uintptr_t bed_offs
sprintf(g_textbuf, " CHR %%%us BP A1 TEST NMISS %s ", plink_maxsnp, report_odds? " OR" : "BETA");
fprintf(outfile, g_textbuf, "SNP");
if (display_ci) {
- uii = (uint32_t)((int32_t)(ci_size * 100));
+ uii = (uint32_t)((int32_t)(ci_size * (100 + EPSILON)));
if (uii >= 10) {
fprintf(outfile, " SE L%u U%u ", uii, uii);
} else {
@@ -7578,7 +7595,7 @@ int32_t glm_linear_nosnp(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset
fflush(stdout);
fputs(" TEST NMISS BETA ", outfile);
if (display_ci) {
- uii = (uint32_t)((int32_t)(ci_size * 100));
+ uii = (uint32_t)((int32_t)(ci_size * (100 + EPSILON)));
if (uii >= 10) {
fprintf(outfile, " SE L%u U%u ", uii, uii);
} else {
@@ -8361,7 +8378,7 @@ int32_t glm_logistic_nosnp(pthread_t* threads, FILE* bedfile, uintptr_t bed_offs
fflush(stdout);
fprintf(outfile, " TEST NMISS %s ", report_odds? " OR" : "BETA");
if (display_ci) {
- uii = (uint32_t)((int32_t)(ci_size * 100));
+ uii = (uint32_t)((int32_t)(ci_size * (100 + EPSILON)));
if (uii >= 10) {
fprintf(outfile, " SE L%u U%u ", uii, uii);
} else {
diff --git a/plink_glm.h b/plink_glm.h
index d312046..d6e265e 100644
--- a/plink_glm.h
+++ b/plink_glm.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_GLM_H__
#define __PLINK_GLM_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_matrix.h"
#include "plink_set.h"
diff --git a/plink_help.c b/plink_help.c
index 93d992b..bf98350 100644
--- a/plink_help.c
+++ b/plink_help.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
uint32_t edit1_match(uint32_t len1, char* s1, uint32_t len2, char* s2) {
@@ -403,7 +420,7 @@ int32_t disp_help(uint32_t param_ct, char** argv) {
" .chr-[chr #].recode.phase.inp filename extensions.\n"
" * 'fastphase-1chr': Single .recode.phase.inp file. Does not support\n"
" multiple chromosomes.\n"
-" * 'HV': Per-chromosome Haploview files, with .chr-[chr #].{ped,info}\n"
+" * 'HV': Per-chromosome Haploview files, with .chr-[chr #][.ped + .info]\n"
" filename extensions.\n"
" * 'HV-1chr': Single Haploview .ped + .info file pair. Does not support\n"
" multiple chromosomes.\n"
diff --git a/plink_help.h b/plink_help.h
index a475568..b8c469c 100644
--- a/plink_help.h
+++ b/plink_help.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_HELP_H__
#define __PLINK_HELP_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
int32_t disp_help(uint32_t param_ct, char** argv);
#endif // __PLINK_HELP_H__
diff --git a/plink_homozyg.c b/plink_homozyg.c
index 65fceca..7c46145 100644
--- a/plink_homozyg.c
+++ b/plink_homozyg.c
@@ -1,3 +1,21 @@
+
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_homozyg.h"
diff --git a/plink_homozyg.h b/plink_homozyg.h
index b3d3717..82f8664 100644
--- a/plink_homozyg.h
+++ b/plink_homozyg.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_HOMOZYG_H__
#define __PLINK_HOMOZYG_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
typedef struct {
uint32_t modifier;
uint32_t min_snp;
diff --git a/plink_lasso.c b/plink_lasso.c
index 3f10d57..e76fa01 100644
--- a/plink_lasso.c
+++ b/plink_lasso.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_lasso.h"
diff --git a/plink_lasso.h b/plink_lasso.h
index f8261f2..9d2ce04 100644
--- a/plink_lasso.h
+++ b/plink_lasso.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_LASSO_H__
#define __PLINK_LASSO_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
int32_t lasso_lambda(const uintptr_t* marker_exclude, const uintptr_t* marker_reverse, Chrom_info* chrom_info_ptr, uintptr_t* sex_male, uintptr_t* pheno_nm, const uintptr_t* covar_nm, uintptr_t bed_offset, uintptr_t unfiltered_marker_ct, uintptr_t marker_ct, uintptr_t unfiltered_sample_ct, uintptr_t pheno_nm_ct, uint32_t hh_or_mt_exists, uint32_t lasso_lambda_iters, double lasso_h2, FILE* bedfile, char* outname, char* outname_end, double* lasso_minlambda_ptr);
int32_t lasso(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, char* outname, char* outname_end, uintptr_t unfiltered_marker_ct, uintptr_t* marker_exclude, uintptr_t marker_ct, char* marker_ids, uintptr_t max_marker_id_len, char** marker_allele_ptrs, uintptr_t* marker_reverse, Chrom_info* chrom_info_ptr, uintptr_t unfiltered_sample_ct, uintptr_t pheno_nm_ct, double lasso_h2, double lasso_minlambda, Range_list* select_covars_range_list_ptr, uint64_t misc_flags, uintptr_t* pheno_nm [...]
diff --git a/plink_ld.c b/plink_ld.c
index 0ecce45..3b59217 100644
--- a/plink_ld.c
+++ b/plink_ld.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include <stddef.h>
@@ -1046,9 +1063,19 @@ int32_t ld_prune(Ld_info* ldip, FILE* bedfile, uintptr_t bed_offset, uintptr_t m
// could cache MAFs of all current-window variants, but
// get_maf() is too cheap for this to make a noticeable
// difference
- if (get_maf(set_allele_freqs[live_indices[uii]]) < get_maf(set_allele_freqs[live_indices[ujj]])) {
+ if (get_maf(set_allele_freqs[live_indices[uii]]) < (1 - SMALL_EPSILON) * get_maf(set_allele_freqs[live_indices[ujj]])) {
+ /*
+ if (debug_print) {
+ printf("removed %u, kept %u, MAFs %g/%g, r2 %g\n", live_indices[uii], live_indices[ujj], get_maf(set_allele_freqs[live_indices[uii]]), get_maf(set_allele_freqs[live_indices[ujj]]), dxx);
+ }
+ */
SET_BIT(live_indices[uii], pruned_arr);
} else {
+ /*
+ if (debug_print) {
+ printf("removed %u, kept %u, MAFs %g/%g, r2 %g\n", live_indices[ujj], live_indices[uii], get_maf(set_allele_freqs[live_indices[ujj]]), get_maf(set_allele_freqs[live_indices[uii]]), dxx);
+ }
+ */
SET_BIT(live_indices[ujj], pruned_arr);
ujj++;
while (ujj < cur_window_size) {
@@ -1283,7 +1310,7 @@ int32_t ld_prune(Ld_info* ldip, FILE* bedfile, uintptr_t bed_offset, uintptr_t m
next_unset_ck(marker_exclude, chrom_end, &window_unfiltered_end);
}
if (cur_window_size > prev_end) {
- start_arr[cur_window_size] = window_unfiltered_end;
+ start_arr[cur_window_size - 1] = window_unfiltered_end;
}
}
putc_unlocked('\r', stdout);
@@ -10577,7 +10604,7 @@ int32_t indep_pairphase(Ld_info* ldip, FILE* bedfile, uintptr_t bed_offset, uint
at_least_one_prune = 1;
cur_exclude_ct++;
// remove marker with lower MAF
- if (get_maf(set_allele_freqs[live_indices[ulii]]) < get_maf(set_allele_freqs[live_indices[uljj]])) {
+ if (get_maf(set_allele_freqs[live_indices[ulii]]) < (1 - SMALL_EPSILON) * get_maf(set_allele_freqs[live_indices[uljj]])) {
SET_BIT(live_indices[ulii], pruned_arr);
} else {
SET_BIT(live_indices[uljj], pruned_arr);
@@ -10695,7 +10722,7 @@ int32_t indep_pairphase(Ld_info* ldip, FILE* bedfile, uintptr_t bed_offset, uint
next_unset_ck(marker_exclude, chrom_end, &window_unfiltered_end);
}
if (cur_window_size > prev_end) {
- start_arr[cur_window_size] = window_unfiltered_end;
+ start_arr[cur_window_size - 1] = window_unfiltered_end;
}
}
putc_unlocked('\r', stdout);
diff --git a/plink_ld.h b/plink_ld.h
index a5c9cae..39f9466 100644
--- a/plink_ld.h
+++ b/plink_ld.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_LD_H__
#define __PLINK_LD_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_set.h"
#define LD_MATRIX_SQ 1
diff --git a/plink_matrix.c b/plink_matrix.c
index aa1156f..c06658e 100644
--- a/plink_matrix.c
+++ b/plink_matrix.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_matrix.h"
diff --git a/plink_matrix.h b/plink_matrix.h
index 16a1bb2..7e6dfe3 100644
--- a/plink_matrix.h
+++ b/plink_matrix.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_MATRIX_H__
#define __PLINK_MATRIX_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
// Wrappers for frequent LAPACK calls (sometimes with no-LAPACK fallbacks).
// May want to make this comprehensive to make linking with Intel MKL practical
// in the future.
diff --git a/plink_misc.c b/plink_misc.c
index d48abcc..9d0b3bf 100644
--- a/plink_misc.c
+++ b/plink_misc.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_misc.h"
@@ -1267,6 +1284,7 @@ int32_t flip_strand(char* flip_fname, uint32_t* marker_id_htable, uint32_t marke
}
if (!bufsize) {
if (curtoklen) {
+ g_textbuf[MAXLINELEN] = ' '; // bugfix for no-\n-on-last-line case
if (flip_process_token(&(g_textbuf[MAXLINELEN - curtoklen]), marker_id_htable, marker_id_htable_size, marker_ids, max_marker_id_len, marker_exclude, already_seen, marker_allele_ptrs, &hit_ct, &miss_ct, &non_acgt_ct)) {
goto flip_strand_ret_INVALID_FORMAT_2;
}
diff --git a/plink_misc.h b/plink_misc.h
index 41a49de..dc2751c 100644
--- a/plink_misc.h
+++ b/plink_misc.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_MISC_H__
#define __PLINK_MISC_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#define SCORE_HEADER 1
#define SCORE_SUM 2
#define SCORE_NO_MEAN_IMPUTATION 4
diff --git a/plink_perm.c b/plink_perm.c
index 3605f65..cf06905 100644
--- a/plink_perm.c
+++ b/plink_perm.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_cluster.h"
diff --git a/plink_perm.h b/plink_perm.h
index 6b182a9..cc2df12 100644
--- a/plink_perm.h
+++ b/plink_perm.h
@@ -1,5 +1,22 @@
#ifndef __PLINK_PERM_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
// Permutation generation and interpretation code common to many association
// tests.
diff --git a/plink_rserve.c b/plink_rserve.c
index 29a0dfc..3ffad9d 100644
--- a/plink_rserve.c
+++ b/plink_rserve.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
// Rconnection.cc is part of a continuously updated package and uses
// C++-specific language constructs, so we omit this module when compiling with
// gcc instead of g++.
diff --git a/plink_rserve.h b/plink_rserve.h
index 576da7d..3fdbe71 100644
--- a/plink_rserve.h
+++ b/plink_rserve.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_RSERVE_H__
#define __PLINK_RSERVE_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
int32_t rserve_call(char* rplugin_fname, uint32_t rplugin_port, uint32_t rplugin_debug, FILE* bedfile, uintptr_t bed_offset, uintptr_t marker_ct, uintptr_t unfiltered_marker_ct, uintptr_t* marker_exclude, uintptr_t* marker_reverse, char* marker_ids, uintptr_t max_marker_id_len, char** marker_allele_ptrs, uint32_t* marker_pos, uint32_t plink_maxsnp, Chrom_info* chrom_info_ptr, uintptr_t unfiltered_sample_ct, uintptr_t* pheno_nm, uint32_t pheno_nm_ct, uintptr_t* pheno_c, double* pheno_d, u [...]
#endif // __PLINK_RSERVE_H__
diff --git a/plink_set.c b/plink_set.c
index 511d475..dd36217 100644
--- a/plink_set.c
+++ b/plink_set.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_set.h"
diff --git a/plink_set.h b/plink_set.h
index e56f69b..a2a5bb2 100644
--- a/plink_set.h
+++ b/plink_set.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_SET_H__
#define __PLINK_SET_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#define SET_MAKE_FROM_RANGES 1
#define SET_COMPLEMENTS 2
#define SET_MAKE_COLLAPSE_GROUP 4
diff --git a/plink_stats.c b/plink_stats.c
index bef8785..169831c 100644
--- a/plink_stats.c
+++ b/plink_stats.c
@@ -1,3 +1,20 @@
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_common.h"
#include "plink_stats.h"
@@ -1949,9 +1966,9 @@ double chi23_eval(intptr_t m11, intptr_t m12, intptr_t row1_sum, intptr_t col1_s
delta = (col3_sum - m13) - expect;
chisq += delta * delta / expect;
if (chisq < (SMALL_EPSILON * SMALL_EPSILON)) {
- chisq = 0;
+ return 0;
}
- return 0;
+ return chisq;
}
void chi23_evalx(intptr_t m11, intptr_t m12, intptr_t m13, intptr_t m21, intptr_t m22, intptr_t m23, double* chip, uint32_t* dfp) {
diff --git a/plink_stats.h b/plink_stats.h
index 4f2ce4f..01b7e19 100644
--- a/plink_stats.h
+++ b/plink_stats.h
@@ -1,6 +1,23 @@
#ifndef __PLINK_STATS_H__
#define __PLINK_STATS_H__
+// This file is part of PLINK 1.90, copyright (C) 2005-2016 Shaun Purcell,
+// Christopher Chang.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
#include "plink_matrix.h"
// result of inverse_chiprob(5e-324, 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