plink格式的ped和map文件及转化为012的方法

.map格式

格式说明链接: http://zzz.bwh.harvard.edu/plink/data.shtml#map

map格式的文件, 主要是图谱文件信息, 主要包括染色体名称, 所在的染色体和所在染色体的坐标.

1, map文件没有行头

2, map文件包括四列: 染色体, SNP名称, SNP位置, 碱基对坐标

  • 染色体编号为数字, 未知为0
  • SNP名称为字符或数字, 如果不重要, 可以从1编号, 注意要和bed文件SNP列一一对应
  • 染色体的摩尔未知(可选项, 可以用0)
  • SNP物理坐标

3, 如果只有SNP名称, 可以手动构建map文件, 第二列为SNP名称, 其它三列为0即可.


英文格式说明

By default, each line of the MAP file describes a single marker and must contain exactly 4 columns:

     chromosome (1-22, X, Y or 0 if unplaced)
     rs# or snp identifier
     Genetic distance (morgans)
     Base-pair position (bp units)

Genetic distance can be specified in centimorgans with the --cm flag. Alternatively, you can use a MAP file with the genetic distance excluded by adding the flag --map3, i.e.
plink --file mydata --map3

In this case, the three columns are expected to be

     chromosome (1-22, X, Y or 0 if unplaced)
     rs# or snp identifier
     Base-pair position (bp units)

Base-pair positions are expected to correspond to positive integers within the range of typical human chromosome sizes. 
Example
1 snp1 0 1
1 snp2 0 2
1 snp3 0 3
  • 这里有3个SNP, 分别名为snp1, snp3, snp3 (第二列)
  • 这三个SNP在第一个染色体上 (第一列)
  • 第三列为0
  • 第四列为SNP所在染色体的坐标

.ped格式

格式说明链接:http://zzz.bwh.harvard.edu/plink/data.shtml#ped

bed格式的文件, 主要包括SNP的信息, 包括个体ID, 系谱信息, 表型和SNP的分型信息.

1, 数据没有行头, 空格或者tab隔开的文件
2, 必须要有六列, 包括系谱信息, 表型信息

  • 第一列: Family ID # 如果没有, 可以用个体ID代替
  • 第二列: Individual ID # 个体ID编号
  • 第三列: Paternal ID # 父本编号
  • 第四列: Maternal ID # 母本编号
  • 第五列: Sex (1=male; 2=female; other=unknown) # 性别, 如果未知, 用0表示
  • 第六列: Phenotype # 表型数据, 如果未知, 用0表示
  • 第七列以后: 为SNP分型数据, 可以是AT CG或11 12, 或者A T C G或1 1 2 2

3, 上面六列, 必须要有, 如果没有相关数据, 用0表示.

英文格式说明

As well as the --file command described above, PED and MAP files can be specified separately, if they have different names:
plink --ped mydata.ped --map autosomal.map
Note Loading a large file (100K+ SNPs) can take a while (which is why we suggest converting to binary format). PLINK will give an error message in most circumstances when something has gone wrong.
The PED file is a white-space (space or tab) delimited file: the first six columns are mandatory:

     Family ID
     Individual ID
     Paternal ID
     Maternal ID
     Sex (1=male; 2=female; other=unknown)
     Phenotype

The IDs are alphanumeric: the combination of family and individual ID should uniquely identify a person. A PED file must have 1 and only 1 phenotype in the sixth column. The phenotype can be either a quantitative trait or an affection status column: PLINK will automatically detect which type (i.e. based on whether a value other than 0, 1, 2 or the missing genotype code is observed). 
Example
1 1 0 0 1  0  G G  2 2  C C
1 2 0 0 2  0  A A  0 0  A C
1 3 1 2 1  2  0 0  1 2  A C
2 1 0 0 1  0  A A  2 2  0 0
2 2 0 0 2  2  A A  2 2  0 0
2 3 1 2 1  2  A A  2 2  A A
  • 数据包括两个家系 (第一列)
  • 每个家系有三个个体 (第二列)
  • 第三列父本编号
  • 第四列母本编号
  • 第五列性别
  • 第六列表型值
  • 第七列, 第八列为一个基因型
  • 第九列, 第十列为第二个基因型
  • 第十一列, 第十二列为第三个基因型

练习1

ped格式是1 1 2 2 的格式转化为0 1 2
这里1 1之间有空格

test1.ped

1 1 0 0 1  0  1 1  2 2  1 1
1 2 0 0 2  0  2 2  0 0  2 1
1 3 1 2 1  2  0 0  1 2  2 1
2 1 0 0 1  0  1 1  2 2  0 0
2 2 0 0 2  2  2 2  2 2  0 0
2 3 1 2 1  2  1 1  2 2  1 1

test1.map

1 snp1 0 1
1 snp2 0 2
1 snp3 0 3

plink命令行

plink --file test2 --recodeA

结果:

FID IID PAT MAT SEX PHENOTYPE snp1_2 snp2_1 snp3_2
1 1 0 0 1 -9 0 0 0
1 2 0 0 2 -9 2 NA 1
1 3 1 2 1 2 NA 1 1
2 1 0 0 1 -9 0 0 NA
2 2 0 0 2 2 2 0 NA
2 3 1 2 1 2 0 0 0

可以看出, 表型值缺失的部分变为了"-9", 基因型值缺失的部分变为了NA, snp的major变为了0, snp的minor变为了2, 杂合变为了1.

练习2

ped格式是11 22 的格式转化为0 1 2
这里11中间没有空格
test2.ped

1 1 0 0 1 0 11 22 11
1 2 0 0 2 0 22 00 21
1 3 1 2 1 2 00 12 21
2 1 0 0 1 0 11 22 00
2 2 0 0 2 2 22 22 00
2 3 1 2 1 2 11 22 11

test2.map

1 snp1 0 1
1 snp2 0 2
1 snp3 0 3

命令:
结果:plink.raw

FID IID PAT MAT SEX PHENOTYPE snp1_2 snp2_1 snp3_2
1 1 0 0 1 -9 0 0 0
1 2 0 0 2 -9 2 NA 1
1 3 1 2 1 2 NA 1 1
2 1 0 0 1 -9 0 0 NA
2 2 0 0 2 2 2 0 NA
2 3 1 2 1 2 0 0 0

练习3

ped格式是A T C G 的格式转化为0 1 2
这里A A之间有空格

test3.ped

1 1 0 0 1  0  A A  T T  G G
1 2 0 0 2  0  G G  0 0  A G
1 3 1 2 1  2  0 0  A T  A G
2 1 0 0 1  0  A A  A T  0 0
2 2 0 0 2  2  G G  T T  0 0
2 3 1 2 1  2  A A  T T  G G

test3.map

1 snp1 0 1
1 snp2 0 2
1 snp3 0 3

plink命令行

plink --file test3 --recodeA

结果不变

FID IID PAT MAT SEX PHENOTYPE snp1_2 snp2_1 snp3_2
1 1 0 0 1 -9 0 0 0
1 2 0 0 2 -9 2 NA 1
1 3 1 2 1 2 NA 1 1
2 1 0 0 1 -9 0 0 NA
2 2 0 0 2 2 2 0 NA
2 3 1 2 1 2 0 0 0

练习4

ped格式是AT CG 的格式转化为0 1 2
这里AT之间没有空格

test3.ped

1 1 0 0 1  0  AA  TT  GG
1 2 0 0 2  0  GG  00  AG
1 3 1 2 1  2  00  AT  AG
2 1 0 0 1  0  AA  AT  00
2 2 0 0 2  2  GG  TT  00
2 3 1 2 1  2  AA  TT  GG

test3.map

1 snp1 0 1
1 snp2 0 2
1 snp3 0 3

plink命令行

plink --file test4 --recodeA

结果不变

FID IID PAT MAT SEX PHENOTYPE snp1_2 snp2_1 snp3_2
1 1 0 0 1 -9 0 0 0
1 2 0 0 2 -9 2 NA 1
1 3 1 2 1 2 NA 1 1
2 1 0 0 1 -9 0 0 NA
2 2 0 0 2 2 2 0 NA
2 3 1 2 1 2 0 0 0

练习5

ped格式是A T 1 2 的格式转化为0 1 2
这里AT和12都包含

test3.ped

1 1 0 0 1  0  G G  2 2  C C
1 2 0 0 2  0  A A  0 0  A C
1 3 1 2 1  2  0 0  1 2  A C
2 1 0 0 1  0  G G  2 2  0 0
2 2 0 0 2  2  A A  2 2  0 0
2 3 1 2 1  2  G G  2 2  C C

test3.map

1 snp1 0 1
1 snp2 0 2
1 snp3 0 3

plink命令行

plink --file test4 --recodeA

结果不变

FID IID PAT MAT SEX PHENOTYPE snp1_2 snp2_1 snp3_2
1 1 0 0 1 -9 0 0 0
1 2 0 0 2 -9 2 NA 1
1 3 1 2 1 2 NA 1 1
2 1 0 0 1 -9 0 0 NA
2 2 0 0 2 2 2 0 NA
2 3 1 2 1 2 0 0 0

结论

  • 1, ped文件中, SNP的分型是1 1 2 2 还是11 22 还是AA TT 还是 AA 22不影响结果
  • 2, ped文件中, SNP转化为012的标准是, 主等位基因为0, 杂合为1, 次等位基因为2
  • 3, plink命令中, 如果使用–file name, 那么ped和map文件名为: name.ped 和 name.map

欢迎关注我的公众号

ID:R-breeding
在这里插入图片描述

  • 8
    点赞
  • 49
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值