#!/bin/bash -euo pipefail
plink2 \
    --threads 2 \
    --memory 8192 \
    --new-id-max-allele-len 100 missing --allow-extra-chr \
    --set-all-var-ids '@:#:$r:$a' \
    --var-id-multi @:# \
    --pfile NG1RDRPK1V_axy  \
    --make-just-pvar zs \
    --out NG1RDRPK1V_axy_ALL

cp -RP NG1RDRPK1V_axy.pgen NG1RDRPK1V_axy_ALL.pgen
cp -RP NG1RDRPK1V_axy.psam NG1RDRPK1V_axy_ALL.psam

cat <<-END_VERSIONS > versions.yml
PLINK2_RELABELPVAR:
    plink2: $(plink2 --version 2>&1 | sed 's/^PLINK v//; s/ 64.*$//' )
END_VERSIONS
