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

Hello,

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 = AlignIO.read(output_alignment, "fasta")
        summary_align = AlignInfo.SummaryInfo(MultipleSeqAlignment)
        consensus = summary_align.dumb_consensus( ambiguous = 'N', consensus_alpha= alphabet)

align_v1(input_sequences)

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 3.7 years ago • written 3.7 years ago by rimjhim.roy.ch70
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: 1280 users visited in the last hour