Skip to content

Commit

Permalink
--sort-vars forced-QUAL/FILTER segfault fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchang committed Dec 4, 2024
1 parent 5eab376 commit 4b29cbd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions 2.0/Tests/TEST_ONE_WAY_EXPORT/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ set -exo pipefail
# manually-sanity-checked ground truth files.

$1/plink2 $2 $3 --pfile all_ploidy vzs --snps-only --export phylip --out plink2_test
plink2 --zd plink2_test.phy.want.zst > plink2_test.phy.want
$1/plink2 --zd plink2_test.phy.want.zst > plink2_test.phy.want
diff -q plink2_test.phy plink2_test.phy.want
$1/plink2 $2 $3 --pfile all_ploidy vzs --chr PAR1,X,PAR2 --keep-females --snps-only --export phylip-phased --out plink2_test.phased
plink2 --zd plink2_test.phased.phy.want.zst > plink2_test.phased.phy.want
$1/plink2 --zd plink2_test.phased.phy.want.zst > plink2_test.phased.phy.want
diff -q plink2_test.phased.phy plink2_test.phased.phy.want
$1/plink2 $2 $3 --pfile all_ploidy vzs --export A --out plink2_test
plink2 --zd plink2_test.raw.want.zst > plink2_test.raw.want
$1/plink2 --zd plink2_test.raw.want.zst > plink2_test.raw.want
diff -q plink2_test.raw plink2_test.raw.want
6 changes: 3 additions & 3 deletions 2.0/Tests/TEST_PHASED_VCF/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ plink --bfile plink1_data --clump plink2_glm_dbl.PHENO1.glm.logistic --clump-snp
# ($12 != "") check needed because plink 1.x puts two blank lines at the end of
# the .clumped file.
cat plink1_test.clumped | tail -n +2 | awk '{if ($12 == "NONE") $12 = "."; if ($12 != "") print $3"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10"\t"$11"\t"$12}' > plink1_test.clump_compare
plink2 --bfile plink1_data --clump cols=+f plink2_glm_dbl.PHENO1.glm.logistic --clump-p1 0.1 --clump-p2 0.2 --out plink2_test
$1/plink2 --bfile plink1_data --clump cols=+f plink2_glm_dbl.PHENO1.glm.logistic --clump-p1 0.1 --clump-p2 0.2 --out plink2_test
cat plink2_test.clumps | tail -n +2 | awk '{print $3"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10"\t"$11"\t"$12}' > plink2_test.clump_compare
diff -q plink1_test.clump_compare plink2_test.clump_compare

Expand All @@ -141,7 +141,7 @@ $1/plink2 $2 $3 --bfile plink1_data --maf 0.02 --pheno pheno_qt.txt --glm allow-
python3 glm_compare.py -1 plink1_glm.assoc.linear -2 plink2_glm.PHENO1.glm.linear -t 0.1
plink --bfile plink1_data --clump plink2_glm.PHENO1.glm.linear --clump-snp-field ID --clump-p1 0.1 --clump-p2 0.2 --out plink1_test
cat plink1_test.clumped | tail -n +2 | awk '{if ($12 == "NONE") $12 = "."; if ($12 != "") print $3"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10"\t"$11"\t"$12}' > plink1_test.clump_compare
plink2 --bfile plink1_data --clump cols=+f plink2_glm.PHENO1.glm.linear --clump-p1 0.1 --clump-p2 0.2 --out plink2_test
$1/plink2 --bfile plink1_data --clump cols=+f plink2_glm.PHENO1.glm.linear --clump-p1 0.1 --clump-p2 0.2 --out plink2_test
cat plink2_test.clumps | tail -n +2 | awk '{print $3"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10"\t"$11"\t"$12}' > plink2_test.clump_compare
diff -q plink1_test.clump_compare plink2_test.clump_compare

Expand All @@ -167,7 +167,7 @@ python3 glm_compare.py -1 plink1_glm.assoc.linear -2 plink2_glm.PHENO1.glm.linea
$1/plink2 $2 $3 --bfile plink1_data --maf 0.02 --pheno pheno_qt.txt --glm hide-covar --covar plink2_pca.eigenvec --out plink2_glm
plink --bfile plink1_data --clump plink2_glm.PHENO1.glm.linear --clump-snp-field ID --clump-p1 0.1 --clump-p2 0.2 --out plink1_test
cat plink1_test.clumped | tail -n +2 | awk '{if ($12 == "NONE") $12 = "."; if ($12 != "") print $3"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10"\t"$11"\t"$12}' > plink1_test.clump_compare
plink2 --bfile plink1_data --clump cols=+f plink2_glm.PHENO1.glm.linear --clump-p1 0.1 --clump-p2 0.2 --out plink2_test
$1/plink2 --bfile plink1_data --clump cols=+f plink2_glm.PHENO1.glm.linear --clump-p1 0.1 --clump-p2 0.2 --out plink2_test
cat plink2_test.clumps | tail -n +2 | awk '{print $3"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10"\t"$11"\t"$12}' > plink2_test.clump_compare
diff -q plink1_test.clump_compare plink2_test.clump_compare

Expand Down
6 changes: 3 additions & 3 deletions 2.0/plink2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
namespace plink2 {
#endif

static const char ver_str[] = "PLINK v2.0.0-a.6.2"
static const char ver_str[] = "PLINK v2.0.0-a.6.3"
#ifdef NOLAPACK
"NL"
#elif defined(LAPACK_ILP64)
Expand Down Expand Up @@ -72,10 +72,10 @@ static const char ver_str[] = "PLINK v2.0.0-a.6.2"
#elif defined(USE_AOCL)
" AMD"
#endif
" (24 Nov 2024)";
" (3 Dec 2024)";
static const char ver_str2[] =
// include leading space if day < 10, so character length stays the same
""
" "

#ifdef NOLAPACK
#elif defined(LAPACK_ILP64)
Expand Down
4 changes: 2 additions & 2 deletions 2.0/plink2_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8902,7 +8902,7 @@ PglErr WritePvarResortedInterval(const ChrInfo* write_cip, const uint32_t* varia

if (write_qual) {
*cswritep++ = '\t';
if (!IsSet(qual_present, variant_uidx)) {
if ((!qual_present) || (!IsSet(qual_present, variant_uidx))) {
*cswritep++ = '.';
} else {
cswritep = ftoa_g(quals[variant_uidx], cswritep);
Expand All @@ -8911,7 +8911,7 @@ PglErr WritePvarResortedInterval(const ChrInfo* write_cip, const uint32_t* varia

if (write_filter) {
*cswritep++ = '\t';
if (!IsSet(filter_present, variant_uidx)) {
if ((!filter_present) || (!IsSet(filter_present, variant_uidx))) {
*cswritep++ = '.';
} else if (!IsSet(filter_npass, variant_uidx)) {
cswritep = strcpya_k(cswritep, "PASS");
Expand Down

0 comments on commit 4b29cbd

Please sign in to comment.