美文网首页GWAS
通过bcftools合并不同种群的vcf文件

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

作者: 云养江停 | 来源:发表于2021-12-16 22:44 被阅读0次

    通过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
    

    相关文章

      网友评论

        本文标题:通过bcftools合并不同种群的vcf文件

        本文链接:https://www.haomeiwen.com/subject/okdbfrtx.html