Question: Get consensus from Muscle alignment with IUPAC ambiguities in python
gravatar for
4.5 years ago by
European Union
rimjhim.roy.ch70 wrote:


I aligned my sequences using muscle and now I want to get the consensus sequence. The code I am using is:

alphabet = Gapped(IUPAC.ambiguous_dna)

input_sequences = "input.fas"
output_alignment = "output.fas"
def align_v1 (Fasta):
        muscle_cline = MuscleCommandline(muscle_exe, input=Fasta, out=output_alignment)
        stdout, stderr = muscle_cline()
        MultipleSeqAlignment =, "fasta")
        summary_align = AlignInfo.SummaryInfo(MultipleSeqAlignment)
        consensus = summary_align.dumb_consensus( ambiguous = 'N', consensus_alpha= alphabet)


It just adds Ns where it finds any ambiguity. However, I want to incorporate R, Y, M, K, W, S, etc as well. Is there a work around for this?

Thanks a lot


ADD COMMENTlink modified 4.5 years ago • written 4.5 years ago by rimjhim.roy.ch70
Please log in to add an answer.


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