formatting error: Calculate LD matrix from bgen file
1
0
Entering edit mode
10 months ago

Hello, I am new to plink and am learning as I go.

I am trying to calculate an LD matrix for a list of variants while using a bgen file as my reference population. See the command below:

./plink2/plink2 --r2 bin --bgen ukb_imp_chr1_v3_qc2.bgen --ld-snp-list rsids --ld-window-r2 0.8 --out samplesnp_ld

(C) 2005-2021 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to samplesnp_ld.log.
Options in effect:
--bgen ukb_imp_chr1_v3_qc2.bgen
--ld-snp-list rsids
--ld-window-r2 0.8
--out samplesnp_ld
--r2 bin

Start time: Sat Aug  7 15:40:36 2021
Error: --bgen now requires a REF/ALT mode ('ref-first', 'ref-last', or
'ref-unknown').  As of this writing, raw UK Biobank files are ref-first, while
older and PLINK-exported BGEN files are more likely to be ref-last.


Hence I am wondering if anyone might know how to deal with this problem. I have not found any posts where this was an error. I have only seen this being a warning see: plink2 bgen to vcf ukbiobank

Hence is it possible to flip the variants and create a copy bgen file for this to work. Or is this file format irreconcilable with the latest version of plink2

plink ld_matrix error • 634 views
0
Entering edit mode
10 months ago

Please read the error message, which tells you exactly what you are supposed to enter for the REF/ALT mode.

0
Entering edit mode

Apologies- please see the updated version of my command:

./plink2/plink2 --bgen ukb_imp_chr1_v3_qc2.bgen ref-unknown --extract rsids --indep-pairwise 1000 1 0.8 --out samplesnp_ld


Ultimately I am trying to do LD clumping on a list of variants contained in the rsids file. This seems much more intuitive with plink1.9:

./plink --r2 --bgen ukb_imp_chr1_v3_qc2.bgen --sample ukb_imp_chr1_v3_qc2.sample --ld-snp-list rsids --ld-window-r2 0.8 --out samplesnp_ld


Only to find 1.9 does not really seem to work for this task...

Error: BGEN v1.2 input requires PLINK 2.0 (under development as of this
writing).  Use qctool2 or bgenix to downcode to BGEN v1.1 if you want to
process this data with PLINK 1.9.


Could you give a hint as to how to perform LD clumping on bgen files?

1
Entering edit mode

Yes, --r2 isn't implemented yet in plink 2.0, sorry about the inconvenience. However, you can use plink 2.0 --make-bed to create a fileset readable by plink 1.9, and then use plink 1.9 --r2; that's more efficient than following the advice in the 1.9 error message (though the error-message advice would also work).