利用plink软件基于LD信息过滤SNP

最近有需求,对WGS测序获得SNP信息进行筛减,可问题是测序个体少,call rate,maf,hwe,等条件过滤后,snp数量还是千万级别,所以后面利用plink工具根据LD信息来滤除大量SNP标记。

工具版本:PLINK v1.90b4.6 64-bit (15 Aug 2017)

一、格式转换

首先将准备好的vcf文件转换下格式,map和ped格式:

  1 plink --allow-extra-chr --recode --chr-set 18 --vcf test.gz --out s_vcf
  2 awk '{print $1"\t"$1"_"$4"\t"$3"\t"$4}' s_vcf.map >s1_vcf.map
  3 mv s_vcf.ped s1_vcf.ped

map文件第二列必须要有唯一标识,否则后面区分不了那些snp被剔除;此处awk命令将第二列替换为chr_pos形式,作snp位点名称,如下图所示:

image

二、LD过滤

这里我们主要使用 --indep-pairwise 参数,直接运行查看具体用法:

  1 plink --indep-pairwise --help
  2 PLINK v1.90b4.6 64-bit (15 Aug 2017)           www.cog-genomics.org/plink/1.9/
  3 (C) 2005-2017 Shaun Purcell, Christopher Chang   GNU General Public License v3
  4 --help present, ignoring other flags.
  5 
  6 --indep [window size]<kb> [step size (variant ct)] [VIF threshold]
  7 --indep-pairwise [window size]<kb> [step size (variant ct)] [r^2 threshold]
  8 --indep-pairphase [window size]<kb> [step size (variant ct)] [r^2 threshold]
  9   Generate a list of markers in approximate linkage equilibrium.  With the
 10   'kb' modifier, the window size is in kilobase instead of variant count
 11   units.  (Pre-'kb' space is optional, i.e. '--indep-pairwise 500 kb 5 0.5'
 12   and '--indep-pairwise 500kb 5 0.5' have the same effect.)
 13   Note that you need to rerun PLINK using --extract or --exclude on the
 14   .prune.in/.prune.out file to apply the list to another computation.
 15 
 16 --ld-xchr [code]   : Set Xchr model for --indep{-pairwise}, --r/--r2,
 17                      --flip-scan, and --show-tags.
 18                      1 (default) = males coded 0/1, females 0/1/2 (A1 dosage)
 19                      2 = males coded 0/2
 20                      3 = males coded 0/2, but females given double weighting

主要参数就三个,滑动窗口大小,步长,r方,r方越小滤除的位点就愈多;命令如下:

  1 plink --file s1_vcf --indep-pairwise 1000kb 1 0.5 --out ld

运行结束后产生prune.in,prune.out两个文件,prune.in文件中包含的就是通过筛选条件我们需要的SNP位点。文件内容为map文件第二列snp名称(唯一标识符)。

N{}D`WN0CXN2`))Z]W}756P

根据snp位置信息提取数据请参考另一篇博文:https://www.cnblogs.com/mmtinfo/p/11945592.html

posted @ 2019-12-11 21:21  天使不设防  阅读(16513)  评论(2编辑  收藏  举报