"Algebras/alg_ali_mis.gap" computes the "most informative sequence" (Freyhult et al 2004). Elements in alignment columns with frequency greater than the background frequency are projected into IUPAC notation. Columns where gaps are over-represented are in lower case.
The real magic is externalized in the file alifold.hh.