欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

plink 各种格式转换和简单命令

最编程 2024-04-29 07:17:50
...

PLINK软件输入文件的常见格式类型:

1,一般格式:PED/MAP
2,转置格式:TPED/TFAM
3,二进制格式:BED/BIM/FAM
几种格式之间可以相互转换。推荐使用BED/BIM/FAM这种格式,读取速度快。
bed文件包含SNP数据,是二进制格式,不能由Notepad++等文本编辑器打开。
bim文件包括SNP位置信息。
fam文件包括家系表型信息,这两种文件都是文本格式。

1、ped/map 转换为 tped/tfam 格式

plink --ped test.ped --map test.map --recode --transpose --out test1
或者
plink --file test --recode --transpose --out test1 
 #生成test1.tped和test1.tfam文件

2、tped/tfam 转换为 ped/map 文件

plink --tped test1.tped --tfam test1.tfam  --recode --out test2
或者
plink --tfile test1 --recode --out test2   
#生成test2.ped和test2.map文件

3、生成二进制格式输入文件

#ped/map转为二进制格式
plink --file test --make-bed --out test3
#tfam/tped转为二进制格式
plink --tfile test1 --make-bed --out test3
#生成test3.bed,test3.bim和test3.fam文件

4、二进制格式转为 tped/tfam 或 ped/map

#用bfile来读取test3.bed,test3.bim和test3.fam文件
#生成test4.tped和test4.tfam
plink --bfile test3 --recode --transpose --out test4
#生成test5.ped和test5.fam
plink --bfile test3 --recode --out test5

5. vcf转ped和map

plink --vcf file.vcf --recode --out file

6.bed bim fam 转为 vcf

plink --bfile arab --export vcf --out arab

7.bed bim fam 转为 bgen

plink2 --bfile filename --export bgen-1.2 --out filename

其他格式转换命令:--recodeAD,SNP编码成加性显性模式,以0、1、2编码SNP,NA为缺失值;--recode12,SNP编码为数字1或2,缺失值为0.
参考推文:
https://www.cnblogs.com/leezx/p/9013615.html
http://zhangyy.site/notes/2015/04/04/GWAS2file.html
————————————————————————————

各种用到的简单命令

plink --bfile filename --a1-allele file.bim 6 --make-bed --out newfilename a1 a2在bim文件中替换位置。
参考:https://www.cog-genomics.org/plink/1.9/data#ax_allele

推荐阅读