vcftools根据个体id提取数据和删除数据

 

001、vcftools根据个体id提取数据

[b20223040323@admin2 test5]$ ls          ## 测试数据
id.list  outcome.vcf
[b20223040323@admin2 test5]$ cat id.list        ## 提取的ID
GMM5
GMM6
GMM7
GMM8
[b20223040323@admin2 test5]$ grep "^#" outcome.vcf | tail -n 1 | cut -f 10-         ## 原始vcf文件个体ID
GMM1    GMM2    GMM3    GMM4    GMM5    GMM6    GMM7    GMM8    GMM9    GMM10   DOR1    DOR2    DOR3    DOR4    DOR5       DOR6    DOR7    DOR8    DOR9    DOR10   SUN1    SUN2    SUN3    SUN4    SUN5    SUN6    SUN7    SUN8    SUN9       SUN10
[b20223040323@admin2 test5]$ vcftools --vcf outcome.vcf --keep id.list --recode --out part_4 &> /dev/null      ## vcftools根据个体ID提取数据
[b20223040323@admin2 test5]$ ls
id.list  outcome.vcf  part_4.recode.vcf
[b20223040323@admin2 test5]$ grep "^#" part_4.recode.vcf | tail -n 1 | cut -f 10-         ## 查看提取后的结果

 

 。

 

002、

[b20223040323@admin2 test5]$ ls                 ## 测试数据
id.list  outcome.vcf
[b20223040323@admin2 test5]$ cat id.list         ## 删除的iD
GMM5
GMM6
GMM7
GMM8
[b20223040323@admin2 test5]$ grep "^#" outcome.vcf | tail -n 1 | cut -f 10-      ## 原始文件ID
GMM1    GMM2    GMM3    GMM4    GMM5    GMM6    GMM7    GMM8    GMM9    GMM10   DOR1    DOR2    DOR3    DOR4    DOR5       DOR6    DOR7    DOR8    DOR9    DOR10   SUN1    SUN2    SUN3    SUN4    SUN5    SUN6    SUN7    SUN8    SUN9       SUN10
[b20223040323@admin2 test5]$ vcftools --vcf outcome.vcf --remove id.list --recode --out part_last &> /dev/null     ## 删除程序
[b20223040323@admin2 test5]$ ls
id.list  outcome.vcf  part_last.recode.vcf
[b20223040323@admin2 test5]$ grep "^#" part_last.recode.vcf | tail -n 1 | cut -f 10-     ## 删除id后结果
GMM1    GMM2    GMM3    GMM4    GMM9    GMM10   DOR1    DOR2    DOR3    DOR4    DOR5    DOR6    DOR7    DOR8    DOR9       DOR10   SUN1    SUN2    SUN3    SUN4    SUN5    SUN6    SUN7    SUN8    SUN9    SUN10

 

 。

 

posted @ 2025-03-14 11:16  小鲨鱼2018  阅读(75)  评论(0)    收藏  举报