【Bcftools】合並不同sample的vcf文件,通過bcftools


通過GATK calling出來的SNP如果使用UnifiedGenotype獲得的SNP文件是分sample的,但是如果使用vcftools或者ANGSD則需要Vcf文件是multi-sample的,這里就需要我們將不同samples的文件進行合並,可以通過vcftools的perl模塊進行,但是這種方式對perl的要求較高,且操作比較復雜,這里我們選擇使用Bcftools,操作簡便。

 

分三步:

 

  1. 將vcf進行壓縮,批量壓縮的方法:
bgzip -c -f -@ 10 merge.vcf > merge.vcf.gz

-c, --stdout            write on standard output, keep original files unchanged
-f, --force             overwrite files without asking
-@, --threads INT       number of compression threads to use [1]

 

2. 對生成的vcf.gz進行index:

bcftools index [options] <in.bcf>|<in.vcf.gz>

-t, --tbi            generate TBI-format index for VCF files

 

3.合並操作:

bcftools merge [options] <A.vcf.gz> <B.vcf.gz> [...]

-m, --merge <string>               allow multiallelic records for <snps|indels|both|all|none|id>, see man page for details [both]
-o, --output <file>                write output to a file [standard output]
-O, --output-type <b|u|z|v>        'b' compressed BCF; 'u' uncompressed BCF; 'z' compressed VCF; 'v' uncompressed VCF [v]
-l, --file-list <file>             read file names from the file

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM