I am trying to generate consensus sequence using samtools (v1.2) and bcftools (v1.2). Everything is just following the manual suggests and bam file was generated by bowtie2.
samtools mpileup -uf ref.fa aln.bam | bcftools call -c | vcfutils.pl vcf2fq > cns.fq
samtools mpileup -uf ref.fa aln.bam | bcftools call -mv -Oz -o calls.vcf.gz tabix calls.vcf.gz cat ref.fa | bcftools consensus calls.vcf.gz > cns.fa
Unfortunately, none of them gave me the right results. First, the consensus is longer than my reference sequences and it was fulfil by reference in which reads didn't cover. Second, if characters reported by reads are different from the reference, it will choose the reference.
I have attempted to change a lot of parameters but nothing works, but then I used the old version of samtools and bcftools to the same bam file, and everything is fine. So I got no idea what happened now.Please help.