Sometimes there is the need to create a consensus sequence for an individual
where the sequence incorporates variants typed for this individual.
This is possible using the
We need the reference sequence
reference.fa in the fasta format
and an indexed VCF with the variants
calls.bcf. The command is:
cat reference.fa | bcftools consensus calls.vcf.gz > consensus.fa
This assumes we have already made the calls, normalized indels and filtered. There is another page which goes deeper and is devoted just to this, but in brief, the variant calling command in its simplest form is:
# call variants bcftools mpileup -Ou -f reference.fa alignments.bam | bcftools call -mv -Oz -o calls.vcf.gz bcftools index calls.vcf.gz # normalize indels bcftools norm -f reference.fa calls.vcf.gz -Ob -o calls.norm.bcf # filter adjacent indels within 5bp bcftools --IndelGap 5 calls.norm.bcf -Ob -o calls.norm.flt-indels.bcf
We welcome your feedback, please help us improve this page by either opening an issue on github or editing it directly and sending a pull request.