#将map、ped格式转化为二进制fam、bed、bim格式
plink --file a --out a
#先过滤个体缺失率高于5%的SNP
plink --bfile a --geno 0.05 --make-bed --out b
#转化为map和ped的形式
plink --bfile b --recode --out test_b
#查看一下过滤后的行数
wc -l test_b.map test_b.ped

filter.png
#计算每个SNP的MAF频率
plink --bfile b --freq --out MAF_check
#查看
less -s MAF_check.frq

filter2.png
#去掉MAF小于0.05的位点
plink --bfile b --maf 0.01 --make-bed --out c
可以看到,4个位点被删掉了,剩余23 个位点。
filter3.png
#计算所有位点的HWE的P值
plink --bfile c --hardy
#手动提取哈温p值小于0.00001的位点
awk '{if($9 < 0.00001) print $0}' plink.hwe >plinkzoomhwe.hwe
#查看位点个数
wc -l plinkzoomhwe.hwe
#设定过滤标准1e-5
plink --bfile c --hwe 1e-5 --make-bed --out d
#转化为map和ped的形式
plink --bfile d --recode --out QC_result
#查看最终过滤留下的SNP
less -s QC_result.map
#使用plink软件可以直接输出info文件,可解决haploview出现“results file must contain a snp column”的报错。
plink --file QC_result --recode HV --snps-only just-acgt --out QC_haploview
参考:
https://www.jianshu.com/p/c1bddbba735f
https://www.cnblogs.com/chenwenyan/p/9940706.html