The essential idea of Clustal W consists of joining sequences subsequently to form clusters. The two sequences that have the smallest distance to each other form a new cluster, whose root is calculated from the nodes the cluster contains. A sequence to be aligned to others consists of two parts, the common motif detected, and the part not belonging to the motif. We model the motif positions as multinomial responses arising from position-dependent distributions. Gibbs sampling is a stochastic approach to simulate samples from the distribution of interest.
Iterative samples converge under certain assumptions to the distribution of interest.
Inference is then based on the samples generated. Given the sample, quantities like variance or correlation estimates can easily be derived. As samples are iteratively drawn, the Gibbs sampler does not get stuck in a local optimum, but covers the entire support of the distribution. To faciliate expressions, we start with a search for one motif of fixed length. Probability that pattern belongs at position x in the sequence Finding the optimal alignment is equal to maximizing the log-likelihood.