From 6540ae647e7c336b0cce589e1f7585f72606f8d8 Mon Sep 17 00:00:00 2001 From: Christopher Chang Date: Thu, 28 Sep 2023 13:06:44 -0700 Subject: [PATCH] more roundtrip tests --- 2.0/Tests/TEST_EXTRACT_CHR/run_tests.sh | 17 +++++++++++++++++ 2.0/Tests/TEST_PHASED_VCF/run_tests.sh | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/2.0/Tests/TEST_EXTRACT_CHR/run_tests.sh b/2.0/Tests/TEST_EXTRACT_CHR/run_tests.sh index df05b6ec5..7622e0101 100755 --- a/2.0/Tests/TEST_EXTRACT_CHR/run_tests.sh +++ b/2.0/Tests/TEST_EXTRACT_CHR/run_tests.sh @@ -22,3 +22,20 @@ do diff -q plink2x_c$c.bed plink2_c$c.bed diff -q plink2x_c$c.bim plink2_c$c.bim done + +# tmp_data is also suitable for ind-major-bed, ped, and tped round-trip tests. +$1/plink2 $2 $3 --bfile tmp_data --export ind-major-bed --out plink2_roundtrip +$1/plink2 $2 $3 --bfile plink2_roundtrip --make-bed --out plink2_test +diff -q tmp_data.bed plink2_test.bed +diff -q tmp_data.bim plink2_test.bim +# .fam files aren't byte-for-byte identical due to spaces -> tabs. + +$1/plink2 $2 $3 --bfile tmp_data --export ped --out plink2_roundtrip +$1/plink2 $2 $3 --pedmap plink2_roundtrip --make-bed --out plink2_test +diff -q tmp_data.bed plink2_test.bed +diff -q tmp_data.bim plink2_test.bim + +$1/plink2 $2 $3 --bfile tmp_data --export tped --out plink2_roundtrip +$1/plink2 $2 $3 --tfile plink2_roundtrip --make-bed --out plink2_test +diff -q tmp_data.bed plink2_test.bed +diff -q tmp_data.bim plink2_test.bim diff --git a/2.0/Tests/TEST_PHASED_VCF/run_tests.sh b/2.0/Tests/TEST_PHASED_VCF/run_tests.sh index ca03ad72b..4351836ce 100755 --- a/2.0/Tests/TEST_PHASED_VCF/run_tests.sh +++ b/2.0/Tests/TEST_PHASED_VCF/run_tests.sh @@ -14,6 +14,13 @@ $1/plink2 $2 $3 --vcf 1kg_phase3_chr21_start.vcf.gz --double-id --out plink2_dat $1/plink2 $2 $3 --pfile plink2_data --export bcf --out plink2_roundtrip $1/plink2 $2 $3 --bcf plink2_roundtrip.bcf --out plink2_roundtrip diff -q plink2_data.pgen plink2_roundtrip.pgen +# Verify haps and hapslegend roundtrip. +$1/plink2 $2 $3 --pfile plink2_data --export haps sample-v2 --out plink2_roundtrip +$1/plink2 $2 $3 --haps plink2_roundtrip.haps --sample plink2_roundtrip.sample --real-ref-alleles --make-pgen --out plink2_roundtrip +diff -q plink2_data.pgen plink2_roundtrip.pgen +$1/plink2 $2 $3 --pfile plink2_data --export hapslegend sample-v2 --out plink2_roundtrip +$1/plink2 $2 $3 --haps plink2_roundtrip.haps --legend plink2_roundtrip.legend 21 --sample plink2_roundtrip.sample --real-ref-alleles --make-pgen --out plink2_roundtrip +diff -q plink2_data.pgen plink2_roundtrip.pgen $1/plink2 $2 $3 --pfile plink2_data --export vcf --out plink2_data