step1:从conda上下载plink2
conda install bioconda::plink2
step2:从Resources中的1000 Genomes phase 3下载all_hg38.pgen.zst、all_hg38_rs.pvar.zst 、hg38_corrected.psam
plink2软件的教程: https://www.cog-genomics.org/plink/2.0/
从Resources中的1000 Genomes phase 3下载all_hg38.pgen.zst、all_hg38_rs.pvar.zst 、hg38_corrected.psam,并将all_hg38_rs.pvar.zst 改名为all_hg38.pvar.zst ,hg38_corrected.psam改名为hg38.psam
step3:解压pgen
plink2 --zst-decompress all_hg38.pgen.zst > all_hg38.pgen.zst
step4:把pgen转化成bed,bim,fam
plink2 --pfile all_hg38 vzs -- max-alleles 2 -- make-bed -- out all_hg38_test -- allow-extra-chr
step5:从hg38_corrected.psam筛选出欧洲人,将#IID保存为 eur_iid.txt
plink2 --bfile all_hg38_test --keep eur_IID.txt --make-bed --out all_hg38_test2 -- allow-extra-chr
step6:将需要的SNP保存成SNP.txt
plink2 --bfile all_hg38_test2 --extract SNP.txt --make-bed --out test -- allow-extra-chr
step7:排除重复的SNP
plink2 --bfile test --rm-dup force-first list ---make-bed --out test_nodups -- allow-extra-chr
step8:LD
plink2 --bfile test_nodups --indep-pairwise 500 10 0.1 -- allow-extra-chr
得到plink2.prune.in文件
参数含义见文档: https://www.cog-genomics.org/plink/2.0/ld