samtools mpileup VCF output
2
1
Entering edit mode
8.0 years ago
igor 13k

On the samtools github wiki, there is an example for variant calling via pileup:

samtools mpileup -uf ref.fa aln.bam | bcftools call -mv -Oz > calls.vcf.gz

I've seen a similar example in other places. It's piping pileup output to bcftools. This made sense before. However, newer versions of samtools (1.0+) have a --VCF flag. Why is it still necessary to pipe to bcftools? Wasn't bcftools there just to convert to VCF format?

samtools • 11k views
ADD COMMENT
2
Entering edit mode
6.6 years ago

Apologies for a late response, but I have recently been looking at samtools mpileup. I found that the following works very well (here, I use multiple samples over which variants are called):

samtools mpileup --redo-BAQ --min-BQ 30 --per-sample-mF --output-tags DP,AD -f human_g1k_v37.fasta --BCF BAM1.bam BAM2.bam BAM3.bam BAM4.bam | bcftools call --multiallelic-caller --variants-only -Ov -Ob > Output.bcf

...then normalise:

bcftools norm -m-any Output.bcf | bcftools norm -Ov --check-ref w -f human_g1k_v37.fasta > Output.vcf

I then do further filtering using the vcfutils perl script that comes bundled with BCFtools:

bcftools view Output.vcf | vcfutils.pl varFilter -d 18 -w 1 -W 3 -a 1 -1 0.05 -2 0.05 -3 0.05 -4 0.05 -e 0.05 -p > Output.Filt.vcf
ADD COMMENT
0
Entering edit mode
8.0 years ago

Pipe just redirecting output of mpileup to input for bcftools.

Hope this helps.

Cheers

ADD COMMENT
0
Entering edit mode

Yes, that is what is happening. But why pipe to bcftools instead of just using the --VCF option and save the extra step?

ADD REPLY
5
Entering edit mode

Because bcftools call is actually doing the variant calling. mpileup is only outputting genotype likelihoods (in VCF or BCF format), which are then used by bcftools to call variants (in VCF of BCF format). Does that make sense?

ADD REPLY
1
Entering edit mode

You could try to run samtools mpileup with --VCF argument and see how the "vcf" output looks like. I'm telling you this because some time ago I had the same doubt, and after doing the check, I answered myself :-)

ADD REPLY

Login before adding your answer.

Traffic: 1515 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6