Question: Ngs Question ~ Consensus
1
gravatar for Dirkjan Schokker
7.7 years ago by
Dirkjan Schokker10 wrote:

Could anybody point towards the direction in how to generate a “consensus” fasta sequence file including indels from a BAM file? Thanks

consensus next-gen bam • 3.0k views
ADD COMMENTlink modified 5.0 years ago by Jorge Amigo11k • written 7.7 years ago by Dirkjan Schokker10
3
gravatar for Zhu
7.7 years ago by
Zhu80
Zhu80 wrote:

samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcfutils.pl vcf2fq > cns.fq

seqtk fq2fa cns.fq >cns.fa

seqtk was released in the latest samtools verion.

ADD COMMENTlink written 7.7 years ago by Zhu80

I am fairly sure that this method will only include SNVs, but not INDELs. Please correct me if I'm wrong!

ADD REPLYlink written 7.7 years ago by Ian5.5k
2
gravatar for Vitis
7.7 years ago by
Vitis2.2k
New York
Vitis2.2k wrote:

The GATK package has a utility called AlternateReferenceMaker to do this.

ADD COMMENTlink written 7.7 years ago by Vitis2.2k
2
gravatar for Jorge Amigo
5.0 years ago by
Jorge Amigo11k
Santiago de Compostela, Spain
Jorge Amigo11k wrote:

bcftools view -cg is now deprecated (version 1.1). bcftools call -vm should be used instead.

samtools mpileup -uf hg19.fa in.bam \
| bcftools call -vm -Oz - > out.vcf.gz
tabix -p vcf out.vcf.gz

bcftools consensus seems to be deprecated too (version 1.1). vcf-consensus may be used as an alternative:

samtools faidx hg19.fa chr22:29000000-29200000 \
| vcf-consensus out.vcf.gz \
| bgzip > out.fasta.gz

chr22:29000000-29200000 may be changed for any other region/s of interest

ADD COMMENTlink written 5.0 years ago by Jorge Amigo11k

Coming in 4 year later, I've tried these lines of code for my single-end BAM file but the consensus sequence fills in gaps with bases from the reference.fasta file. Is there a way to just get a consensus of the BAM file or even the mpileup file to also keep gaps where there was no depth of coverage against the reference.fasta?

ADD REPLYlink written 10 months ago by DNAngel40
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1460 users visited in the last hour