This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to create consensus from bam file without IUPAC code?

Hello,

I am working in Genome assembly(Reference Guided), I want to create consensus sequence from bam file.I tried bcftools and vcf-consensus. But, I got some IUPAC code. I want consensus sequence without IUPAC Code.

Reads:

ATGCATGCATGC

ATGCGTGCATGC

ATGCATGCATGC

Consensus: ATGCRTGCATGC

I want to create like this:

ATGCATGCATGC

Please suggest any tool or software. Thanks in advance.

genome sequence assembly

Can't you write a bit of code to "resolve" these ambiguous nucleotides, and randomly chose one of the options? It's obviously not fully correct, but what do you think is the best for a heterozygous variant?

Did you find out how to create the consensus sequences without IUPAC codes? I'm having the same problem using samtools and bcftools.

1 answer

Suresh,

Before converting IUPAC ambiguity base symbols to regular bases, I would suggest you to go through the below mentioned post and understand its relation with ploidy.

Questions Regarding Consensus Sequence Calling With Samtools / Bcftools / Vcfutils.Pl

However, if you are still interested in doing it, then kindly check the weblink:

https://genomicislands.wordpress.com/2014/06/27/converting-ambiguity-codes-in-fasta-files/

Where a person has provided a simple python code to randomly convert ambiguity codes in a FASTA file i.e given a consensus fasta, it randomly choose one of the segregating alleles based on the ambiguity codes. This is very much similar to what WouterDeCoster has mentioned in his comment above.

note: I have not tried this python script myself.

Log in to answer this question.