After calculating the column prior probabilities the alignment probability is estimated by summing over all possible secondary structures. Any column in a secondary structure formula_48 for a sequence of length such that formula_49 can be scored with respect to the alignment tree and the mutational model . The prior distribution given by the PCFG is formula_50. The phylogenetic tree, can be calculated from the model by maximum likelihood estimation. Note that gaps are treated as unknown bases and the summation can be done through dynamic programming.