Bcftools magic string
1
0
Entering edit mode
7.4 years ago
blur ▴ 280

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?

bcftools • 2.5k views
ADD COMMENT
2
Entering edit mode

Odds are very good that you're mixing versions of bcftools.

ADD REPLY
1
Entering edit mode

odds are that he's not piping this command

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

I used samtools mpileup 0.1.18 and bcftools 1.3.1 what combination should I use instead? Thanks!

ADD REPLY
2
Entering edit mode

Either mpileup 0.1.18 + bcftools 0.1.18 or mpileup 1.3.1 + bcftools 1.3.1.

ADD REPLY
2
Entering edit mode
7.4 years ago

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.

ADD COMMENT

Login before adding your answer.

Traffic: 1813 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