plink 软件中 --set-missing-var-ids 命令

plink中  --set-missing-var-ids 用于对缺失snpID的snp设定名称

1、测试数据

root@PC1:/home/test# ls
outcome.map  outcome.ped
root@PC1:/home/test# cat outcome.ped
DOR     1       0       0       0       -9      G G     C C     G G     G G     A G     A A     G G     G C     A G     A A
DOR     2       0       0       0       -9      G G     G C     G G     G G     G G     A A     A G     C C     A G     A A
DOR     3       0       0       0       -9      G G     C C     G G     G G     G G     A A     A G     G C     G G     A A
DOR     4       0       0       0       -9      G G     C C     G G     G G     G G     A A     G G     G G     G G     A A
DOR     5       0       0       0       -9      G G     C C     G G     G G     G G     A A     A G     G C     G G     A A
DOR     6       0       0       0       -9      G G     C C     G G     G G     G G     A A     A A     C C     G G     A A
root@PC1:/home/test# cat outcome.map     ## 一共10个snp, 后5个snpID缺失, 为“.”
1       s64199.1        0       55910
1       OAR19_64675012.1        0       85204
1       OAR19_64715327.1        0       122948
1       OAR19_64803054.1        0       203750
1       DU281551_498.1  0       312707
1       .       0       356863
1       .       0       400518
1       .       0       487423
1       .       0       578716
1       .       0       639876

 

2、利用 plink --set-missing-var-ids 增加唯一ID ,--set-missing-var-ids后使用@和#

root@PC1:/home/test# plink --file outcome --set-missing-var-ids @:# --recode tab --out result
root@PC1:/home/test# ls
outcome.map  outcome.ped  result.log  result.map  result.nosex  result.ped
root@PC1:/home/test# cat result.map     ## 将第1列和第2列合并为snpID
1       s64199.1        0       55910
1       OAR19_64675012.1        0       85204
1       OAR19_64715327.1        0       122948
1       OAR19_64803054.1        0       203750
1       DU281551_498.1  0       312707
1       1:356863        0       356863
1       1:400518        0       400518
1       1:487423        0       487423
1       1:578716        0       578716
1       1:639876        0       639876

 

3、可以增加其他修饰

root@PC1:/home/test# plink --file outcome --set-missing-var-ids head@_#end --recode tab --out result2
root@PC1:/home/test# ls
outcome.map  outcome.ped  result2.log  result2.map  result2.nosex  result2.ped  result.log  result.map  result.nosex  result.ped
root@PC1:/home/test# cat result2.map     ## @和#是必须的,其余可选
1       s64199.1        0       55910
1       OAR19_64675012.1        0       85204
1       OAR19_64715327.1        0       122948
1       OAR19_64803054.1        0       203750
1       DU281551_498.1  0       312707
1       head1_356863end 0       356863
1       head1_400518end 0       400518
1       head1_487423end 0       487423
1       head1_578716end 0       578716
1       head1_639876end 0       639876

 

4、shell实现

(2)

root@PC1:/home/test# cat outcome.map
1       s64199.1        0       55910
1       OAR19_64675012.1        0       85204
1       OAR19_64715327.1        0       122948
1       OAR19_64803054.1        0       203750
1       DU281551_498.1  0       312707
1       .       0       356863
1       .       0       400518
1       .       0       487423
1       .       0       578716
1       .       0       639876
root@PC1:/home/test# awk '{OFS = "\t"}{if($2 ~ /^\./) {print $1, $1":"$4, $3,$4} else {print $0}}' outcome.map
1       s64199.1        0       55910
1       OAR19_64675012.1        0       85204
1       OAR19_64715327.1        0       122948
1       OAR19_64803054.1        0       203750
1       DU281551_498.1  0       312707
1       1:356863        0       356863
1       1:400518        0       400518
1       1:487423        0       487423
1       1:578716        0       578716
1       1:639876        0       639876

 

(2)、

root@PC1:/home/test# cat outcome.map
1       s64199.1        0       55910
1       OAR19_64675012.1        0       85204
1       OAR19_64715327.1        0       122948
1       OAR19_64803054.1        0       203750
1       DU281551_498.1  0       312707
1       .       0       356863
1       .       0       400518
1       .       0       487423
1       .       0       578716
1       .       0       639876
root@PC1:/home/test# awk '{OFS = "\t"}{if($2 == ".") {print $1, $1":"$4, $3, $4} else {print $0}}' outcome.map
1       s64199.1        0       55910
1       OAR19_64675012.1        0       85204
1       OAR19_64715327.1        0       122948
1       OAR19_64803054.1        0       203750
1       DU281551_498.1  0       312707
1       1:356863        0       356863
1       1:400518        0       400518
1       1:487423        0       487423
1       1:578716        0       578716
1       1:639876        0       639876

 

5、R实现

dat <- read.table("outcome.map", header = F)
dat

for (i in 1:nrow(dat)) {                   ## 利用循环判断实现
  if (dat[i,2] == ".") {
    dat[i,2] = paste(dat[i,1], dat[i,4], sep = ":")
  }
}
dat

plink 软件中 --set-missing-var-ids 命令

 

上一篇:单片机:开头控制循环灯亮,不亮,暂停,相反方向循环亮


下一篇:linux系统shell实现统计 plink文件基因频率