通過(guò)GATK calling出來(lái)的SNP如果使用UnifiedGenotype獲得的SNP文件是分sample的,但是如果使用vcftools或者ANGSD則需要Vcf文件是multi-sample的洗显,這里就需要我們將不同samples的文件進(jìn)行合并宪睹,可以通過(guò)vcftools的perl模塊進(jìn)行,但是這種方式對(duì)perl的要求較高匆帚,且操作比較復(fù)雜,這里我們選擇使用Bcftools,操作簡(jiǎn)便尺迂。
分三步:
將vcf進(jìn)行壓縮,批量壓縮的方法:
bgzip -c -f -@ 10 sample.vcf > sample.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]
- 對(duì)生成的vcf.gz進(jìn)行index:
bcftools index sample.vcf.gz
-t, --tbi generate TBI-format index for VCF files
3.合并操作:
bcftools merge A.vcf.gz B.vcf.gz > merge.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