How to generate a consensus sequence from BAM file with bcftools?

How to generate a consensus sequence from BAM file with bcftools?

0

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


bam


bcftools


consensus

• 29 views

Read more here: Source link