← 返回命令列表

Linux command

bcftools 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

View a VCF/BCF file

bcftools view [input.vcf.gz]

Filter variants

bcftools view -r [chr1:1000000-2000000] [input.vcf.gz]

Convert VCF to BCF

bcftools view -Ob -o [output.bcf] [input.vcf.gz]

Call variants

bcftools mpileup -f [reference.fa] [aligned.bam] | bcftools call -mv -Oz -o [calls.vcf.gz]

Merge multiple VCF files

bcftools merge [file1.vcf.gz] [file2.vcf.gz] -Oz -o [merged.vcf.gz]

Filter variants

bcftools filter -i 'QUAL>30 && DP>10' [input.vcf.gz] -Oz -o [filtered.vcf.gz]

Extract sample genotypes

bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%GT]\n' [input.vcf.gz]

Index a VCF/BCF file

bcftools index [input.vcf.gz]

说明

bcftools is a suite of utilities for variant calling and manipulating files in the Variant Call Format (VCF) and its binary counterpart BCF. It is part of the SAMtools/HTSlib project and is widely used in bioinformatics for genomic variant analysis. All commands work transparently with both VCF and BCF files, compressed or uncompressed. The tools are designed to work in pipelines, reading from stdin and writing to stdout.

参数

-Ob
Output compressed BCF
-Oz
Output compressed VCF (bgzipped)
-Ov
Output uncompressed VCF
-Ou
Output uncompressed BCF (fastest for piping)
-r _region_
Restrict to regions (chr:from-to format)
-s _samples_
Comma-separated list of samples to include
-i _expression_
Include sites matching filter expression
-e _expression_
Exclude sites matching filter expression
-o _file_
Output file name

FAQ

What is the bcftools command used for?

bcftools is a suite of utilities for variant calling and manipulating files in the Variant Call Format (VCF) and its binary counterpart BCF. It is part of the SAMtools/HTSlib project and is widely used in bioinformatics for genomic variant analysis. All commands work transparently with both VCF and BCF files, compressed or uncompressed. The tools are designed to work in pipelines, reading from stdin and writing to stdout.

How do I run a basic bcftools example?

Run `bcftools view [input.vcf.gz]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -Ob do in bcftools?

Output compressed BCF