Hi,
I ran mpileup and then wanted to transform the output by bcftools using this line:
bcftools call -mv - > Sequence.vcf
I got these error msg:
- invalid BCF2 magic string:only BCFv2.2 is supported
- Failed to open: could not parse header
can anyone tell me what I did wrong?
1 answer
EDIT: there are posts already out there (like this one or even this one) that state that an "invalid BCF2 magic string" error is due to incompatible versions of samtools/bcftools/htslib. this answer below is then just informative.
in several tools, when you use a command such as
bcftools call -mv - > Sequence.vcf
the - character is used to indicate that the input comes from STDOUT. if you're not piping this command to the previous mpileup then it doesn't make sense for bcftools.
you can either use this syntax
samtools mpileup -u -f ref.fa input.bam | bcftools call -mv - > Sequence.vcf
or this other syntax
samtools mpileup -f ref.fa input.bam > input.pileup
bcftools call -mv input.pileup > Sequence.vcf
although I would rather choose the former since you save time and disk space.
Log in to answer this question.
Odds are very good that you're mixing versions of bcftools.
I used samtools mpileup 0.1.18 and bcftools 1.3.1 what combination should I use instead? Thanks!
Either mpileup 0.1.18 + bcftools 0.1.18 or mpileup 1.3.1 + bcftools 1.3.1.
odds are that he's not piping this command
Don't think you'd get that error if he hadn't piped - it would just hang waiting for some input - Devon is right - incorrect versions of tools mixed together
you're definitely right. if not piping is the problem, then bcftools would be waiting for the input and no error message would be thrown out. Devon already stated that a couple of years ago.