This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BCFtools outputs error : [bcf_sync] incorrect number of fields (6 != 5)

I launched samtools to call SNPs on 2 BAM files, and when it comes to BCFtools, both returned an error.

$ samtools mpileup -ugf refseq.fa aln.bam | bcftools view -bvcg - > var.raw.bcf
$ bcftools view var.raw.bcf | vcfutils.pl varFilter -D 100 > var.flt.vcf

It returns the following error:

[bcf_sync] incorrect number of fields (6 != 5) at 13:51289753

What does it mean? Can I just skip this error and keep going with my list of SNPs and indels?

bcftools samtools mpileup bam

Did you use nohup somewhere in your unix command?

No I didn't use nohup, what does it stand for and what does it do? I figured that error happens when the BCF file is truncated .. now I'm not sure why it's truncated yet

Is it matter if I use the nohup command ? I have met a similar problem as the error is

[bcf_sync] incorrect number of fields (0 != 5) at 0:0
[afs] 0:0.000

The following is the command that i have used to generate BCF file:

samtools mpileup -u -f ref.fa -C50 -DS -Q30 -q60 aln.sort.bam | bcftools view -bvceg - > var.raw.bcf

I have got an possible answer here:

nohup merges stdout and stderr of the command that it runs. bcftools then doesn't know what to do with the input data since it also contains messages such as '[mpileup] 1 samples in 1 input files'."

And without using the nohup my file works fine.

1 answer

So I found my way around the problem. When samtools hasn't finished running the output BCF files are truncated which triggered that error when I run BCFtools.

Log in to answer this question.