From 6287f6a083650fcad2709ba1689beda39680e367 Mon Sep 17 00:00:00 2001 From: Christopher Chang Date: Thu, 14 Nov 2024 18:56:27 -0500 Subject: [PATCH] fix multiallelic sample-filtering bug --- 2.0/plink2.cc | 5 ++--- 2.0/plink2_data.cc | 8 +++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/2.0/plink2.cc b/2.0/plink2.cc index c1865b66..2a1b8876 100644 --- a/2.0/plink2.cc +++ b/2.0/plink2.cc @@ -44,7 +44,7 @@ namespace plink2 { #endif -static const char ver_str[] = "PLINK v2.0.0-a.6.0" +static const char ver_str[] = "PLINK v2.0.0-a.6.1" #ifdef NOLAPACK "NL" #elif defined(LAPACK_ILP64) @@ -72,7 +72,7 @@ static const char ver_str[] = "PLINK v2.0.0-a.6.0" #elif defined(USE_AOCL) " AMD" #endif - " (11 Nov 2024)"; + " (14 Nov 2024)"; static const char ver_str2[] = // include leading space if day < 10, so character length stays the same "" @@ -2719,7 +2719,6 @@ PglErr Plink2Core(const Plink2Cmdline* pcp, MakePlink2Flags make_plink2_flags, c } if (pcp->command_flags1 & kfCommand1MakePlink2) { - // todo: unsorted case (--update-chr, etc.) if (pcp->sort_vars_mode > kSortNone) { reterr = MakePlink2Vsort(sample_include, &pii, sex_nm, sex_male, pheno_cols, pheno_names, new_sample_idx_to_old, variant_include, variant_bps, variant_ids, allele_idx_offsets, allele_storage, allele_presents, allele_permute, pvar_qual_present, pvar_quals, pvar_filter_present, pvar_filter_npass, pvar_filter_storage, info_reload_slen? pvarname : nullptr, variant_cms, pcp->output_missing_pheno, pcp->legacy_output_missing_pheno, contig_lens, pcp->update_chr_flag, (make_plink2_flags & kfMakePgenWriterVer)? ver_str : nullptr, xheader_blen, info_flags, raw_sample_ct, sample_ct, pheno_ct, max_pheno_name_blen, raw_variant_ct, variant_ct, max_allele_ct, max_variant_id_slen, max_allele_slen, max_filter_slen, info_reload_slen, pcp->output_missing_geno_char, pcp->max_thread_ct, pcp->hard_call_thresh, pcp->dosage_erase_thresh, pcp->misc_flags, make_plink2_flags, (pcp->sort_vars_mode == kSortNatural), pcp->pvar_psam_flags, cip, xheader, chr_idxs, &simple_pgr, outname, outname_end); } else { diff --git a/2.0/plink2_data.cc b/2.0/plink2_data.cc index 1cb477e9..5f516a7c 100644 --- a/2.0/plink2_data.cc +++ b/2.0/plink2_data.cc @@ -5985,9 +5985,11 @@ THREAD_FUNC_DECL MakePgenThread(void* raw_arg) { uintptr_t* ac_flipped = nullptr; if (ctx->thread_write_mhc) { ExpandMhc(sample_ct, ctx->thread_write_mhc[tidx], &write_patch_01_set, &write_patch_01_vals, &write_patch_10_set, &write_patch_10_vals); - ac_remap = ctx->thread_ac_remap[tidx]; - ac_rotate = ctx->thread_ac_rotate[tidx]; - ac_flipped = ctx->thread_ac_flipped[tidx]; + if (ctx->thread_ac_remap) { + ac_remap = ctx->thread_ac_remap[tidx]; + ac_rotate = ctx->thread_ac_rotate[tidx]; + ac_flipped = ctx->thread_ac_flipped[tidx]; + } } uintptr_t* write_phasepresent = nullptr; uintptr_t* write_phaseinfo = nullptr;