通过bcftools合并不同种群的vcf文件

通过GATK calling出来的SNP如果使用UnifiedGenotype获得的SNP文件是分sample的,但是如果使用vcftools或者ANGSD则需要Vcf文件是multi-sample的,这里就需要我们将不同samples的文件进行合并,可以通过vcftools的perl模块进行,但是这种方式对perl的要求较高,且操作比较复杂,这里我们选择使用Bcftools,操作简便。

分三步:

将vcf进行压缩,批量压缩的方法:

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]
  1. 对生成的vcf.gz进行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
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容