Counting letters in phylip alignment columns with Biopython
using something like for col in column(alignment):


I may get the number of columns which have all the same letters (amino acids)

len(set(col)) == 1

The number of columns which have at least 2 different amino acids (with no dashes):

len(set(col)) &gt; 1 and '-' not in col

The number of columns which have any single dash:

'-' in col



or if you really want columns with a single dash:

    col.count('-') == 1