This is a test version of Biostars. For the public version, visit https://www.biostars.org.
VCF to BCF conversion with bcftools?

Quite a few google searches are giving me this type of command to convert VCF to BCF:

bcftools view -bS -D chr_list.txt My_mapped_reads.raw.vcf > My_mapped_reads.raw.bcf

gives view: invalid option -- 'b'

From looking at the current documentation I tried:

bcftools view My_mapped_reads.raw.vcf -Oz > My_mapped_reads.raw.bcf

Is it really as simple as the second command now or am I missing something?

bcftools

Sorry, I actually didn't know that was the proper workflow, closing out now!

1 answer

Is it really as simple as the second command now or am I missing something?

no the second command is wrong. Look at the help.

About:   VCF/BCF conversion, view, subset and filter VCF/BCF files.
Usage:   bcftools view [options] <in.vcf.gz> [region1 [...]]
Output options:

    -o,   --output-file <file>          output file name [stdout]
    -O,   --output-type <b|u|z|v>       b: compressed BCF, u: uncompressed BCF, z: compressed VCF, v: uncompressed VCF [v]

.

bcftools view  -O b  -o My_mapped_reads.raw.bcf My_mapped_reads.raw.vcf

Really sorry that was actually a typo on my post, I did:

bcftools view {input_vcf} -Ob > {output_bcf}

Log in to answer this question.