1、准備測試數據10個樣本,10個位點
[root@linuxprobe test]# ls test.map test.ped [root@linuxprobe test]# cat test.ped ## 10個樣本,10行 DOR sample01 0 0 0 -9 G G C C G G G G A G A A G G A A G G A A DOR sample02 0 0 0 -9 G G G C G G G G G G A A G G C A G G A A DOR sample03 0 0 0 -9 G G C C G G G G G G A A G G A A G G A A DOR sample04 0 0 0 -9 G G C C G G G G G G A A G G A A A G G A DOR sample05 0 0 0 -9 G G C C G G G G G G G A G G C A A G G A DOR sample06 0 0 0 -9 G G C C G G G G G G A A G G A A A A G G DOR sample07 0 0 0 -9 G G C C G G A G A A G A G G C A G G A A DOR sample08 0 0 0 -9 G G C C G G A G A A A A G G A A A G G A DOR sample09 0 0 0 -9 G G G C G G G G G G A A G G C A G G A A DOR sample10 0 0 0 -9 G G C C G G G G A G G A G G C C A G G A [root@linuxprobe test]# cat test.map ## 10個位點 1 snp1 0 55910
1 snp2 0 85204
1 snp3 0 122948
1 snp4 0 203750
1 snp5 0 312707
2 snp6 0 23713
2 snp7 0 24881
2 snp8 0 249725
2 snp9 0 287787
2 snp10 0 2407856
2、提取特定位點
[root@linuxprobe test]# cut -f 2 test.map | sed -n '2p;5p;7p' > testsite.txt [root@linuxprobe test]# cat testsite.txt ## 提取三個位點 snp2 snp5 snp7 [root@linuxprobe test]# plink --file test --extract testsite.txt --recode tab --out testsite;rm *log *.nosex ##利用plink --extract 選項
[root@linuxprobe test]# ls
test.map test.ped testsite.map testsite.ped testsite.txt
[root@linuxprobe test]# cat testsite.map ## 已經提取三個位點
1 snp2 0 85204
1 snp5 0 312707
2 snp7 0 24881
[root@linuxprobe test]# cat testsite.ped
DOR sample01 0 0 0 -9 C C A G G G
DOR sample02 0 0 0 -9 G C G G G G
DOR sample03 0 0 0 -9 C C G G G G
DOR sample04 0 0 0 -9 C C G G G G
DOR sample05 0 0 0 -9 C C G G G G
DOR sample06 0 0 0 -9 C C G G G G
DOR sample07 0 0 0 -9 C C A A G G
DOR sample08 0 0 0 -9 C C A A G G
DOR sample09 0 0 0 -9 G C G G G G
DOR sample10 0 0 0 -9 C C A G G G
## 提取特定位點只需要提供snpID即可,就是map文件對應的第二列
3、刪除特定位點
[root@linuxprobe test]# rm testsite.map testsite.ped ## 刪除上一步測試結果 [root@linuxprobe test]# cat testsite.txt snp2 snp5 snp7 [root@linuxprobe test]# ls test.map test.ped testsite.txt [root@linuxprobe test]# plink --file test --exclude testsite.txt --recode tab --out testsite;rm *.log *.nosex ## 利用plink exclude選項剔除位點 [root@linuxprobe test]# cat testsite.map ## 已經剔除snp2、snp5、snp7位點。 1 snp1 0 55910
1 snp3 0 122948
1 snp4 0 203750
2 snp6 0 23713
2 snp8 0 249725
2 snp9 0 287787
2 snp10 0 2407856 [root@linuxprobe test]# cat testsite.ped DOR sample01 0 0 0 -9 G G G G G G A A A A G G A A DOR sample02 0 0 0 -9 G G G G G G A A C A G G A A DOR sample03 0 0 0 -9 G G G G G G A A A A G G A A DOR sample04 0 0 0 -9 G G G G G G A A A A A G G A DOR sample05 0 0 0 -9 G G G G G G G A C A A G G A DOR sample06 0 0 0 -9 G G G G G G A A A A A A G G DOR sample07 0 0 0 -9 G G G G A G G A C A G G A A DOR sample08 0 0 0 -9 G G G G A G A A A A A G G A DOR sample09 0 0 0 -9 G G G G G G A A C A G G A A DOR sample10 0 0 0 -9 G G G G G G G A C C A G G A ## 剔除位點只需要提供snpID,就是map文件對應的第二列
4、提取特定樣本數據
rm testsite.* ## 刪除上一步測試結果 [root@linuxprobe test]# cut -f 1-2 test.ped | sed -n '2p;6p;9p' > testind.txt ## 提取測試3個樣本 [root@linuxprobe test]# cat testind.txt DOR sample02 DOR sample06 DOR sample09 [root@linuxprobe test]# plink --file test --keep testind.txt --recode tab --out testind; rm *.log *.nosex ## 利用 --keep選項提取 [root@linuxprobe test]# ls testind.map testind.ped testind.txt test.map test.ped [root@linuxprobe test]# cat testind.map ## 位點沒變 1 snp1 0 55910
1 snp2 0 85204
1 snp3 0 122948
1 snp4 0 203750
1 snp5 0 312707
2 snp6 0 23713
2 snp7 0 24881
2 snp8 0 249725
2 snp9 0 287787
2 snp10 0 2407856 [root@linuxprobe test]# cat testind.ped ## 提取了三個樣本 DOR sample02 0 0 0 -9 G G G C G G G G G G A A G G C A G G A A DOR sample06 0 0 0 -9 G G C C G G G G G G A A G G A A A A G G DOR sample09 0 0 0 -9 G G G C G G G G G G A A G G C A G G A A
## 提取樣本需要提供familyID和individualID,就是ped文件對應的前兩列
5、刪除特定樣本數據
[root@linuxprobe test]# rm testind.map testind.ped ## 刪除上一步測試結果 [root@linuxprobe test]# ls testind.txt test.map test.ped [root@linuxprobe test]# cat testind.txt DOR sample02 DOR sample06 DOR sample09 [root@linuxprobe test]# plink --file test --remove testind.txt --recode tab --out testind; rm *.log *.nosex ## 利用 --remove選項刪除樣本 [root@linuxprobe test]# cat testind.map ## 位點不變 1 snp1 0 55910
1 snp2 0 85204
1 snp3 0 122948
1 snp4 0 203750
1 snp5 0 312707
2 snp6 0 23713
2 snp7 0 24881
2 snp8 0 249725
2 snp9 0 287787
2 snp10 0 2407856 [root@linuxprobe test]# cat testind.ped ## 已經刪除sample02、sample06、sample09樣本 DOR sample01 0 0 0 -9 G G C C G G G G A G A A G G A A G G A A DOR sample03 0 0 0 -9 G G C C G G G G G G A A G G A A G G A A DOR sample04 0 0 0 -9 G G C C G G G G G G A A G G A A A G G A DOR sample05 0 0 0 -9 G G C C G G G G G G G A G G C A A G G A DOR sample07 0 0 0 -9 G G C C G G A G A A G A G G C A G G A A DOR sample08 0 0 0 -9 G G C C G G A G A A A A G G A A A G G A DOR sample10 0 0 0 -9 G G C C G G G G A G G A G G C C A G G A
## 刪除樣本需要提供familyID和individualID,就是ped文件對應的前兩列