How to generate a consensus sequence from BAM file with bcftools?
0
0
Entering edit mode
7 months ago

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 • 390 views
ADD COMMENT
0
Entering edit mode

The main problem is how to make the {input}.vcf.gz file. Any tips?

First command in your code is creating the VCF file.

Covered in: Generating consensus sequence from bam file

ADD REPLY

Login before adding your answer.

Traffic: 2004 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6