Solution (source code)

= Solution

A <BLOSUM> <substitution matrix> is estimated from conserved, ungapped blocks of related <protein> sequences. Closely related sequences are clustered to reduce overrepresentation, and aligned <amino acid> pairs from different clusters are counted. Let $q_{ij}$ be their normalized observed pair frequency, and $e_{ij}$ the frequency expected from independent draws at the background <amino acid> frequencies. With unordered pairs, $e_{ii}=p_i^2$ and $e_{ij}=2p_ip_j$ for $i\ne j$.

For <BLOSUM62>, scores are rounded half-bit <logarithms> of these odds:
$$
\boxed{s_{ij}\simeq2\log_2(q_{ij}/e_{ij})}.
$$
A positive entry means that the aligned pair occurs more often in related sequences than the independent-background model predicts; a negative entry means less often. Adding these scores accumulates evidence across aligned positions. A score is neither a percentage identity nor a direct substitution <probability>.<The statistics of sequence similarity scores by National Center for Biotechnology Information>[The choice of substitution scores; The PAM and BLOSUM amino acid substitution matrices]{ref}