This is a test version of Biostars. For the public version, visit https://www.biostars.org.
get consensus sequence from bam file with insertions

Hello everyone! I want to get consensus sequence from my NGS data. I created sorted bam, and visualized it in IGV. I know that alligment has SNPs, insertions and deletions. After that I tried to get consensus sequence from my NGS data. I used two ways:

  1. From samtools manual: "Generate the consensus sequence for one diploid individual: samtools mpileup -uf ref.fa aln.bam | bcftools call -c | vcfutils.pl vcf2fq > cns.fq" - this coomand gave me only SNPs in consensus sequence.
  2. Copy consensus sequence from IGV. It gave me consensus with SNPs and deletions.

How can I get insertions in consensus sequence?

Thanks!

consensus

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
code_formatting

Yes, but in this try result sequence has same length as a reference. But region with reads is much less.

Could you please show a screenshot of a region where you suppose an indel?

More information. I used command:

bcftools consensus -f ref.fasta -s sorted_03.bam vars3_1.vcf.gz >out.fa

But insertions and deletions were not find in consensus.

I saw this post: https://www.biostars.org/p/179357/ With sam=1.3, but than I tried

samtools mpileup -uf SA05sequence.fasta sorted.bam | bcftools call -c > vars.vcf

with bam file from bbmap it was not work. The report was: The sequence "chr3B chr3B:12400161..12411680" not found (this is my reference name). Maybe problems with indels can be associated with cigar sting? Different formats or something like that?

Did you resolve this problem?

Please be specific about what problem.

0 answers

No answers yet.

Log in to answer this question.