Return the majority consensus sequence for the Alignment


constructor parameter deprecated in scikit-bio 0.2.0-dev constructor parameter will be removed in scikit-bio 0.3.0 as its most common use is to convert to str, and this functionality is already accessible by calling str on the returned BiologicalSequence (e.g., str(seq)).


constructor : function, optional

Constructor function for creating the consensus sequence. By default, this will be the same type as the first sequence in the Alignment.



The consensus sequence of the Alignment. In other words, at each position the most common character is chosen, and those characters are combined to create a new sequence. The sequence will not have its ID, description, or quality set; only the consensus sequence will be set.


If there are two characters that are equally abundant in the sequence at a given position, the choice of which of those characters will be present at that position in the result is arbitrary.


>>> from skbio.alignment import Alignment
>>> from skbio.sequence import DNA
>>> sequences = [DNA('AC--', id="seq1"),
...              DNA('AT-C', id="seq2"),
...              DNA('TT-C', id="seq3")]
>>> a1 = Alignment(sequences)
>>> a1.majority_consensus()
<DNASequence: AT-C (length: 4)>