To generate a consensus sequence from a BAM file I use the command:
samtools mpileup -uf REF BAM | bcftools call -c | vcfutils.pl vcf2fq > SEQ
samtools/vcfutils gives ambiguity codes when there is a mixed base population at a site, even if the secondary base is quite a low frequency (say 20%) - is there anyway to avoid ambiguity codes? or to increase the frequency at which they would be used? i.e. if I have 60% A and 40% G at a position - i want my consensus to be A.
Also, anyway to get samtools to give ma fasta file instead of fastq - I have a script that converts it - but was wondering if vcfutils can give fasta automatically.
Happy to use alternative to samtools to get a consenus sequence.