How to generate a consensus sequence from BAM file with bcftools?
Hello, I have aligned some files against a reference genome with BMA-MEM, deduplicated and sorted with sambamba to generate a AlnSrtDedSrt.bam file.
The question is: how can I generate a consensus fasta file?
I have this fragment of code:
$ bcftools mpileup -Ou -f {ref}.fa AlnSrtDedSrt.bam | bcftools call -Ou -mv | bcftools norm -f {ref}.fa -Oz -o {input}.vcf.gz
$ tabix {input}.vcf.gz
$ bcftools consensus -f {ref}.fa {input}.vcf.gz > {out}.fa
where {ref}.fa is the reference file.
Is the code correct?
The main problem is how to make the {input}.vcf.gz file. Any tips?
Thank you
• 1,038 views
•
link
0 answers
No answers yet.
Log in to answer this question.
First command in your code is creating the VCF file.
Covered in: Generating consensus sequence from bam file