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 f45c5633d64d1ed996773220b5d342537f5fdf8e Author: Dylan Aïssi <[email protected]> Date: Fri Jan 12 23:43:10 2018 +0100 New upstream version 1.90~b5.2-180109 --- plink.c | 18 ++++++++++-------- plink_assoc.c | 18 ++++++------------ plink_assoc.h | 2 +- plink_calc.c | 10 +++++----- plink_cluster.c | 4 ++-- plink_cnv.c | 2 +- plink_cnv.h | 2 +- plink_common.c | 2 +- plink_common.h | 2 +- plink_data.c | 2 +- plink_data.h | 2 +- plink_dosage.c | 8 ++++---- plink_dosage.h | 2 +- plink_family.c | 6 +++--- plink_family.h | 2 +- plink_filter.c | 8 ++++---- plink_filter.h | 2 +- plink_glm.c | 16 ++++++++-------- plink_glm.h | 2 +- plink_help.c | 2 +- plink_help.h | 2 +- plink_homozyg.c | 5 ++--- plink_homozyg.h | 2 +- plink_lasso.c | 2 +- plink_lasso.h | 2 +- plink_ld.c | 2 +- plink_ld.h | 2 +- plink_matrix.c | 10 +++++----- plink_matrix.h | 2 +- plink_misc.c | 58 +++++++++++++++++++++++++++++++++++++++++++++------------ plink_misc.h | 2 +- plink_perm.c | 2 +- plink_perm.h | 3 ++- plink_rserve.c | 4 ++-- plink_rserve.h | 2 +- plink_set.c | 8 ++++---- plink_set.h | 2 +- plink_stats.c | 6 +++--- plink_stats.h | 2 +- 39 files changed, 130 insertions(+), 100 deletions(-) diff --git a/plink.c b/plink.c index 9a9e57c..26dc541 100644 --- a/plink.c +++ b/plink.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -93,7 +93,7 @@ static const char ver_str[] = #ifdef STABLE_BUILD - "PLINK v1.90b5" + "PLINK v1.90b5.2" #else "PLINK v1.90p" #endif @@ -105,12 +105,12 @@ static const char ver_str[] = #else " 32-bit" #endif - " (14 Nov 2017)"; + " (9 Jan 2018)"; 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 two trailing digits) #else " " // (don't want this when version number has e.g. "b3" before "p") #endif @@ -118,7 +118,7 @@ static const char ver_str2[] = " " #endif " www.cog-genomics.org/plink/1.9/\n" - "(C) 2005-2017 Shaun Purcell, Christopher Chang GNU General Public License v3" + "(C) 2005-2018 Shaun Purcell, Christopher Chang GNU General Public License v3" #if SPECIES_DEFAULT > 0 "\nRecompiled with default species = " #if SPECIES_DEFAULT == SPECIES_COW @@ -1441,7 +1441,7 @@ int32_t plink(char* outname, char* outname_end, char* bedname, char* bimname, ch } else { LOGPRINTFWW("%" PRIuPTR " variant%s filters and QC.\n", marker_ct, (marker_ct == 1)? " passes" : "s pass"); } - } else if (!allow_no_variants) { + } else if ((!allow_no_variants) && ((calculation_type & (~CALC_ONLY_FAM)) || (filter_flags & FILTER_BIM_REQ))) { // defensive logerrprint("Error: No variants remaining.\n"); goto plink_ret_ALL_MARKERS_EXCLUDED; @@ -2001,8 +2001,10 @@ int32_t plink(char* outname, char* outname_end, char* bedname, char* bimname, ch pheno_d = nullptr; } } - uii++; + // bugfix (9 Jan 2018): forgot to increment phenotype index when + // skipping empty pheno plink_skip_empty_pheno: + uii++; rewind(phenofile); outname_end[1] = '\0'; retval = load_pheno(phenofile, unfiltered_sample_ct, sample_exclude_ct, cptr, max_sample_id_len, uiptr, missing_pheno, (misc_flags / MISC_AFFECTION_01) & 1, uii, nullptr, pheno_nm, &pheno_c, &pheno_d, &(outname_end[1]), (uintptr_t)((&(outname[FNAMESIZE - 32])) - outname_end)); diff --git a/plink_assoc.c b/plink_assoc.c index 8679ab0..08651fd 100644 --- a/plink_assoc.c +++ b/plink_assoc.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -497,21 +497,15 @@ int32_t multcomp(char* outname, char* outname_end, uint32_t* marker_uidxs, uintp } } // avoid catastrophic cancellation for small p-values - // 1 - (1-p)^c = 1 - (1 - cp + (c(c-1) / 2)p^2 + ...) - // = cp - (c(c-1) / 2)p^2 + [stuff smaller than (c^3p^3)/6] - // current threshold is chosen to ensure at least 4 digits of precision - // in (1 - pval) if pow() is used, since 4 significant digits are printed - // in the .adjusted file. but in theory we should take dct into account - // too: small dct lets us use a higher threshold. - if (pval >= RECIP_2_53 * 16384) { + // 1 - (1-p)^c = 1 - e^{c log(1-p)} + // 2^{-7} threshold is arbitrary + if (pval >= 0.0078125) { pv_sidak_ss = 1 - pow(1 - pval, dct); dyy = 1 - pow(1 - pval, dct - ((double)((int32_t)cur_idx))); } else { - // for very large dct, we might want to include the p^3 term of the - // binomial expansion as well - pv_sidak_ss = pval * (dct - pval * (dct - 1)); + pv_sidak_ss = 1 - exp(dct * log1p(-pval)); dyy = dct - (double)((int32_t)cur_idx); - dyy = pval * (dyy - pval * (dyy - 1)); + dyy = 1 - exp(dyy * log1p(-pval)); } if (pv_sidak_sd < dyy) { pv_sidak_sd = dyy; diff --git a/plink_assoc.h b/plink_assoc.h index c208e00..491f060 100644 --- a/plink_assoc.h +++ b/plink_assoc.h @@ -1,7 +1,7 @@ #ifndef __PLINK_ASSOC_H__ #define __PLINK_ASSOC_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_calc.c b/plink_calc.c index 868617a..606819f 100644 --- a/plink_calc.c +++ b/plink_calc.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -3255,7 +3255,7 @@ int32_t calc_regress_pcs(char* evecname, uint32_t regress_pcs_modifier, uint32_t if (alloc_collapsed_haploid_filters(sample_exclude, sex_male, unfiltered_sample_ct, sample_ct, hh_exists, 0, &sample_include2, &sample_male_include2)) { goto calc_regress_pcs_ret_NOMEM; } - + // try unaltered filename. If that fails and the unaltered filename didn't // have an .evec or .eigenvec extension, then also try appending .evec and // appending .eigenvec. @@ -5563,7 +5563,7 @@ int32_t do_rel_cutoff(uint64_t calculation_type, double rel_cutoff, double* rel_ int32_t kk; int32_t mm; int32_t retval; - + // Algorithm: // - Whenever there is at least one sample with exactly one remaining // too-close relation, prune the other side of that relationship, because @@ -5786,7 +5786,7 @@ uint32_t rel_cutoff_batch_emitn(uint32_t overflow_ct, unsigned char* readbuf) { fflush(stdout); } col = 0; - } + } rel_cutoff_batch_emitn_ret: g_rcb_row = row; g_rcb_col = col; @@ -5868,7 +5868,7 @@ uint32_t rel_cutoff_batch_rbin_emitn(uint32_t overflow_ct, unsigned char* readbu fflush(stdout); } col = 0; - } + } rel_cutoff_batch_rbin_emitn_ret: g_rcb_row = row; g_rcb_col = col; diff --git a/plink_cluster.c b/plink_cluster.c index 28f27ab..8a240bd 100644 --- a/plink_cluster.c +++ b/plink_cluster.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -1510,7 +1510,7 @@ int32_t cluster_enforce_match(Cluster_info* cp, int32_t missing_pheno, uintptr_t if (retval) { goto cluster_enforce_match_ret_1; } - + bigstack_mark2 = g_bigstack_base; g_textbuf[MAXLINELEN - 1] = ' '; if (cp->match_fname) { diff --git a/plink_cnv.c b/plink_cnv.c index 2bde162..76867d0 100644 --- a/plink_cnv.c +++ b/plink_cnv.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_cnv.h b/plink_cnv.h index fcb7a0e..81b3777 100644 --- a/plink_cnv.h +++ b/plink_cnv.h @@ -1,7 +1,7 @@ #ifndef __PLINK_CNV_H__ #define __PLINK_CNV_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_common.c b/plink_common.c index 7854f6c..d3ea1d9 100644 --- a/plink_common.c +++ b/plink_common.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_common.h b/plink_common.h index ee22f8f..0704d0b 100644 --- a/plink_common.h +++ b/plink_common.h @@ -1,7 +1,7 @@ #ifndef __PLINK_COMMON_H__ #define __PLINK_COMMON_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_data.c b/plink_data.c index 7c289f4..b42ae19 100644 --- a/plink_data.c +++ b/plink_data.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_data.h b/plink_data.h index 502bbe3..860a882 100644 --- a/plink_data.h +++ b/plink_data.h @@ -1,7 +1,7 @@ #ifndef __PLINK_DATA_H__ #define __PLINK_DATA_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_dosage.c b/plink_dosage.c index 6c7042e..0532f5a 100644 --- a/plink_dosage.c +++ b/plink_dosage.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -98,7 +98,7 @@ int32_t dosage_load_score_files(Score_info* sc_ip, char* outname, char* outname_ if (retval) { goto dosage_load_score_files_ret_1; } - + if (sc_ip->varid_col < sc_ip->allele_col) { first_col_m1 = sc_ip->varid_col; varid_idx = 0; @@ -307,7 +307,7 @@ int32_t dosage_load_score_files(Score_info* sc_ip, char* outname, char* outname_ if (is_eoln_kns(*bufptr)) { goto dosage_load_score_files_next3; } - } + } if (fclose_null(&infile)) { goto dosage_load_score_files_ret_READ_FAIL; } @@ -1947,7 +1947,7 @@ int32_t plink1_dosage(Dosage_info* doip, char* famname, char* mapname, char* out is_valid = glm_linear_dosage(sample_ct, cur_samples, sample_valid_ct, pheno_nm_collapsed, pheno_d_collapsed, perm_fails, covar_ct, covar_d, cur_dosages, pheno_d2, covars_cov_major_buf, covars_sample_major_buf, param_2d_buf, mi_buf, param_2d_buf2, regression_results, dgels_a, dgels_b, dgels_work, dgels_lwork, standard_beta, glm_vif_thresh, &beta, &se, &pval); if (is_valid == 2) { // NOMEM special case - goto plink1_dosage_ret_NOMEM; + goto plink1_dosage_ret_NOMEM; } } else { #endif diff --git a/plink_dosage.h b/plink_dosage.h index 605756c..1eab5de 100644 --- a/plink_dosage.h +++ b/plink_dosage.h @@ -1,7 +1,7 @@ #ifndef __PLINK_DOSAGE_H__ #define __PLINK_DOSAGE_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_family.c b/plink_family.c index b7bbb44..69befaa 100644 --- a/plink_family.c +++ b/plink_family.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -4356,7 +4356,7 @@ int32_t dfam(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, char* outn } g_perm_is_1bit = 1; } - + fputs("0%", stdout); fflush(stdout); // ----- begin main loop ----- @@ -4924,7 +4924,7 @@ int32_t dfam(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset, char* outn LOGPRINTFWW("Permutation test report written to %s .\n", outname); } // ... - + while (0) { dfam_ret_NOMEM: retval = RET_NOMEM; diff --git a/plink_family.h b/plink_family.h index b1569e3..7e42642 100644 --- a/plink_family.h +++ b/plink_family.h @@ -1,7 +1,7 @@ #ifndef __PLINK_FAMILY_H__ #define __PLINK_FAMILY_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_filter.c b/plink_filter.c index aa63b5a..6afd2a0 100644 --- a/plink_filter.c +++ b/plink_filter.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -454,7 +454,7 @@ int32_t filter_attrib(char* fname, char* condition_str, uint32_t* id_htable, uin uint32_t item_uidx; uint32_t pos_match_needed; int32_t sorted_idx; - + if (bigstack_alloc_ul(unfiltered_ctl, &exclude_arr_new) || bigstack_calloc_ul(unfiltered_ctl, &already_seen)) { goto filter_attrib_ret_NOMEM; @@ -689,7 +689,7 @@ int32_t filter_attrib_sample(char* fname, char* condition_str, char* sorted_ids, if (bigstack_alloc_ul(unfiltered_ctl, &exclude_arr_new) || bigstack_calloc_ul(unfiltered_ctl, &already_seen) || - bigstack_alloc_c(max_id_len, &id_buf)) { + bigstack_alloc_c(max_id_len, &id_buf)) { goto filter_attrib_sample_ret_NOMEM; } fill_all_bits(unfiltered_ct, exclude_arr_new); @@ -1301,7 +1301,7 @@ int32_t load_oblig_missing(FILE* bedfile, uintptr_t bed_offset, uintptr_t unfilt if (ii == -1) { continue; } - sample_uidx = sample_id_map[(uint32_t)ii]; + sample_uidx = sample_id_map[(uint32_t)ii]; slen = strlen_se(bufptr2); // guaranteed to succeed ii = bsearch_str(bufptr2, slen, cluster_ids, max_cluster_id_len, cluster_ct); diff --git a/plink_filter.h b/plink_filter.h index df9c673..3abbed6 100644 --- a/plink_filter.h +++ b/plink_filter.h @@ -1,7 +1,7 @@ #ifndef __PLINK_FILTER_H__ #define __PLINK_FILTER_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_glm.c b/plink_glm.c index 2397cfe..01ed43d 100644 --- a/plink_glm.c +++ b/plink_glm.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -466,7 +466,7 @@ int32_t glm_check_vif(double vif_thresh, uintptr_t param_ct, uintptr_t sample_va for (param_idx = 0; param_idx < param_ct_m1; param_idx++) { param_2d_buf[param_idx * param_ct] = 1; } - + if (invert_matrix(dim, param_2d_buf, mi_buf, param_2d_buf2)) { return 1; } @@ -1597,7 +1597,7 @@ uint32_t logistic_regression(uint32_t sample_ct, uint32_t param_ct, float* vv, f // grad = gradient buffer (length param_ct) // ll = linear system buffer, param_ct x param_ct, rows 16-byte aligned // dcoef = current coefficient change buffer (length param_ct) - // + // // Inputs: // xx = covariate (and usually genotype) matrix, covariate-major, rows are // 16-byte aligned, trailing row elements must be zeroed out @@ -1860,7 +1860,7 @@ uint32_t glm_fill_design(uintptr_t* loadbuf_collapsed, double* fixed_covars_cov_ } ulptr_end++; sample_idx_stop = sample_valid_ct; - } + } } else if ((!(coding_flags & (GLM_HETHOM | GLM_RECESSIVE))) && (!is_nonx_haploid)) { if (!male_x_01) { while (1) { @@ -2280,7 +2280,7 @@ uint32_t glm_fill_design_float(uintptr_t* loadbuf_collapsed, float* fixed_covars } ulptr_end++; sample_idx_stop = sample_valid_ct; - } + } } else if ((!(coding_flags & (GLM_HETHOM | GLM_RECESSIVE))) && (!is_nonx_haploid)) { if (!male_x_01) { while (1) { @@ -3463,7 +3463,7 @@ THREAD_RET_TYPE glm_linear_set_thread(void* arg) { *msa_ptr++ = dxx; } } - THREAD_RETURN; + THREAD_RETURN; } #endif @@ -4288,7 +4288,7 @@ int32_t glm_linear_assoc_set_test(pthread_t* threads, FILE* bedfile, uintptr_t b dxx = MAX_INVERSE_CHIPROB_1DF; } else { dxx = inverse_chiprob(dxx, 1); - } + } } // this is cache-unfriendly, may want to update in-place instead and // separate out the transpose @@ -7629,7 +7629,7 @@ int32_t glm_linear_nosnp(pthread_t* threads, FILE* bedfile, uintptr_t bed_offset if (fwrite_checked(g_textbuf, wptr - g_textbuf, outfile)) { goto glm_linear_nosnp_ret_WRITE_FAIL; } - } + } } if (report_intercept) { wptr = memcpya(g_textbuf, " INTERCEPT ", 11); diff --git a/plink_glm.h b/plink_glm.h index d85011d..39db09f 100644 --- a/plink_glm.h +++ b/plink_glm.h @@ -1,7 +1,7 @@ #ifndef __PLINK_GLM_H__ #define __PLINK_GLM_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_help.c b/plink_help.c index 6fcd894..3bd437d 100644 --- a/plink_help.c +++ b/plink_help.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_help.h b/plink_help.h index de3232a..e09150c 100644 --- a/plink_help.h +++ b/plink_help.h @@ -1,7 +1,7 @@ #ifndef __PLINK_HELP_H__ #define __PLINK_HELP_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_homozyg.c b/plink_homozyg.c index 8d4f2af..0be056d 100644 --- a/plink_homozyg.c +++ b/plink_homozyg.c @@ -1,5 +1,4 @@ - -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -1315,7 +1314,7 @@ void assign_allelic_match_groups(uint32_t pool_size, uint32_t* allelic_match_cts cur_pool[2 * pool_idx] = 0x80000000U | (group_idx++); #endif } - } + } } char* roh_pool_write_middle(char* wptr, char* marker_ids, uintptr_t max_marker_id_len, uint32_t plink_maxsnp, uint32_t* marker_pos, uint32_t is_new_lengths, uint32_t marker_uidx1, uint32_t marker_uidx2) { diff --git a/plink_homozyg.h b/plink_homozyg.h index 1c31333..aec909d 100644 --- a/plink_homozyg.h +++ b/plink_homozyg.h @@ -1,7 +1,7 @@ #ifndef __PLINK_HOMOZYG_H__ #define __PLINK_HOMOZYG_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_lasso.c b/plink_lasso.c index 8338ca7..a4dafef 100644 --- a/plink_lasso.c +++ b/plink_lasso.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_lasso.h b/plink_lasso.h index 7c39e9a..20c296c 100644 --- a/plink_lasso.h +++ b/plink_lasso.h @@ -1,7 +1,7 @@ #ifndef __PLINK_LASSO_H__ #define __PLINK_LASSO_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_ld.c b/plink_ld.c index d14a719..fe8f228 100644 --- a/plink_ld.c +++ b/plink_ld.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_ld.h b/plink_ld.h index d4160cf..a5f13ef 100644 --- a/plink_ld.h +++ b/plink_ld.h @@ -1,7 +1,7 @@ #ifndef __PLINK_LD_H__ #define __PLINK_LD_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_matrix.c b/plink_matrix.c index 094ec82..1d79919 100644 --- a/plink_matrix.c +++ b/plink_matrix.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -32,7 +32,7 @@ static inline double SQR(const double a) { double pythag(const double a, const double b) { // PLINK stats.cpp pythag(). double absa,absb; - + absa=fabs(a); absb=fabs(b); if (absa > absb) return absa*sqrt(1.0+SQR(absb/absa)); @@ -184,7 +184,7 @@ int32_t svdcmp_c(int32_t m, double* a, double* w, double* v) { } break; } - if (its == 29) + if (its == 29) return 0; // cannot converge: multi-collinearity? x=w[l]; nm=k-1; @@ -265,14 +265,14 @@ int32_t invert_matrix(int32_t dim, double* matrix, MATRIX_INVERT_BUF1_TYPE* dbl_ for (i=0; i<dim; i++) { dbl_1d_buf[i] = dbl_1d_buf[i] < wmin ? 0 : (1 / dbl_1d_buf[i]); } - + for (i=0; i<dim; i++) { for (j=0; j<dim; j++) { matrix[i * dim + j] = matrix[i * dim + j] * dbl_1d_buf[j]; } } - // [nxn].[t(v)] + // [nxn].[t(v)] for (i=0; i<dim; i++) { fill_double_zero(dim, dbl_1d_buf); for (j=0; j<dim; j++) { diff --git a/plink_matrix.h b/plink_matrix.h index bc1e1ff..1a7b57a 100644 --- a/plink_matrix.h +++ b/plink_matrix.h @@ -1,7 +1,7 @@ #ifndef __PLINK_MATRIX_H__ #define __PLINK_MATRIX_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_misc.c b/plink_misc.c index 6ebff41..79de9e1 100644 --- a/plink_misc.c +++ b/plink_misc.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -5787,10 +5787,10 @@ int32_t meta_analysis(char* input_fnames, char* snpfield_search_order, char* a1f if (!final_variant_ct) { logerrprint("Error: No --meta-analysis variants.\n"); goto meta_analysis_ret_INVALID_CMDLINE; - #ifdef __LP64__ +#ifdef __LP64__ } else if (final_variant_ct > 0x7fffffff) { logerrprint("Error: Too many distinct --meta-analysis variants (max 2^31 - 1).\n"); - #endif +#endif } if (!no_allele) { combined_allele_len_byte_width = 4 - (__builtin_clz(max_combined_allele_len) / 8); @@ -5923,11 +5923,11 @@ int32_t meta_analysis(char* input_fnames, char* snpfield_search_order, char* a1f memcpy(&cur_file_ct_m1, bufptr2, file_ct_byte_width); cur_data_slots = 0; if (report_study_specific) { - #ifdef __LP64__ +#ifdef __LP64__ cur_data_slots += file_ct64; - #else +#else cur_data_slots += 2 * file_ct64; - #endif +#endif } if (!no_allele) { cur_combined_allele_len = 0; @@ -6102,9 +6102,9 @@ int32_t meta_analysis(char* input_fnames, char* snpfield_search_order, char* a1f if (ii == -1) { continue; } - #ifdef __LP64__ +#ifdef __LP64__ cur_var_idx = 0; // clear high 32 bits - #endif +#endif memcpy(&cur_var_idx, &(cur_window_marker_ids[(((uint32_t)ii) * max_var_id_len_p5) + max_var_id_len_p1]), 4); } else { bufptr[var_id_len] = '\0'; @@ -6310,10 +6310,44 @@ int32_t meta_analysis(char* input_fnames, char* snpfield_search_order, char* a1f wptr = dtoa_g_wxp4(MAXV(dxx, output_min_p), 11, wptr); } } else { - wptr = memcpya(wptr, " NA NA NA NA NA NA", 56); - if (weighted_z) { - wptr = memcpya(wptr, " NA NA", 24); - } + // quasi-bugfix (20 Dec 2017): under 'report-all', report basic + // p/beta values when n=1 instead of forcing user to re-scrape their + // input files. + if (cur_file_ct) { + ii = ((int32_t)(1 + weighted_z)) * (-2); + cur_beta = cur_data_ptr[ii]; + cur_se = cur_data_ptr[ii + 1]; + summtest = cur_beta / cur_se; + p1 = chiprob_p(summtest * summtest, 1); + *wptr++ = ' '; + if (p1 >= 0.0) { + p1 = MAXV(p1, output_min_p); + wptr = dtoa_g_wxp4x(p1, 11, ' ', wptr); + wptr = dtoa_g_wxp4x(p1, 11, ' ', wptr); + } else { + wptr = memcpya(wptr, " NA NA ", 24); + } + if (!output_beta) { + cur_beta = exp(cur_beta); + } + wptr = dtoa_f_w7p4x(cur_beta, ' ', wptr); + wptr = dtoa_f_w7p4x(cur_beta, ' ', wptr); + wptr = memcpya(wptr, " NA NA", 15); + if (weighted_z) { + numer = cur_data_ptr[-2]; + denom2 = cur_data_ptr[-1]; + dxx = numer / sqrt(denom2); + *wptr++ = ' '; + wptr = dtoa_g_wxp4x(dxx, 11, ' ', wptr); + dxx = 1.0 - 2 * fabs(normdist(fabs(dxx)) - 0.5); + wptr = dtoa_g_wxp4(MAXV(dxx, output_min_p), 11, wptr); + } + } else { + wptr = memcpya(wptr, " NA NA NA NA NA NA", 56); + if (weighted_z) { + wptr = memcpya(wptr, " NA NA", 24); + } + } } if (fwrite_checked(g_textbuf, wptr - g_textbuf, outfile)) { goto meta_analysis_ret_WRITE_FAIL; diff --git a/plink_misc.h b/plink_misc.h index f86f075..36c3332 100644 --- a/plink_misc.h +++ b/plink_misc.h @@ -1,7 +1,7 @@ #ifndef __PLINK_MISC_H__ #define __PLINK_MISC_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_perm.c b/plink_perm.c index eb4e24a..7e7f689 100644 --- a/plink_perm.c +++ b/plink_perm.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_perm.h b/plink_perm.h index 4744803..83654db 100644 --- a/plink_perm.h +++ b/plink_perm.h @@ -1,6 +1,7 @@ #ifndef __PLINK_PERM_H__ +#define __PLINK_PERM_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_rserve.c b/plink_rserve.c index 7658a50..2b2b588 100644 --- a/plink_rserve.c +++ b/plink_rserve.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -191,7 +191,7 @@ int32_t rserve_call(char* rplugin_fname, char* rplugin_host_or_socket, int32_t r goto rserve_call_ret_NETWORK; } rc->eval("options(echo=F)"); - + r_s = new Rinteger(sample_to_cluster, pheno_nm_ct); r_p = new Rdouble(pheno_d2, pheno_nm_ct); r_n = new Rinteger((int32_t*)(&pheno_nm_ct), 1); diff --git a/plink_rserve.h b/plink_rserve.h index de9bdcc..ca7d5ab 100644 --- a/plink_rserve.h +++ b/plink_rserve.h @@ -1,7 +1,7 @@ #ifndef __PLINK_RSERVE_H__ #define __PLINK_RSERVE_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_set.c b/plink_set.c index 366ff97..901374a 100644 --- a/plink_set.c +++ b/plink_set.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -2956,7 +2956,7 @@ int32_t annotate(const Annot_info* aip, uint32_t allow_extra_chroms, char* outna if (!bufptr) { continue; } - + if (need_pos) { // CHR // can't use get_chrom_code_destructive() due to later @@ -3512,7 +3512,7 @@ int32_t gene_report(char* fname, char* glist, char* subset_fname, uint32_t borde if (!bufptr) { goto gene_report_load_loop; } - + // CHR chrom_idx = get_chrom_code_counted(chrom_info_ptr, strlen_se(token_ptrs[0]), token_ptrs[0]); if (chrom_idx < 0) { @@ -3611,7 +3611,7 @@ int32_t gene_report(char* fname, char* glist, char* subset_fname, uint32_t borde gene_idx = gene_nameidx_to_chridx[ulii]; bufptr = &(gene_names[gene_idx * max_gene_name_len]); fputs(&(bufptr[4]), outfile); - // 53313 = ('0' * (1000 + 100 + 10)) + ('0' - 15) + // 53313 = ('0' * (1000 + 100 + 10)) + ('0' - 15) chrom_idx = ((unsigned char)bufptr[0]) * 1000 + ((unsigned char)bufptr[1]) * 100 + ((unsigned char)bufptr[2]) * 10 + ((unsigned char)bufptr[3]) - 53313; strcpy(g_textbuf, " -- "); // plink 1.07 explicitly precedes chromosome codes with "chr" here. diff --git a/plink_set.h b/plink_set.h index 784fcb6..ed284fe 100644 --- a/plink_set.h +++ b/plink_set.h @@ -1,7 +1,7 @@ #ifndef __PLINK_SET_H__ #define __PLINK_SET_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify diff --git a/plink_stats.c b/plink_stats.c index cbe976e..d364d46 100644 --- a/plink_stats.c +++ b/plink_stats.c @@ -1,4 +1,4 @@ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify @@ -54,7 +54,7 @@ double inverse_chiprob(double qq, double df) { return xx; } -double calc_tprob(double tt, double df) { +double calc_tprob(double tt, double df) { int32_t st = 0; int32_t ww = 1; double bnd = 1; @@ -398,7 +398,7 @@ int32_t SNPHWE_t(int32_t obs_hets, int32_t obs_hom1, int32_t obs_hom2, double th // = 2 * (rare_copies / (2 * genotypes)) * (1 - rarefreq) * genotypes // = rare_copies * (1 - (rare_copies / (2 * genotypes))) // = (rare_copies * (2 * genotypes - rare_copies)) / (2 * genotypes) - // + // // The computational identity is // P(nhets == n) := P(nhets == n+2) * (n+2) * (n+1) / // (4 * homr(n) * homc(n)) diff --git a/plink_stats.h b/plink_stats.h index 01da824..4fb1859 100644 --- a/plink_stats.h +++ b/plink_stats.h @@ -1,7 +1,7 @@ #ifndef __PLINK_STATS_H__ #define __PLINK_STATS_H__ -// This file is part of PLINK 1.90, copyright (C) 2005-2017 Shaun Purcell, +// This file is part of PLINK 1.90, copyright (C) 2005-2018 Shaun Purcell, // Christopher Chang. // // This program is free software: you can redistribute it and/or modify -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/plink1.9.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
