This is a test version of Biostars. For the public version, visit https://www.biostars.org.
ld matrix in plink

I am using the below command to generate an LD matrix in plink

plink --r2 --bfile bfilename --ld-snp-list samplesnp.txt --ld-window-r2 0.8 --out samplesnp_ld

but I want to export a matrix format, instead of the default table format. Instruction from plink webpage has the below explanation. It says that "You can request values for all pairs in matrix format (if you specify 'bin' and/or one of the matrix shape modifiers), all pairs in table format (with 'inter-chr'), or a limited window in table format (this is the default). " But I am not sure where to put the bin, or how to specify "bin". I try using "--out samplesnp_ld.bin", but it still returned the ".ld" file.

--r2 <square | square0 | triangle | inter-chr> <gz | bin | bin4> <spaces> <in-phase> <d | dprime | dprime-signed> <with-freqs> <yes-really>
matrix ld

2 answers

Just change "--r2" to "--r2 bin".

It returns

Error: --ld-snp/--ld-snps/--ld-snp-list cannot be used with the --r/--r2 matrix output modifiers.

If you want the matrix to just contain the SNPs in samplesnp.txt, use --extract instead of --ld-snp-list.

add the --noweb if you want this to be done quickly

Log in to answer this question.